5.3. Configuration compliance remediation
To automatically align your system with a specific profile, you can perform a remediation. You can remediate the system to align with any profile provided by the SCAP Security Guide.
5.3.1. Remediating the system to align with a specific baseline 링크 복사링크가 클립보드에 복사되었습니다!
You can remediate the RHEL system to align with a specific baseline. You can remediate the system to align with any profile provided by the SCAP Security Guide.
For details on listing available profiles, see the Viewing profiles for configuration compliance section.
Remediations are supported on RHEL systems in the default configuration. Remediating a system that has been altered after installation might render the system nonfunctional or noncompliant with the required security profile. Red Hat does not provide any automated method to revert changes made by security-hardening remediations.
Test the effects of the remediation before applying it on production systems.
Prerequisites
-
The
openscap-scannerandscap-security-guidepackages are installed.
Procedure
Remediate the system:
# oscap xccdf eval --profile <profile_ID> --remediate /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xmlReplace
<profile_ID>with the profile ID with which the system should comply, for example,hipaa.- Restart your system.
Verification
Evaluate compliance of the system with the profile, and save the scan results to a file:
$ oscap xccdf eval --report <scan_report.html> --profile <profile_ID> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xmlReplace:
-
<scan_report.html>with the file name whereoscapsaves the scan results. -
<profile_ID>with the profile ID with which the system should comply, for example,hipaa.
-
You can remediate your system to align with a specific baseline by using an Ansible Playbook file from the SCAP Security Guide project. You can remediate to align with any profile provided by the SCAP Security Guide.
Remediations are supported on RHEL systems in the default configuration. Remediating a system that has been altered after installation might render the system nonfunctional or noncompliant with the required security profile. Red Hat does not provide any automated method to revert changes made by security-hardening remediations.
Test the effects of the remediation before applying it on production systems.
Prerequisites
-
The
scap-security-guidepackage is installed. -
The
ansible-corepackage is installed. See the Ansible Installation Guide for more information. -
The
rhc-worker-playbookpackage is installed. - You know the ID of the profile according to which you want to remediate your system. For details, see Viewing profiles for configuration compliance.
Procedure
Remediate your system to align with a selected profile by using Ansible:
# ANSIBLE_COLLECTIONS_PATH=/usr/share/rhc-worker-playbook/ansible/collections/ansible_collections/ ansible-playbook -i "localhost," -c local /usr/share/scap-security-guide/ansible/rhel10-playbook-<profile_ID>.ymlThe
ANSIBLE_COLLECTIONS_PATHenvironment variable is necessary for the command to run the playbook.Replace
<profile_ID>with the profile ID of the selected profile.- Restart the system.
Verification
Evaluate the compliance of the system with the selected profile, and save the scan results to a file:
# oscap xccdf eval --profile <profile_ID> --report <scan_report.html> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xmlReplace
<scan_report.html>with the file name whereoscapsaves the scan results.
5.3.3. Creating a remediation Ansible Playbook to align the system with a specific baseline 링크 복사링크가 클립보드에 복사되었습니다!
You can create an Ansible Playbook that contains only the remediations that are required to align your system with a specific baseline. This playbook is smaller because it does not cover already satisfied requirements. Creating the playbook does not modify your system in any way, because you only prepare a file for later application.
Prerequisites
-
The
scap-security-guidepackage is installed. -
The
ansible-corepackage is installed. See the Ansible Installation Guide for more information. -
The
rhc-worker-playbookpackage is installed. - You know the ID of the profile according to which you want to remediate your system. For details, see Viewing profiles for configuration compliance.
Procedure
Scan the system and save the results:
# oscap xccdf eval --profile <profile_ID> --results <profile_results.xml> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xmlReplace: *
<profile_ID>with the profile ID with which the system should comply, for example,hipaa*<profile_results.xml>with the path to the file whereoscapsaves the resultsFind the value of the result ID in the file with the results:
# oscap info <profile_results.xml>Generate an Ansible Playbook based on the file generated in step 1:
# oscap xccdf generate fix --fix-type ansible --result-id xccdf_org.open-scap_testresult_xccdf_org.ssgproject.content_profile_<profile_ID> --output <profile_remediations.yml> <profile_results.xml>Replace
<profile_remediations.yml>with the path to the file whereoscapsaves rules that failed the scan.-
Review the generated
<profile_remediations.yml>file. Remediate your system to align with a selected profile by using Ansible:
# ANSIBLE_COLLECTIONS_PATH=/usr/share/rhc-worker-playbook/ansible/collections/ansible_collections/ ansible-playbook -i "localhost," -c local <profile_remediations.yml>`The
ANSIBLE_COLLECTIONS_PATHenvironment variable is necessary for the command to run the playbook.주의Remediations are supported on RHEL systems in the default configuration. Remediating a system that has been altered after installation might render the system nonfunctional or noncompliant with the required security profile. Red Hat does not provide any automated method to revert changes made by security-hardening remediations.
Test the effects of the remediation before applying it on production systems.
Verification
Evaluate the compliance of the system with the selected profile, and save the scan results to a file:
# oscap xccdf eval --profile <profile_ID> --report <scan_report.html> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xmlReplace
<scan_report.html>with the file name whereoscapsaves the scan results.