8.11. Scanning and Remediating Configuration Compliance of Container Images and Containers Using atomic scan
8.11.1. Scanning for Configuration Compliance of Container Images and Containers Using atomic scan Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Use this type of scanning to evaluate Red Hat Enterprise Linux-based container images and containers with the SCAP content provided by the SCAP Security Guide (SSG) bundled inside the OpenSCAP container image. This enables scanning against any profile provided by the SCAP Security Guide.
Warning
The
atomic scan
functionality is deprecated, and the OpenSCAP container image is no longer updated with the new security compliance content. Therefore, prefer the oscap-docker
utility for security compliance scanning purposes.
Note
For a detailed description of the usage of the
atomic
command and containers, see the Product Documentation for Red Hat Enterprise Linux Atomic Host 7. The Red Hat Customer Portal also provides a guide to the atomic
command-line interface (CLI).
Prerequisites
- You have downloaded and installed the OpenSCAP container image from Red Hat Container Catalog (RHCC) using the
atomic install rhel7/openscap
command.
Procedure
- List SCAP content provided by the OpenSCAP image for the configuration_compliance scan:
atomic help registry.access.redhat.com/rhel7/openscap
~]# atomic help registry.access.redhat.com/rhel7/openscap
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify compliance of the latest Red Hat Enterprise Linux 7 container image with the Defense Information Systems Agency Security Technical Implementation Guide (DISA STIG) policy and generate an HTML report from the scan:atomic scan --scan_type configuration_compliance --scanner_args xccdf-id=scap_org.open-scap_cref_ssg-rhel7-xccdf-1.2.xml,profile=xccdf_org.ssgproject.content_profile_stig-rhel7-disa,report registry.access.redhat.com/rhel7:latest
~]# atomic scan --scan_type configuration_compliance --scanner_args xccdf-id=scap_org.open-scap_cref_ssg-rhel7-xccdf-1.2.xml,profile=xccdf_org.ssgproject.content_profile_stig-rhel7-disa,report registry.access.redhat.com/rhel7:latest
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output of the previous command contains the information about files associated with the scan at the end:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Theatomic scan
generates a subdirectory with all the results and reports from a scan in the /var/lib/atomic/openscap/ directory. The arf.xml file with results is generated on every scanning for configuration compliance. To generate a human-readable HTML report file, add thereport
suboption to the--scanner_args
option. - Optional: To generate XCCDF results readable by DISA STIG Viewer, add the
stig-viewer
suboption to the--scanner_args
option. The results are placed in stig.xml.
Note
When the
xccdf-id
suboption of the --scanner_args
option is omitted, the scanner searches for a profile in the first XCCDF component of the selected data stream file. For more details about data stream files, see Section 8.3.1, “Configuration Compliance in RHEL 7”.
8.11.2. Remediating Configuration Compliance of Container Images and Containers Using atomic scan Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
You can run the configuration compliance scan against the original container image to check its compliance with the DISA STIG policy. Based on the scan results, a fix script containing bash remediations for the failed scan results is generated. The fix script is then applied to the original container image - this is called a remediation. The remediation results in a container image with an altered configuration, which is added as a new layer on top of the original container image.
Important
Note that the original container image remains unchanged and only a new layer is created on top of it. The remediation process builds a new container image that contains all the configuration improvements. The content of this layer is defined by the security policy of scanning - in the previous case, the DISA STIG policy. This also means that the remediated container image is no longer signed by Red Hat, which is expected, because it differs from the original container image by containing the remediated layer.
Warning
The
atomic scan
functionality is deprecated, and the OpenSCAP container image is no longer updated with the new security compliance content. Therefore, prefer the oscap-docker
utility for security compliance scanning purposes.
Prerequisites
- You have downloaded and installed the OpenSCAP container image from Red Hat Container Catalog (RHCC) using the
atomic install rhel7/openscap
command.
Procedure
- List SCAP content provided by the OpenSCAP image for the configuration_compliance scan:
atomic help registry.access.redhat.com/rhel7/openscap
~]# atomic help registry.access.redhat.com/rhel7/openscap
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To remediate container images to the specified policy, add the
--remediate
option to theatomic scan
command when scanning for configuration compliance. The following command builds a new remediated container image compliant with the DISA STIG policy from the Red Hat Enterprise Linux 7 container image:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional: The output of the
atomic scan
command reports a remediated image ID. To make the image easier to remember, tag it with some name, for example:docker tag 9bbc7083760e rhel7_disa_stig
~]# docker tag 9bbc7083760e rhel7_disa_stig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow