2021-12-30 22:50:27 +00:00
# Vulnerability processing
2021-08-11 16:42:16 +00:00
- [What to expect ](#what-to-expect )
2021-12-30 22:50:27 +00:00
- [Configuration ](#configuration )
- [Performance ](#performance )
2021-08-11 16:42:16 +00:00
## What to expect
2021-12-30 22:50:27 +00:00
Vulnerability processing is enabled by default.
2021-08-23 23:37:00 +00:00
2021-12-30 22:50:27 +00:00
Fleet checks for vulnerabilities using the National Vulnerability Database (NVD).
2021-08-11 16:42:16 +00:00
2021-12-30 22:50:27 +00:00
First, Fleet retrieves the installed software for each host using osquery queries. Then, Fleet
translates each installed software into [Common Platform Enumeration (CPE) ](https://en.wikipedia.org/wiki/Common_Platform_Enumeration ) names.
2021-08-11 16:42:16 +00:00
2021-12-30 22:50:27 +00:00
Then, using the CPEs, Fleet searches the list of [Common Vulnerabilities and Exposure
(CVE)](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures) identifiers listed in the NVD
to detect the CVEs that match the defined CPEs.
2021-08-11 16:42:16 +00:00
2021-12-30 22:50:27 +00:00
If matches are found, they are exposed on each host's
**Host details** page and on the **Home** page in the Fleet UI. The CVEs are also exposed in the
`fleetctl get software` command and the `GET api/v1/fleet/hosts/{id}` and `GET
api/v1/fleet/software` API routes.
2021-08-11 16:42:16 +00:00
2021-12-30 22:50:27 +00:00
Vulnerability processing happens on the Fleet instance and not on the host machine. Because of this,
detected vulnerabilities cannot be used in the same way you would use an osquery query (e.g. you wouldn't
be able write a query to retrieve all CVEs).
2021-08-11 16:42:16 +00:00
2021-12-30 22:50:27 +00:00
## Configuration
2021-11-23 20:53:40 +00:00
2021-12-30 22:50:27 +00:00
To enable vulnerability processing, first enable the software inventory feature by setting the following app config:
2021-08-11 18:57:53 +00:00
```
---
apiVersion: v1
kind: config
spec:
host_settings:
enable_software_inventory: true
```
2021-12-30 22:50:27 +00:00
Then, enable vulnerability processing by specifying a path where Fleet will download the different
data feeds. This can be done by setting the following app config:
2021-08-11 18:57:53 +00:00
2021-08-11 16:42:16 +00:00
```
2021-12-30 22:50:27 +00:00
---
apiVersion: v1
kind: config
spec:
vulnerability_settings:
databases_path: /some/path
2021-08-11 16:42:16 +00:00
```
2021-08-23 23:37:00 +00:00
Or through environment variables:
```
FLEET_VULNERABILITIES_DATABASES_PATH=/some/path
```
The path specified needs to exist and Fleet needs to be able to read and write to and from it. This is the only mandatory
configuration needed for vulnerability processing to work. Additional options, like vulnerability check frequency, can be
2021-12-08 22:23:35 +00:00
found in the [configuration documentation ](../02-Deploying/03-Configuration.md#vulnerabilities ).
2021-08-18 20:25:14 +00:00
2021-10-28 03:28:50 +00:00
You'll need to restart the Fleet instances after changing these settings.
2021-12-30 22:50:27 +00:00
## Performance
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
Vulnerability processing is performed in one Fleet instance. If your Fleet deployment uses multiple
instances, only one will be doing the work.
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
In order to conduct vulnerability processing, Fleet downloads the following files:
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
1. A preprocessed CPE database generated by FleetDM to speed up the translation process: https://github.com/fleetdm/nvd/releases
2. The historical data for all CVEs and how to match to a CPE: from https://nvd.nist.gov/vuln/data-feeds
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
The database generated in step 1 is processed from the original official CPE dictionary
https://nvd.nist.gov/products/cpe. This CPE dictionary is typically updated once a day.
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
The matching occurs server-side to make the processing as fast as possible, but the whole process is both CPU and memory intensive.
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
For example, when running a development instance of Fleet on an Apple Macbook Pro with 16 cores, matching 200,000 CPEs against the CVE database will take around 10 seconds and consume about 3GBs of RAM.
2021-10-28 03:28:50 +00:00
2021-12-30 22:50:27 +00:00
The CPU and memory usages are in burst once every hour (or the configured periodicity) on the instance that does the processing. RAM spikes are expected to not exceed the 2GBs.