Linux Security·7 min read·

Automated Security Auditing with OpenSCAP on Linux Servers

Automate CIS benchmark compliance scanning, generate HTML remediation reports, and enforce security baselines using OpenSCAP and oscap.

NB

Netbay Infrastructure Team

Netbay Engineering

On this page

Maintaining regulatory compliance across cloud environments (such as SOC 2, ISO 27001, or PCI-DSS) requires continuous verification that operating system configurations match industry hardening baselines. Relying on manual checklists across dozens of production VPS nodes inevitably leads to configuration drift, unpatched permissions, and failed audit reviews.

The Security Content Automation Protocol (SCAP) provides a standardized XML-based framework for expressing security baselines. OpenSCAP (oscap) is the certified open-source implementation for Linux. It automates system evaluation against official Center for Internet Security (CIS) benchmarks, generates interactive visual HTML audit reports, and produces executable remediation scripts that bring non-compliant systems back to baseline.

Expand
Security Auditing Compliance
Automated OpenSCAP Security Auditing
OpenSCAP Compliance Scanning & Remediation Workflow SCAP Data Stream CIS Benchmark XML oscap Evaluation Inspects live kernel & configs HTML Audit Report Pass/Fail metric scores Remediation Scripts Automated Ansible / Bash fixes Continuous automated audits prevent configuration drift across production server fleets.

Installing OpenSCAP and Security Guides

On Ubuntu and Debian systems, install the core scanner and official SCAP Security Guide data streams:

bash
# Install the OpenSCAP scanner and security profiles
sudo apt-get update && sudo apt-get install -y libopenscap8 ssg-base ssg-debderived

# On RHEL or Rocky Linux:
# sudo dnf install -y openscap-scanner scap-security-guide

# List available security profiles for your OS
oscap info /usr/share/xml/scap/ssg/content/ssg-ubuntu2404-ds.xml

Standard profiles include CIS Benchmark Level 1 (Workstation and Server) and DISA STIG compliance rules.

Executing a CIS Benchmark Audit

To scan your server against the CIS Level 1 Server benchmark and generate an interactive HTML report:

bash
# Execute evaluation and export report
sudo oscap xccdf eval   --profile xccdf_org.ssgproject.content_profile_cis_level1_server   --results-arf /var/log/oscap-results.xml   --report /var/www/html/compliance-report.html   /usr/share/xml/scap/ssg/content/ssg-ubuntu2404-ds.xml

The generated compliance-report.html provides an intuitive web interface highlighting passed checks in green and failed rules (such as unconfigured password complexity, world-writable directories, or missing auditd rules) in red, complete with exact CVE references and rationale.

Generating Automated Bash Remediation

Instead of manually editing dozens of configuration files, oscap can generate an automated remediation script tailored directly to the findings of your scan:

bash
# Generate remediation shell script from audit findings
oscap xccdf generate fix   --profile xccdf_org.ssgproject.content_profile_cis_level1_server   --fix-type bash   --output /root/remediate-cis.sh   /usr/share/xml/scap/ssg/content/ssg-ubuntu2404-ds.xml

# Review the script and execute in staging
chmod +x /root/remediate-cis.sh
sudo /root/remediate-cis.sh

Vulnerability and Audit Video

Review fundamental security scanning and configuration auditing principles in this technical guide:

Automated Vulnerability and Configuration Auditing
YouTube

Continuous CI/CD Compliance Scanning

Integrating oscap into your weekly maintenance cron or CI/CD golden-image pipelines ensures that every newly provisioned cloud server matches company security standards before serving production customer traffic.

Maintain 100% compliance on isolated Intel Xeon VPS nodes at netbayhosts.in.

Keep reading

Follow along on a real VPS

Deploy Linux in under 60 seconds

These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.

Deploy an instance