This Ansible role may be used to evaluate and remediate systems via OpenSCAP security profiles.
No special requirements outside of what Ansible itself brings to the table. However, a browser is useful to view the generated HTML report files.
This role allows for several variables to control it’s behaviour:
Variable | Description | Default value |
---|---|---|
|
List of packages to be installed |
|
|
Path where OpenSCAP content is installed on the target system |
|
|
A value used to grab the correct content file for the distribution. Override for this default may exists in distribution specific |
|
|
SCAP Data Stream file, containing profiles, to read |
|
|
Security profile to evaluate with and remediate to |
|
|
Path to a OpenSCAP tailoring file to copy over and use. |
|
|
Clean up generated files after a successful run? |
|
|
Download the generated HTML reports to the Ansible control node? |
|
|
Where to write evaluation HTML report (on target host)? |
|
|
Where to write evaluation XCCDF results file (on target host)? |
|
|
Where to write evaluation ARF results file (on target host)? |
|
|
Should remediation be performed if system is not in a compliant state? |
|
|
Should the Ansible run fail when the system cannot be modified into full compliance? |
|
|
Where to write remediation HTML report (on target host)? |
|
|
Where to write remediation XCCDF results file (on target host)? |
|
|
Where to write remediation ARF results file (on target host)? |
|
|
Path where to download HTML report files? |
|
|
Permissions to set on the 'openscap_report_download_dir' directory |
|
How would you use this role in a Playbook?
First one should decide what security profile to use on the systems.
OpenSCAP - Choosing Policy may be of
help to you. Once a security profile has been decided upon you may want to tailor it to your needs.
For such a purpose a tailoring file may be used. These are XML files containing adjustments to a
existing profile. Often created using the SCAP Workbench
tool. Store such a file in a location on the Ansible Control Node. For example in your playbook
directory, possibly in a files/openscap
directory at that location.
Essentially, in short:
-
Choose a OpenSCAP profile and set it as value for
openscap_profile
-
Optionally: use a tailoring file for adjustment. Set
openscap_tailoring_file
to it’s path.
An example playbook:
- hosts: servers
become: true
vars:
openscap_profile: 'xccdf_org.ssgproject.content_profile_cis_server_l1'
openscap_tailoring_file: 'files/openscap/content/ssg-cis_server_l1_tailored_for_my_company.xml'
roles:
- stejoo.ansible-role-openscap
BSD 3 Clause
Stefan Joosten <stefan•ɑƬ•atcomputing•ɖɵʈ•nl>