Sub topic 20
Handling exceptions and documenting risk acceptance
This chapter assumes you can run an OpenSCAP scan and read its report, as covered earlier. It also assumes you can write a small shell script and edit configuration files. Some CIS recommendations will break a real workload, and you need a repeatable way to handle that. Here you learn how to record an exception, get it approved, tailor your scans so they stop reporting known findings as new, and review the exception over time.
Why exceptions are normal
No server passes every CIS recommendation. The benchmarks are written for a generic host, and your server has a job. A few common conflicts:
- A build server needs
noexecremoved from/tmpbecause compilers write and run temporary files there. - A database host needs IPv6 enabled because an application connects over
::1. - A legacy application requires an SSH setting or cipher that the benchmark forbids.
- A vendor does not support the product on a host with SELinux enforcing.
You have three options for each failing rule:
- Remediate it.
- Mitigate it with a different control that reduces the same risk.
- Accept the risk with an approved exception.
Only the third option needs formal paperwork, but the second one needs a short note as well. Silently skipping a rule is the failure mode to avoid. An unrecorded deviation looks the same as an oversight, and the next scan will report it again.
What a good exception record contains
An exception is a short written record. It should answer who, what, why, how long, and what else protects the system. A record that cannot answer these questions is not enough for an auditor or for you six months later.
| Field | What to write | Example |
|---|---|---|
| ID | A unique, stable identifier | EXC-2026-014 |
| Rule | Benchmark name, version, and recommendation number or SCAP rule ID | `mount_option_tmp_noexec` |
| Scope | Hosts or groups affected | `build-01`, `build-02` |
| Reason | The technical conflict, with evidence | Compiler toolchain executes files from `/tmp` |
| Risk | What an attacker could gain, and how likely it is | Staged payloads can run from `/tmp` |
| Compensating controls | Other controls that reduce the risk | Dedicated `TMPDIR` on a `noexec` mount, AIDE, auditd |
| Owner | The person accountable for the system | Build platform team lead |
| Approver | The person who accepted the risk | Security manager |
| Approved on, expires on | Dates | 2026-11-28, 2027-05-28 |
| Review trigger | Events that force an early review | OS upgrade, new benchmark version |
Always set an expiry date. An exception without one becomes permanent by default. Six to twelve months is common, and shorter is better for high-risk findings.
The approver should not be the person who wants the exception. The owner of the risk, usually a manager with authority over the business function, signs off. The security team advises.
Storing exceptions where tools can read them
Keep records in version control next to your configuration management code. Plain YAML works well because it is reviewable in a pull request and machine-readable. A pull request gives you an approval trail for free.
# exceptions/EXC-2026-014.yaml
id: EXC-2026-014
rule: xccdf_org.ssgproject.content_rule_mount_option_tmp_noexec
benchmark: CIS Red Hat Enterprise Linux 9 Benchmark
profile: cis_server_l1
scope:
- build-01
- build-02
reason: Compiler toolchain executes temporary files from /tmp.
risk: Staged payloads could execute from /tmp.
compensating_controls:
- Build jobs use a dedicated TMPDIR on a noexec mount.
- auditd watches execution from /tmp.
- AIDE runs daily.
owner: build-platform-lead
approver: security-manager
approved: 2026-11-28
expires: 2027-05-28Tailoring the scan so it matches the decision
Once an exception is approved, the scan should treat it as a known state. Otherwise every report shows the same failure and people stop reading reports. OpenSCAP supports this through a tailoring file, which is an XML file that adjusts a profile without editing the original SCAP content.
You can generate a tailoring file with the autotailor tool from the openscap-utils package. This example unselects one rule from the CIS Server Level 1 profile and writes a new profile ID.
autotailor \
--output tailoring.xml \
--new-profile-id xccdf_org.ssgproject.content_profile_cis_server_l1_custom \
--unselect xccdf_org.ssgproject.content_rule_mount_option_tmp_noexec \
/usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml \
xccdf_org.ssgproject.content_profile_cis_server_l1Then scan with the tailoring file and the new profile:
sudo oscap xccdf eval \
--tailoring-file tailoring.xml \
--profile xccdf_org.ssgproject.content_profile_cis_server_l1_custom \
--results results.xml \
--report report.html \
/usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xmlCheck the option names against autotailor --help on your version, since the flags have changed between releases.
Tailoring has a cost. A tailored profile no longer claims to be the plain CIS profile, so reports must say "CIS Server Level 1 with approved exceptions" and reference the exception IDs. Keep one tailoring file per host group, not per host, or the files drift apart.
Alternatives to removing the rule
Removing a rule hides it. Two other approaches keep it visible:
- Leave the rule selected and mark the finding as an accepted failure in your reporting layer, matching the rule ID against the exception files.
- Tailor a rule's value instead of removing the rule. For example, relax a numeric limit while still checking that it is set.
Prefer these when you can, because a relaxed check still catches a setting that has been deleted entirely.
The exception lifecycle
An exception moves through states, and it should return to review before it expires.
Catching expired exceptions automatically
A review date nobody checks does nothing. A short script that runs in your CI pipeline or from a systemd timer can fail when an exception has expired. This example uses Python with the PyYAML library.
#!/usr/bin/env python3
"""Fail if any exception file in ./exceptions has expired or expires soon."""
import sys
from datetime import date, timedelta
from pathlib import Path
import yaml
WARN_DAYS = 30
today = date.today()
problems = []
for path in sorted(Path("exceptions").glob("*.yaml")):
record = yaml.safe_load(path.read_text())
expires = record["expires"]
if isinstance(expires, str):
expires = date.fromisoformat(expires)
if expires < today:
problems.append(f"{record['id']} EXPIRED on {expires}")
elif expires - today <= timedelta(days=WARN_DAYS):
problems.append(f"{record['id']} expires on {expires}")
for line in problems:
print(line)
sys.exit(1 if problems else 0)PyYAML parses an unquoted 2027-05-28 as a date object, which is why the script handles both a string and a date.
Common mistakes
- Excepting a whole section. Accept the single rule that conflicts, not every rule in the same chapter.
- No compensating control. "We accept the risk" with no other protection is weak. Name something that detects or limits abuse.
- Approving your own exception. The requester and approver must be different people.
- Forgetting benchmark updates. When CIS releases a new version, recommendation numbers change. Use the SCAP rule ID alongside the number, and re-validate each exception against the new version.
- Treating exceptions as permanent. The expiry date exists so someone looks again.
Review checklist
Before you close an exception request, confirm each of these:
- The rule is identified by SCAP rule ID and benchmark version.
- The conflict is described with evidence, such as an error message or vendor statement.
- At least one compensating control exists and is itself verified by a scan or check.
- A different person from the requester has approved it.
- An expiry date is set and a check will notice it.
- The scan configuration matches the decision.
Exercise
A scan of your web server fails the rule that sets X11Forwarding no, because a developer says a legacy tool needs X forwarding. List what you would put in the exception record, and name one thing that is wrong with accepting the risk "permanently, because the tool will never change".
Show answer
The record needs a rule ID and benchmark version, the affected host, the reason with evidence (what the tool does and why it needs X forwarding), the risk (a compromised client could abuse the forwarded X connection), compensating controls (restrict forwarding to that user with a Match User block in sshd configuration, limit source addresses, log with auditd), an owner, a different approver, an approval date, and an expiry date. A permanent acceptance is wrong because it has no expiry, so nobody re-checks whether the tool was replaced, whether the OS or benchmark changed, or whether the compensating controls still work. Setting a six or twelve month expiry forces a review.
Exercise
Why is it better to tailor a rule's value than to unselect the rule, when the workload only needs a looser limit?
Show answer
An unselected rule is no longer checked, so a deleted or badly changed setting goes unnoticed. A tailored value keeps the rule in the scan. The scan still fails if the setting is missing or exceeds the approved limit.