Bookmark this page

Lab: Automating Compliance with Red Hat Satellite

Performance Checklist

In this lab, you will use Red Hat Satellite to scan all of your servers for compliance with a customized OpenSCAP policy, evaluate the results, and remediate at least one reported issue.

Outcomes

You should be able to:

  • Create a Red Hat Satellite compliance policy customized with a tailoring file.

  • Initiate an OpenSCAP scan on one or more hosts from Red Hat Satellite using a compliance policy.

  • Evaluate the results of a compliance policy's OpenSCAP scans in Red Hat Satellite's web UI.

  • Remediate failed compliance checks using the command provided by the OpenSCAP evaluation report.

Confirm that the workstation, satellite, servera, serverb, serverc, serverd, and servere machines are started.

Log in to workstation as student using student as the password. On workstation, run lab compliance-review setup to verify that the environment is ready. The script re-registers all hosts to the Satellite Server to enabling remote execution as the root user.

[student@workstation ~]$ lab compliance-review setup
  1. From workstation, connect to the Satellite web UI at https://satellite.lab.example.com. If prompted, accept the self-signed certificate and log in as admin using redhat as the password.

  2. Upload a new tailoring file named ComplianceLab-TailoringFile to customize the default Standard System Security profile for RHEL 7 SCAP content. Download the tailoring file from http://materials.example.com/labs/compliancelab-tailoring.xml to workstation.

    1. On workstation open a command terminal. Use the wget command to download the tailoring file from http://materials.example.com/labs/compliancelab-tailoring.xml to the /home/student/Downloads directory.

      [student@workstation ~]$ wget \
      > http://materials.example.com/labs/compliancelab-tailoring.xml \
      > -P ~/Downloads
      ...output omitted...
    2. In the Satellite web UI, navigate to HostsTailoring Files. Click New Tailoring File to upload a new tailoring file.

    3. On the Upload new Tailoring File page, enter ComplianceLab-TailoringFile in the Name field. Click Browse to upload the /home/student/Downloads/compliancelab-tailoring.xml tailoring file. Click Submit.

  3. Create a compliance policy named ComplianceLab-Policy1 using the default RHEL 7 SCAP content. Choose the Standard System Security XCCDF profile and the ComplianceLab-TailoringFile tailoring file. The policy should execute weekly on Sunday. Use the following table to specify the other fields while creating the compliance policy:

    Table 10.4. Compliance Policy Parameters

    FieldValue
    LocationsDefault Location
    Organizationsorg-example
    Hostgroupsorg-hostgroup1

    1. Navigate to HostsPolicies.

      Click New Policy.

    2. On the New Compliance Policy page, enter ComplianceLab-Policy1 as the name of the policy. The policy description is optional. Click Next.

    3. On the SCAP Content tab, select Red Hat rhel7 default content from the SCAP Content list. For XCCDF Profile, select Standard System Security Profile. For Tailoring File, select ComplianceLab-TailoringFile. The XCCDF Profile in Tailoring File list automatically sets the Standard System Security Profile [CUSTOMIZED] XCCDF profile, because there is only one profile included in the tailoring file. Click Next.

    4. On the Schedule tab, for Period, choose Weekly. For Weekday, select Sunday. Click Next.

    5. On the Locations tab, click Default Location to move it to the Selected items list. Click Next.

    6. On the Organizations tab, click org-example to move it to the Selected items list. Click Next.

    7. On the Hostgroups tab, click org-hostgroup1 to move it to the Selected items list. Click Submit to create the compliance policy.

  4. Manually run the Puppet agent on the following hosts to update the clients with the new compliance policy. You may use the remote execution feature of Red Hat Satellite to do this.

    • servera.lab.example.com

    • serverb.lab.example.com

    • serverc.lab.example.com

    • serverd.lab.example.com

    • servere.lab.example.com

    1. From the Satellite's web UI, use the remote execution feature to run the Puppet agent. Navigate to HostsAll hosts. Select the following hosts in the Hosts page.

      • servera.lab.example.com

      • serverb.lab.example.com

      • serverc.lab.example.com

      • serverd.lab.example.com

      • servere.lab.example.com

    2. Select Schedule Remote Job from the Select Action list.

    3. On the Job invocation page, for Job Category, select Puppet. Ensure that Execute now is selected for Schedule. Click Submit.

    4. On the Overview tab, wait until you see succeeded with the 100% Success message.

  5. Initiate OpenSCAP scans of the following hosts from your Satellite Server's web UI:

    • servera.lab.example.com

    • serverb.lab.example.com

    • serverc.lab.example.com

    • serverd.lab.example.com

    • servere.lab.example.com

    1. Navigate to HostsAll hosts. Select the following hosts:

      • servera.lab.example.com

      • serverb.lab.example.com

      • serverc.lab.example.com

      • serverd.lab.example.com

      • servere.lab.example.com

    2. Select Schedule Remote Job from the Select Action list.

    3. On the Job invocation page, for Job Category, select OpenSCAP. Ensure that Execute now is selected for Schedule. Click Submit.

    4. On the Overview tab, wait until you see succeeded with the 100% Success message.

  6. Evaluate the OpenSCAP reports in your Satellite Server's web UI to determine which checks passed and which failed on each host.

    1. Navigate to HostsReports.

    2. To open the latest report, click the link under the Reported At column to view the details for the latest scan result on serverd.

    3. Click View full report to evaluate the detailed full report.

  7. Remediate the Prevent Log In to Accounts With Empty Password compliance issue detected in the previous step on serverd using the commands provided by an OpenSCAP evaluation report. Execute the commands on serverd using the remote execution feature of the Satellite Server.

    1. On the OpenSCAP Evalution Report page of serverd, glance through the report to see what rules passed or failed. Evaluate the severity of the security rules.

    2. Search for Prevent Log In to Accounts With Empty Password in the OpenSCAP evaluation report. Notice that the Prevent Log In to Accounts With Empty Password security rule fails with severity high.

    3. Click the Prevent Log In to Accounts With Empty Password link. The Remediation Shell script section provides the remediation commands to fix the compliance issue. Click show.

      Copy both commands.

      sed --follow-symlinks -i 's/\<nullok\>//g' /etc/pam.d/system-auth
      sed --follow-symlinks -i 's/\<nullok\>//g' /etc/pam.d/password-auth
    4. In the Satellite web UI, navigate to HostsAll hosts. Select serverd.lab.example.com. Clear any other hosts that are selected.

    5. Choose Schedule Remote Job from the Select Action list.

    6. On the Job invocation page, for Job Category, select Commands. Paste the remediation commands from the previous step in the command field. Ensure that Execute now is selected for Schedule. Click Submit.

    7. On the Overview tab, wait until you see succeeded with the 100% Success message.

  8. Scan all the hosts again for compliance and evaluate the OpenSCAP scan results. Verify that the Prevent Log In to Accounts With Empty Password compliance issue is resolved on serverd.

    1. Navigate to HostsAll hosts. Select the following hosts:

      • servera.lab.example.com

      • serverb.lab.example.com

      • serverc.lab.example.com

      • serverd.lab.example.com

      • servere.lab.example.com

    2. Select Schedule Remote Job from the Select Action list.

    3. On the Job invocation page, for Job Category, select OpenSCAP. Ensure that Execute now is selected for Schedule. Click Submit.

    4. On the Overview tab, wait until you see succeeded with the 100% Success message.

    5. Navigate to HostsReports to list the OpenSCAP scan reports uploaded by all the hosts.

      Notice that the OpenSCAP scan on serverd must now show 10 passes and 0 failed result. The other hosts must show 9 passes and 1 failed result.

    6. Click the link under the Report At column to view the details for the latest scan result on serverd.

    7. Click View full report to view the OpenSCAP Evalution Report page. Verify that the Prevent Log In to Accounts With Empty Password compliance report is resolved on serverd.

    8. Log off from the Satellite web UI.

Evaluation

As the student user on workstation, run the lab compliance-review script with the grade argument to confirm success of this exercise. Correct any reported failures and rerun the script until successful.

[student@workstation ~]$ lab compliance-review grade

Cleanup

On workstation, run the lab compliance-review cleanup command to clean up this exercise.

[student@workstation ~]$ lab compliance-review cleanup

This concludes the lab.

Revision: rh415-7.5-b847083