Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Last active August 18, 2024 01:46
Show Gist options
  • Save dmccuk/9ea12f6d30dc4bcd1991e8e30c2d1b89 to your computer and use it in GitHub Desktop.
Save dmccuk/9ea12f6d30dc4bcd1991e8e30c2d1b89 to your computer and use it in GitHub Desktop.

Docs:

https://github.com/RedHatDemos/SecurityDemos/blob/master/2019Labs/RHELSecurityLab/documentation/lab1_OpenSCAP.adoc

Generate the report first:

sudo oscap xccdf eval --oval-results --profile cis --results-arf /tmp/arf.xml --report /tmp/report.html /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml

Now create the playbook based on the report:

oscap xccdf generate fix --fix-type ansible --result-id "" /tmp/arf.xml > playbook.yml

Run the playbook against your server to force CIS compliance:

ansible-playbook -i hosts.ini playbook.yml --become

Re-run the report and check the result:

sudo oscap xccdf eval --oval-results --profile cis --results-arf /tmp/arf.xml --report /tmp/report.html /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml

Now your Centos 8 server is almost 95% compliant with the CIS benchmark!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment