# Configuration assessment

> Each device's settings checked against the CIS benchmark for its operating system, with a score per policy and each check's result, rationale and fix.

Configuration assessment tells you which devices are hardened and which aren't. The sensor checks each device's
settings against the hardening policy for its operating system, and reports every check as passed, failed or not
applicable, with why it matters and what to change.

## Before you begin

- **Who:** an administrator of the realm, in a group holding `RealmOwner` or `RealmViewer` on the realm or a realm
  above it (see [Delegated administration](../../../platform/realms/delegated-administration/)). Reading needs no
  more than `RealmViewer`.
- **Where:** the API.
- **First:** an enrolled device. Its first assessment runs when its sensor starts.

## How it works

Each device is checked against the policy that fits its operating system:

| System | Checked against |
|---|---|
| Ubuntu, Debian, Red Hat Enterprise Linux and its rebuilds, and other major Linux distributions | The CIS benchmark for that distribution and version |
| macOS | The CIS benchmark for that macOS version |
| A Linux system with no benchmark of its own | A general Linux hardening policy |

Each policy gets a **score**: the checks passed, as a percentage of those passed and failed. Checks that don't apply
to the device don't count. Each check keeps its result, its rationale and its remediation.

## Set it up

Nothing to turn on. Through the API ([Call the API](../../../develop/api/)), read a device's policies with their scores
by its sensor id, then a page of one policy's checks:

```sh
curl "https://foobar.cvyuh.com/api/v0/endpoint/dar/v1/sca/policies?agent=<sensor id>" \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

curl "https://foobar.cvyuh.com/api/v0/endpoint/dar/v1/sca/checks?agent=<sensor id>&policy=<policy id>" \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 50}'
```

Each policy answers its `id`, `name`, `passed`, `failed`, `notApplicable`, `score` and when it last ran. Assessment
alerts are [Security events](../../security-log/events/) with `preset=sca`, filterable by `policy`, `check` and
`result`.

## Limits and defaults

| Limit | Default | Can you change it? |
|---|---|---|
| Policies run | The one for the device's own system | No |
| Schedule | When the sensor starts, then every 12 hours | Yes, in the [configuration reference](../../sensors/configuration-reference/#configuration-assessment-sca) |
| Coverage | Local disks | Network shares aren't checked |

## Good to know

- **Alerts follow changes.** After a device's first assessment, a check raises an alert when its result changes, not
  at every run; the policy's checks always show the latest result.

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| A device has no policies | Its sensor hasn't finished its first assessment, or never connected | Check its status; wait for the first run after it starts |
| `400` for a policy | The policy id isn't well formed | Read the device's policies first and use an `id` from them |
| A policy's checks come back empty | The device hasn't run that policy | Use an `id` from the device's own policies |

## Audit record

Assessment results are alerts in the [security log](../../security-log/events/); reading them writes no audit record.

## Related

- [File integrity](../file-integrity/): changes to the files these settings live in.
- [Threat mapping](../threat-mapping/): the compliance controls each failed check touches.
