OpenSCAP

On this page 7

OpenSCAP is an open-source implementation of the Security Content Automation Protocol (SCAP) that evaluates a system against machine-readable security policies and reports which rules pass or fail. In Linux security, it is the standard tool for automated compliance auditing against baselines such as the CIS Benchmarks, DISA STIGs and PCI DSS profiles, and it can also generate remediation scripts for the failures it finds.

The project provides the oscap command-line scanner, the libopenscap library, a graphical front end called SCAP Workbench and integrations with configuration management. Its policies usually come from the SCAP Security Guide project, which ships ready-made content for Red Hat Enterprise Linux, Fedora, Ubuntu, Debian, SUSE and other distributions.

How OpenSCAP evaluates a system

OpenSCAP works by loading a SCAP data stream, selecting a profile and evaluating each rule’s checks on the target host. A rule describes one requirement, such as a minimum password length; its check is written in OVAL, a language that tests file contents, package versions, kernel parameters or service states.

The scanner collects the needed system facts, compares them with the expected values and assigns each rule a result such as pass, fail, notapplicable or error. It writes results in the XCCDF and ARF formats and can render a human-readable HTML report with an overall score. The table shows the main SCAP components it understands.

ComponentPurposeExample content
XCCDFBenchmarks, profiles and rule structureCIS Level 1 server profile
OVALMachine checks of system stateIs sshd PermitRootLogin set to no
CPEIdentifies platforms and productscpe:/o:redhat:enterprise_linux:9
CCEIdentifiers for configuration itemsPassword length setting
CVEIdentifiers for known vulnerabilitiesOVAL patch definitions
ARFStandard result packagingResults for a central dashboard
SCAP components used by OpenSCAP

Profiles and security baselines

A profile is a named selection of rules with tuned values inside a SCAP data stream. Choosing the profile decides what compliance means for a scan, so the same host can pass one baseline and fail another. Administrators list available profiles with oscap info before scanning.

Profiles can be tailored: rules can be disabled or values changed in a separate tailoring file, without editing the vendor content. This keeps local exceptions documented and auditable. Common profiles include the following.

ProfileOriginTypical audience
CIS BenchmarkCenter for Internet SecurityGeneral hardening, Level 1 or 2
DISA STIGUS Department of DefenseGovernment and defense systems
PCI DSSPayment card industrySystems handling card data
ANSSI BP-028French national security agencyEuropean public sector
OSPPCommon Criteria protection profileCertified product deployments
Frequently used SCAP Security Guide profiles

OpenSCAP compared with other Linux audit tools

OpenSCAP differs from many audit tools because it is standards-based and policy-driven rather than heuristic. Its output maps directly to control identifiers, which auditors accept as formal compliance evidence. Tools such as Lynis offer quicker, more advisory checks, while AIDE and rkhunter address integrity and rootkit detection rather than configuration policy.

ToolMain focusOutput style
OpenSCAPPolicy compliance and vulnerability checksXCCDF and ARF results, HTML report
LynisHardening suggestionsHardening index and advice
AIDEFile integrity monitoringChanged file list
rkhunterRootkit detectionWarnings per test
auditdRuntime event loggingKernel audit records
OpenSCAP and related tools

In practice, these tools are complementary. A hardened host is often scanned with OpenSCAP for compliance, monitored by auditd at runtime and checked with AIDE for unexpected file changes.

Running scans and remediation in practice

A typical scan uses oscap xccdf eval with a profile ID, a results file, a report file and the data stream path. Scans can run locally, against a remote host over SSH with the oscap-ssh wrapper, or against container images with oscap-podman.

OpenSCAP can generate fixes for failed rules as Bash scripts, Ansible playbooks or Kickstart snippets. Some installers apply a profile during installation, so a machine boots already hardened. The table maps common goals to commands.

GoalCommand or methodNote
List profilesoscap info on the data streamShows profile IDs
Scan the local hostoscap xccdf eval with a profileRun as root for full coverage
Fix failures directlyAdd the remediate optionTest first on staging hosts
Produce an Ansible playbookoscap xccdf generate fixReview before applying
Scan a container imageoscap-podmanNo running container required
Common OpenSCAP tasks

Automatic remediation should never be applied blindly to production. Some rules, such as restricting kernel modules or enforcing strict mount options, can disable required functionality if the host has an unusual role.

Limitations and common misunderstandings

OpenSCAP reports conformance to a written policy, not actual security. A host can score 100 percent and still run a vulnerable application, because the scan only checks what the content describes.

  • Outdated content produces misleading results, so the SCAP Security Guide package must match the distribution release.
  • Notapplicable results are often misread as passes, although the rule simply did not apply.
  • Scores are not comparable across profiles, because rule weights and counts differ.
  • Manual rules cannot be automated and still require a human review.
  • Running without root hides many checks and inflates error counts.

Vulnerability scanning with OpenSCAP also depends on vendor OVAL feeds. These feeds describe fixed package versions, so a scan detects missing patches only for software shipped by the distribution. Applications installed from source, language package managers or containers built elsewhere fall outside that coverage and need a separate vulnerability scanner to close the gap.

The simple explanation

OpenSCAP is like an inspector with an official checklist. The checklist says how a secure computer should be set up: which settings must be on, which must be off, and which software must be updated. The inspector goes through the computer line by line and writes a report that shows what is correct and what needs fixing.

It can even hand over a repair plan for the problems it found. The checklist itself comes from respected security organizations, so the report means something to auditors.

How it is used in practice

A hospital IT team manages 120 Red Hat Enterprise Linux servers and must prove to auditors that they follow the CIS Level 1 server baseline. Each night, a scheduled job runs OpenSCAP on every server with the CIS profile and a tailoring file that documents two approved exceptions, then collects the ARF results centrally.

The first scan shows an average score of about 71 percent, mostly due to weak password aging and unused services. The team generates an Ansible playbook from the results, tests it on staging and rolls it out over two weeks. Follow-up scans reach above 95 percent, and the HTML reports become the evidence package for the annual audit.