The “Security Audit” Nightmare Before Go-Live
Have you ever stayed up all night just to review thousands of lines of configuration before the “Go-live” button was pressed? I once found myself in that position when my boss assigned me to audit a cluster of 20 CentOS 7 servers processing over 5,000 transactions per second for a bank. The requirement was strict: 100% PCI-DSS compliance.
At that time, I started with the most manual method: cross-referencing a checklist with every SSH config file, password policy, and permission setting. After 16 hours of intense work, I had only finished exactly two servers. My head was spinning, and I knew that mistakes were inevitable if I continued this way. Fortunately, a Senior colleague introduced me to OpenSCAP.
This tool completely changed how I operate. Even when CentOS 8 was discontinued and I had to urgently migrate five servers to Rocky Linux within a week, OpenSCAP helped me maintain consistent security standards without much effort.
Why Manual Security Audits Always Fail
Managing a Linux system, whether it’s old CentOS or forks like Rocky/Alma, requires more than just installing a Firewall or SELinux. Reality shows that the traditional approach usually fails for three main reasons:
- Massive Rule Matrix: Standards like STIG have over 300 strict rules. You cannot remember which file needs a chmod or which service needs to be disabled by memory alone.
- Configuration Drift: An engineer might open port 22 to the entire Internet for a quick debug and then forget to close it. Just one small oversight is enough to leave your server “wide open” to hackers.
- Unprofessional Reporting: When partners request proof of security, you can’t just hand them a patched-together text file. You need specific numbers and charts.
OpenSCAP (Open Security Content Automation Protocol) is an open-source framework designed to handle this mess. It automates vulnerability scanning, compliance management, and system evaluation against international standards with precision.
Choosing the Right Security Scanning Tool
There are many options on the market, but I usually categorize them into three segments:
- Custom Scripts: Fast but fragmented, difficult to maintain as the system scales, and extremely prone to missing errors.
- Paid Solutions (Nessus, Qualys): Extremely powerful features and polished interfaces, but costs can reach thousands of dollars per year. This is a major barrier for startups or lab environments.
- OpenSCAP (OSCAP): This is the “gold standard” for the RHEL ecosystem. It is free, built-in, and uses official OVAL/XCCDF data from NIST.
Believe me, OpenSCAP is the optimal choice because it keeps you updated with the latest CVEs without costing a penny in licensing fees.
Real-World OpenSCAP Deployment Process
Let’s turn a “naked” CentOS server into a security fortress through the steps below.
1. Install Component Packages
You need to install openscap-scanner (the engine) and scap-security-guide (the security policy library).
sudo yum install openscap-scanner scap-security-guide -y
After installation, all security standard data will be located at /usr/share/xml/scap/ssg/content/. You can list them with a simple ls command.
2. Identify the Target Profile
Every server type requires a different level of security. An internal web server doesn’t need to be as strict as a server holding credit card data. To see the list of supported profiles for CentOS 7, run:
oscap info /usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml
The screen will display options like: PCI-DSS v3 Control Baseline or Standard System Security Profile. Choose the profile ID that fits your needs.
3. Execute the System Scan
To scan the server according to the Standard profile and export a professional HTML report, use the following command:
oscap xccdf eval \
--profile xccdf_org.ssgproject.content_profile_standard \
--report report.html \
/usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml
This command will audit the entire system. The results are packaged into a report.html file for easy presentation to your supervisors.
4. Analyze and Remediate Errors
Open the report.html file in a browser, and you will see Pass (Green) and Fail (Red) items. The best part is that OpenSCAP provides ready-made Bash or Ansible code for Remediation for each failed item. You just need to copy-paste it.
Automatic Remediation: A Double-Edged Sword
If you want to save time, you can add the --remediate parameter to have OSCAP automatically fix errors during the scan. However, be extremely cautious.
# Warning: Never run this command directly on Production!
oscap xccdf eval --remediate \
--profile xccdf_org.ssgproject.content_profile_standard \
/usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml
For example: A security rule might automatically disable Root access via SSH. If you haven’t created a user with sudo privileges, you will be locked out of the server immediately. My experience is to always test in a Staging environment before applying it to production.
Hard-Won Lessons from the Field
After years of using OpenSCAP, here are three important notes to remember:
- Don’t obsess over 100%: Some rules, such as requiring a separate partition for
/var/log, are very difficult to implement on older servers. Focus on fixing High Severity vulnerabilities and issues related to SSH and Passwords first. - Keep your libraries updated: Hackers find new ways every day. Ensure the
scap-security-guidepackage is always at the latest version by running yum update frequently. - Integrate into CI/CD pipelines: The best way to keep a system clean is to scan for security right at the image build step. This ensures every server created is compliant from the “starting line.”
Mastering OpenSCAP not only makes your system more secure but also builds your confidence for any audit. Try scanning your server today; you might discover dangerous vulnerabilities you’ve been overlooking for a long time.

