Top Related Projects
Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
A vulnerability scanner for container images and filesystems
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Detect compliance and security violations across Infrastructure as Code to mitigate risk before provisioning cloud native infrastructure.
This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL
Quick Overview
OpenSCAP is an open-source security compliance and vulnerability scanning tool. It provides a framework for system administrators and security professionals to assess, measure, and enforce IT security policies across various systems and platforms. OpenSCAP implements the Security Content Automation Protocol (SCAP) standards to perform automated configuration and vulnerability scanning.
Pros
- Comprehensive security assessment capabilities
- Supports multiple platforms and security standards
- Integrates well with other security tools and automation frameworks
- Actively maintained and supported by a large community
Cons
- Steep learning curve for beginners
- Complex configuration and setup process
- Limited graphical user interface options
- Can be resource-intensive for large-scale scans
Code Examples
# Run a basic system scan using the default SCAP Security Guide (SSG) profile
oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_standard --results scan-results.xml /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
# Generate an HTML report from scan results
oscap xccdf generate report scan-results.xml > scan-report.html
# Python example using OpenSCAP API
import openscap_api as oscap
sess = oscap.xccdf.session_new("/usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml")
sess.load()
sess.profile_id = "xccdf_org.ssgproject.content_profile_pci-dss"
sess.evaluate()
sess.export_results(oscap.xccdf.session.XCCDF_SESSION_RESULTS_FILE, "results.xml")
Getting Started
To get started with OpenSCAP:
-
Install OpenSCAP:
sudo apt-get install libopenscap8 openscap-scanner
-
Download SCAP content (e.g., SCAP Security Guide):
sudo apt-get install ssg-base ssg-debderived ssg-debian ssg-ubuntu
-
Run a basic scan:
sudo oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_standard --results scan-results.xml /usr/share/xml/scap/ssg/content/ssg-ubuntu2004-ds.xml
-
Generate an HTML report:
oscap xccdf generate report scan-results.xml > scan-report.html
Competitor Comparisons
Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
Pros of Lynis
- Lightweight and easy to install with minimal dependencies
- Supports a wide range of Unix/Linux systems and distributions
- Provides detailed reports and suggestions for system hardening
Cons of Lynis
- Less comprehensive coverage of security standards compared to OpenSCAP
- Limited support for Windows systems
- Smaller community and fewer integrations with other security tools
Code Comparison
Lynis (shell script):
#!/bin/sh
# Default values
AUDITOR="lynis"
CRONJOB=0
ECHOCMD="echo"
OpenSCAP (C):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include "oscap.h"
#include "oscap_source.h"
#include "scap_ds.h"
Both projects aim to improve system security and compliance, but they differ in their approach and implementation. Lynis is written in shell script, making it more portable and easier to customize, while OpenSCAP is primarily written in C, offering potentially better performance for large-scale assessments.
Lynis focuses on quick system audits and provides actionable recommendations, whereas OpenSCAP offers a more comprehensive framework for security compliance and supports a broader range of security standards and benchmarks.
A vulnerability scanner for container images and filesystems
Pros of grype
- Focused specifically on container and application security scanning
- Faster scanning speed, especially for container images
- More user-friendly CLI interface and easier integration into CI/CD pipelines
Cons of grype
- Less comprehensive coverage of system-wide security policies
- Limited support for generating detailed compliance reports
- Narrower scope compared to OpenSCAP's broader system security capabilities
Code comparison
grype:
name: Scan with grype
on: [push]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: anchore/scan-action@v3
with:
image: "your-image:tag"
OpenSCAP:
oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_pci-dss \
--results-arf arf.xml \
--report report.html \
/usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml
grype focuses on a straightforward container scanning workflow, while OpenSCAP provides a more complex command structure for comprehensive system security evaluation.
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
Pros of Trivy
- Faster scanning speed and lightweight nature
- Broader support for container image formats and cloud infrastructure
- Easy installation and usage with minimal configuration
Cons of Trivy
- Less comprehensive security content compared to OpenSCAP
- Limited support for traditional operating system scanning
- Fewer customization options for compliance reporting
Code Comparison
Trivy command-line usage:
trivy image alpine:3.10
OpenSCAP command-line usage:
oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_pci-dss --results-arf arf.xml --report report.html /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml
Trivy focuses on simplicity and ease of use, while OpenSCAP provides more detailed and customizable scans. Trivy excels in container and cloud-native environments, whereas OpenSCAP is better suited for traditional operating system compliance checks and more complex security assessments.
Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Pros of Vuls
- Written in Go, offering better performance and easier deployment
- Supports multiple Linux distributions and package managers
- Provides a simple web UI for vulnerability management
Cons of Vuls
- Limited support for Windows systems
- Requires manual configuration for some advanced features
- Smaller community and fewer integrations compared to OpenSCAP
Code Comparison
OpenSCAP (C):
int xccdf_policy_model_get_score(struct xccdf_policy_model *model, struct xccdf_result *result, const char *system)
{
struct oscap_iterator *it = xccdf_result_get_scores(result);
while (oscap_iterator_has_more(it)) {
struct xccdf_score *score = (struct xccdf_score *) oscap_iterator_next(it);
if (strcmp(xccdf_score_get_system(score), system) == 0) {
return xccdf_score_get_score(score);
}
}
oscap_iterator_free(it);
return 0;
}
Vuls (Go):
func (r *ScanResult) FilterByCvssOver(over float64) {
filtered := []DetectedCveID{}
for _, d := range r.ScannedCves {
if over <= d.MaxCvss().Value.Score {
filtered = append(filtered, d)
}
}
r.ScannedCves = filtered
}
Both projects aim to improve system security, but they take different approaches. OpenSCAP focuses on compliance and configuration assessment, while Vuls emphasizes vulnerability scanning and management. The code snippets demonstrate the language differences and their respective focuses.
Detect compliance and security violations across Infrastructure as Code to mitigate risk before provisioning cloud native infrastructure.
Pros of Terrascan
- Focused on cloud infrastructure and IaC scanning
- Supports multiple IaC tools (Terraform, Kubernetes, etc.)
- Easy to integrate into CI/CD pipelines
Cons of Terrascan
- Limited to cloud infrastructure security
- Smaller community and ecosystem compared to OpenSCAP
- Less comprehensive coverage of system-level security
Code Comparison
OpenSCAP (C):
xccdf_policy_model_iterator_reset(policy_it);
while (xccdf_policy_model_iterator_has_more(policy_it)) {
struct xccdf_policy *policy = xccdf_policy_model_iterator_next(policy_it);
xccdf_policy_evaluate(policy);
}
Terrascan (Go):
for _, iacProvider := range iacProviders {
iacParser := iacProvider.NewParser()
iacParser.ParseIacFile(filePath)
violations := iacParser.EvaluatePolicies()
}
OpenSCAP focuses on system-level security compliance, using C for low-level access. Terrascan specializes in cloud infrastructure security, utilizing Go for easier cloud integration. OpenSCAP offers broader security coverage but requires more setup, while Terrascan provides simpler cloud-specific scanning with less depth. OpenSCAP has a larger community and extensive documentation, whereas Terrascan benefits from easier CI/CD integration and multi-cloud support.
This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL
Pros of ansible-collection-hardening
- Easier to use and integrate with existing Ansible workflows
- More flexible and customizable for specific environments
- Regularly updated with community contributions
Cons of ansible-collection-hardening
- Limited to Ansible-based systems and environments
- May require more manual configuration for complex security policies
- Less comprehensive in terms of security standards coverage
Code Comparison
ansible-collection-hardening:
- name: Ensure password quality requirements
lineinfile:
path: /etc/security/pwquality.conf
regexp: '^{{ item.option }}'
line: '{{ item.option }} = {{ item.value }}'
loop:
- { option: 'minlen', value: '14' }
- { option: 'dcredit', value: '-1' }
openscap:
<xccdf:Rule id="xccdf_org.ssgproject.content_rule_accounts_password_minlen_login_defs">
<xccdf:title>Set Password Minimum Length in login.defs</xccdf:title>
<xccdf:description>To specify password length requirements for new accounts,
edit the file /etc/login.defs and add or correct the following line:
PASS_MIN_LEN 14
</xccdf:description>
</xccdf:Rule>
The ansible-collection-hardening example shows a more flexible approach to setting password policies using Ansible tasks, while the openscap example demonstrates a more structured, standards-based definition of security rules.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OpenSCAP
Open Source Security Compliance Solution
About
The oscap
program is a command line tool that allows users to load, scan,
validate, edit, and export SCAP documents.
- Homepage of the project: www.open-scap.org
- User Manual: OpenSCAP User Manual
- Compilation, testing and debugging: OpenSCAP Developer Manual
- For new contributors: How to contribute
Contributing
We welcome all contributions to the OpenSCAP project. If you would like to contribute, either by fixing existing issues or adding new features, please check out our contribution guide to get started. If you would like to discuss anything, ask questions, or if you need additional help getting started, you can either send a message to our libera.chat IRC channel, #openscap, or to our mailing list.
Microsoft Windows Support
The Microsoft Windows support is officially void as of Febuary 1, 2022.
Use cases
SCAP Content Validation
- The following example shows how to validate a given source data stream; all components within the data stream are validated (XCCDF, OVAL, OCIL, CPE, and possibly other components):
oscap ds sds-validate scap-ds.xml
Scanning
- To evaluate all definitions within the given OVAL Definition file, run the following command:
oscap oval eval --results oval-results.xml scap-oval.xml
where scap-oval.xml is the OVAL Definition file and oval-results.xml is the OVAL Result file.
- To evaluate all definitions from the OVAL component that are part of a particular data stream within a SCAP data stream collection, run the following command:
oscap oval eval --datastream-id ds.xml --oval-id xccdf.xml --results oval-results.xml scap-ds.xml
where ds.xml is the given data stream, xccdf.xml is an XCCDF file specifying the OVAL component, oval-results.xml is the OVAL Result file, and scap-ds.xml is a file representing the SCAP data stream collection.
- To evaluate a specific profile in an XCCDF file run this command:
oscap xccdf eval --profile Desktop --results xccdf-results.xml --cpe cpe-dictionary.xml scap-xccdf.xml
where scap-xccdf.xml is the XCCDF document, Desktop is the selected profile from the XCCDF document, xccdf-results.xml is a file storing the scan results, and cpe-dictionary.xml is the CPE dictionary.
- To evaluate a specific XCCDF benchmark that is part of a data stream within a SCAP data stream collection run the following command:
oscap xccdf eval --datastream-id ds.xml --xccdf-id xccdf.xml --results xccdf-results.xml scap-ds.xml
where scap-ds.xml is a file representing the SCAP data stream collection, ds.xml is the particular data stream, xccdf.xml is ID of the component-ref pointing to the desired XCCDF document, and xccdf-results.xml is a file containing the scan results.
Document generation
- without XCCDF rules
oscap xccdf generate guide XCCDF-FILE > XCCDF-GUIDE-FILE
- with XCCDF rules
oscap xccdf generate guide --profile PROFILE XCCDF-FILE > XCCDF-GUIDE-FILE
- generate report from scanning
oscap xccdf generate report XCCDF-RESULT-FILE > XCCDF-REPORT-FILE
Top Related Projects
Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
A vulnerability scanner for container images and filesystems
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Detect compliance and security violations across Infrastructure as Code to mitigate risk before provisioning cloud native infrastructure.
This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot