This course is using an outdated version of the technology and is now considered to be Legacy content. It will be removed from our catalog on June 28, 2024. Please be sure to complete your course and finish any remaining labs before that date. We recommend moving to version 9.2, which is the latest version currently available.
This Guided Exercise requires that the previous exercise has been successfully completed. In this exercise, you will use Red Hat Satellite to perform an OpenSCAP scan of one of your servers and evaluate the results.
Outcomes
You should be able to:
Create a Red Hat Satellite compliance policy for centralized OpenSCAP scans.
Manually trigger a compliance policy scan on a Red Hat Satellite client.
Evaluate the compliance report for that scan in the Red Hat Satellite web UI.
Confirm that the workstation, satellite, and serverd machines are started.
Log in to workstation as student using student as the password.
From workstation, run lab compliance-scan setup to verify that the environment is ready.
[student@workstation ~]$lab compliance-scan setup
On workstation, open a browser and connect to the Satellite Server web UI at https://satellite.lab.example.com.
If required, accept the self-signed certificate and log in as admin using redhat as the password.
Create a compliance policy named OpenSCAP-Policy1 using the default RHEL7 SCAP content.
The policy should execute every 10 minutes.
Navigate to → and click .
In the New Compliance Policy dialog box, enter OpenSCAP-Policy1 as the name of the policy.
The policy description is optional.
Click .
On the SCAP Content tab, select from the SCAP Content drop-down list. For XCCDF Profile, select . Click .
On the Schedule tab, for Period, select .
Enter */10 * * * * in the Cron line field to run the scan every 10 minutes.
Click .
On the Locations tab, select to move it to the Selected items list. Click .
On the Organizations tab, ensure that is the selected organization. Click .
On the Hostgroups tab, select to move it to the Selected items list. Click to create the compliance policy.
Rerun the Puppet module on serverd to fetch the new compliance policy.
Review the configuration of the compliance policy in the /etc/foreman_scap_client/config.yaml file.
Log in to serverd as student.
No password is required.
Use the sudo -i command to change to the root user.
Use student as the password.
[student@workstation ~]$ssh student@serverd[student@serverd ~]$sudo -i[sudo] password for student:student[root@serverd ~]#
Run the following command on serverd to fetch the new compliance policy.
The command executes the Puppet module on serverd, and configures the host to run foreman_scap_client using the new compliance policy.
[root@serverd ~]#puppet agent --test --verboseInfo: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Info: Caching catalog for serverd.lab.example.com Info: Applying configuration version '1532692309' Notice: /Stage[main]/Foreman_scap_client/File[foreman_scap_client]/content: --- /etc/foreman_scap_client/config.yaml 2018-07-27 17:18:11.279676375 +0530 +++ /tmp/puppet-file20180727-2630-gep1op 2018-07-27 17:21:50.652457820 +0530 @@ -21,3 +21,12 @@ # policy (key is id as in Foreman) +1: + :profile: 'xccdf_org.ssgproject.content_profile_common' + :content_path: '/var/lib/openscap/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d.xml' + # Download path + # A path to download SCAP content from proxy + :download_path: '/compliance/policies/1/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d' + :tailoring_path: '' + :tailoring_download_path: '' + Info: Computing checksum on file /etc/foreman_scap_client/config.yaml ...output omitted... # foreman_scap_client cron job +# Runs foreman_scap_client 1 +*/10 * * * * root /usr/bin/foreman_scap_client 1 > /dev/null + Info: Computing checksum on file /etc/cron.d/foreman_scap_client_cron ...output omitted... Notice: Applied catalog in 0.30 seconds
View the /etc/foreman_scap_client/config.yaml file to confirm that the Satellite Server compliance policy ID and OpenSCAP XCCDF profile defined in the file.
[root@serverd ~]#cat /etc/foreman_scap_client/config.yaml# DO NOT EDIT THIS FILE MANUALLY # IT IS MANAGED BY PUPPET ...output omitted... # policy (key is id as in Foreman)1::profile: 'xccdf_org.ssgproject.content_profile_common':content_path: '/var/lib/openscap/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d.xml' # Download path # A path to download SCAP content from proxy :download_path: '/compliance/policies/1/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d' :tailoring_path: '' :tailoring_download_path: ''
In the preceding output the compliance policy ID is 1.
The policy will use the xccdf_org.ssgproject.content_profile_common OpenSCAP profile.
Execute an OpenSCAP scan manually using the foreman_scap_client command installed by the Puppet module. (This command is also executed automatically by Cron according to the schedule specified when you created the compliance policy.)
Execute the foreman_scap_client command manually to run the OpenSCAP scan and upload the results to the Red Hat Satellite OpenSCAP capsule.
Use the compliance policy ID specified in the /etc/foreman_scap_client/config.yaml file as an argument to the command.
[root@serverd ~]#foreman_scap_client 1File /var/lib/openscap/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d.xml is missing. Downloading it from proxy. Download SCAP content xml from: https://satellite.lab.example.com:9090/compliance/policies/1/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986dDEBUG: running: oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_common --results-arf /tmp/d20180727-2719-ois40f/results.xml /var/lib/openscap/content/96c2a9d5278d5da905221bbb2dc61d0ace7ee3d97f021fccac994d26296d986d.xmlWARNING: This content points out to the remote resources. Use `--fetch-remote-resources' option to download them. WARNING: Skipping https://learn.spidernet.pl/security/data/oval/com.redhat.rhsa-RHEL7.xml.bz2 file which is referenced from XCCDF content DEBUG: running: /usr/bin/bzip2 /tmp/d20180727-2719-ois40f/results.xmlUploading results to https://satellite.lab.example.com:9090/compliance/arf/1
Log off from serverd.
[root@serverd ~]#logout[student@serverd ~]$logoutConnection to serverd closed.[student@workstation ~]$
Evaluate the compliance report in your Satellite Server web UI in order to determine which checks passed and which failed.
Navigate to → to list the compliance reports uploaded by serverd.
The page lists the number of passes, failures, and some in other categories for all the audited systems.
If there is more than one report, there will be more than one link under Reported At. To open the latest report, click the link under the Reported At column to view the details for the latest scan result.
Click to evaluate the full report.