Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 8. Creating pre-hardened images with RHEL image builder OpenSCAP integration
RHEL image builder on-premise supports the OpenSCAP integration. This integration enables the production of pre-hardened RHEL images.
By setting up a blueprint, you can perform the following actions:
- Customize it with a set of predefined security profiles
- Add a set of packages or add-on files
- Build a customized RHEL image ready to deploy on your chosen platform that is more suitable for your environment
Red Hat provides regularly updated versions of the security hardening profiles that you can choose when you build your systems so that you can meet your current deployment guidelines.
8.1. The OpenSCAP blueprint customization Link kopierenLink in die Zwischenablage kopiert!
By using the OpenSCAP blueprint customization, you can generate blueprints from the scap-security-guide for specific security profiles and build pre-hardened images.
Creating a customized blueprint with OpenSCAP involves the following high-level steps:
- Modify the mount points and configure the file system layout according to your specific requirements.
-
In the blueprint, select the OpenSCAP profile. This configures the image to trigger the remediation during the image build in accordance with the selected profile. Also, during the image build, OpenSCAP applies a
pre-first-bootremediation.
To use the OpenSCAP blueprint customization in your image blueprints, you need to provide the following information:
-
The data stream path to the
datastreamremediation instructions. The data stream files fromscap-security-guidepackage are located in the/usr/share/xml/scap/ssg/content/directory. -
The
profile_idof the required security profile. Theprofile_idfield accepts both long and short forms, such ascisorxccdf_org.ssgproject.content_profile_cis. See SCAP Security Guide profiles supported in RHEL 10 for more details.
The following example is a snippet with the OpenSCAP remediation stage:
[customizations.openscap]
# If you want to use the data stream from the 'scap-security-guide' package
# the 'datastream' key could be omitted.
# datastream = "/usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml"
profile_id = "xccdf_org.ssgproject.content_profile_cis"
You can find more details about the SCAP source data stream from the scap-security-guide package, including the list of security profiles it provides, by using the command:
# oscap info /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
For your convenience, the OpenSCAP tool can generate the hardening blueprint for any profile available in scap-security-guide data streams.
For example, the command:
# oscap xccdf generate fix --profile=cis --fix-type=blueprint /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
generates a blueprint for CIS profile similar to the following example:
# Blueprint for CIS Red Hat Enterprise Linux 10.0 Benchmark for Level 2 - Server
# Profile Description:
# This profile defines a baseline that aligns to the "Level 2 - Server"
# configuration from the Center for Internet Security® Red Hat Enterprise
# Linux 10 Benchmark™, v3.0.0, released 2023-10-30.
# This profile includes Center for Internet Security®
# Red Hat Enterprise Linux 10.0 CIS Benchmarks™ content.
#
# Profile ID: xccdf_org.ssgproject.content_profile_cis
# Benchmark ID: xccdf_org.ssgproject.content_benchmark_RHEL-10.0
# Benchmark Version: 0.1.74
# XCCDF Version: 1.2
name = "hardened_xccdf_org.ssgproject.content_profile_cis"
description = "CIS Red Hat Enterprise Linux 10.0 Benchmark for Level 2 - Server"
version = "0.1.74"
[customizations.openscap]
profile_id = "xccdf_org.ssgproject.content_profile_cis"
# If your hardening data stream is not part of the 'scap-security-guide' package
# provide the absolute path to it (from the root of the image filesystem).
# datastream = "/usr/share/xml/scap/ssg/content/ssg-xxxxx-ds.xml"
[[customizations.filesystem]]
mountpoint = "/home"
size = 1073741824
[[customizations.filesystem]]
mountpoint = "/tmp"
size = 1073741824
[[customizations.filesystem]]
mountpoint = "/var"
size = 3221225472
[[customizations.filesystem]]
mountpoint = "/var/tmp"
size = 1073741824
[[packages]]
name = "aide"
version = "*"
[[packages]]
name = "libselinux"
version = "*"
[[packages]]
name = "audit"
version = "*"
[customizations.kernel]
append = "audit_backlog_limit=8192 audit=1"
[customizations.services]
enabled = ["auditd","crond","firewalld","systemd-journald","rsyslog"]
disabled = []
masked = ["nfs-server","rpcbind","autofs","bluetooth","nftables"]
Do not use this exact blueprint snippet for image hardening. It does not reflect a complete profile. As Red Hat constantly updates and refines security requirements for each profile in the scap-security-guide package, it makes sense to always re-generate the initial template by using the most up-to-date version of the data stream provided for your system.
Now you can customize the blueprint or use it as it is to build an image.
By using RHEL image builder, you can generate the necessary configurations for the stage based on your blueprint customization. This action adds two packages to the image:
-
openscap-scanneris theOpenSCAPtool. scap-security-guideis the package that contains the remediation and evaluation instructions.The remediation stage uses the
scap-security-guidepackage for the datastream because this package is installed on the image by default. If you want to use a different datastream, add the necessary package to the blueprint and specify the path to the datastream in theoscapconfiguration.
8.2. Creating a pre-hardened image with RHEL image builder Link kopierenLink in die Zwischenablage kopiert!
Use RHEL image builder on-premise to create pre-hardened RHEL images with support to the OpenSCAP integration.
By setting up a blueprint, you can perform the following actions:
- Create images that are pre-hardened and compliant with a specific profile
- Deploy the pre-hardened images in a Virtual Machine (VM), or a bare-metal environment, for example.
Prerequisites
-
You are logged in as the root user or a user who is a member of the
weldrgroup. -
The
openscapandscap-security-guidepackages are installed.
Procedure
Create a hardening blueprint in the Tom’s Obvious Minimal Language (TOML) format, using the
OpenSCAPtool andscap-security-guidecontent, and modify it if necessary:# oscap xccdf generate fix --profile=<profileID> --fix-type=<blueprint> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml > cis.tomlReplace
<profileID>with the profile ID that the system should comply with, for example,cis.Start the build of hardened image:
# image-builder build <image_type> --blueprint <blueprint_name>Replace
<image_type>with any image type, for example,qcow2.After the image build is ready, you can use your pre-hardened image on your deployments. See Creating a virtual machine from a Kernel-based Virtual Machine (KVM) guest image.
Verification
After you deploy your pre-hardened image, you can perform a configuration compliance scan to verify that the image is aligned with the selected security profile.
Performing a configuration compliance scanning does not guarantee the system is compliant. For more information, see Configuration compliance scanning.
8.3. Customizing a pre-hardened image with RHEL image builder Link kopierenLink in die Zwischenablage kopiert!
You can customize a security profile by changing rule, such as password length, removing or selecting rules to implement internal policies. You cannot define new rules by customizing a profile.
Building an image from the blueprint creates a tailoring file and saves it to /usr/share/xml/oscap-tailoring/tailoring.xml with a new tailoring profile ID. The new profile ID have tailoring appended as a suffix to the base profile. For example, if you use the Center for Internet Security (CIS) (cis) base profile, the profile ID is xccdf_org.ssgproject.content_profile_cis_tailoring.
Prerequisites
-
You are logged in as the root user or a user who is a member of the
weldrgroup. -
The
openscapandscap-security-guidepackages are installed.
Procedure
Create a hardening blueprint in the TOML format from a selected profile. For example:
# oscap xccdf generate fix --profile=<profileID> --fix-type=blueprint /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml > <profileID>tailored.tomlAppend the tailoring section with the customized rule set to the blueprint. The tailoring customization only affects the default selected or unselected state of rules in the base profile without changing the state of other rules.
# Blueprint for CIS Red Hat Enterprise Linux 10.0 Benchmark for Level 2 - Server # ... [customizations.openscap.tailoring] selected = [ "xccdf_org.ssgproject.content_bind_crypto_policy" ] unselected = [ "grub2_password" ]Start the build of a hardened image:
# *image-builder build <image_type> --blueprint <blueprintProfileID> *Replace
<image_type>with any image type, for example,qcow2.After the image build is ready, use your pre-hardened image on your deployments.
Verification
After you deploy your pre-hardened image, you can perform a configuration compliance scan to verify that the image is aligned with the selected security profile.
Performing a configuration compliance scanning does not guarantee the system is compliant. For more information, see Configuration compliance scanning.