8장. RHEL 이미지 빌더 OpenSCAP 통합을 사용하여 사전 강화된 이미지 생성
온프레미스 RHEL 이미지 빌더는 OpenSCAP 통합을 지원합니다. 이러한 통합을 통해 사전 강화된 RHEL 이미지를 생성할 수 있습니다. 블루프린트를 설정하면 다음 작업을 수행할 수 있습니다.
- 사전 정의된 보안 프로필 세트로 사용자 정의
- 패키지 세트 또는 애드온 파일 추가
- 환경에 더 적합한 선택한 플랫폼에 배포할 수 있는 사용자 지정 RHEL 이미지를 빌드합니다.
Red Hat은 현재 배포 지침을 충족할 수 있도록 시스템을 빌드할 때 선택할 수 있는 보안 강화 프로필의 정기적으로 업데이트된 버전을 제공합니다.
8.1. OpenSCAP 블루프린트 사용자 정의
블루프린트 사용자 지정에 대한 OpenSCAP 지원을 통해 특정 보안 프로필에 대한'scap-security-guide 콘텐츠에서 블루프린트를 생성한 다음 블루프린트를 사용하여 미리 강화된 자체 이미지를 빌드할 수 있습니다.
OpenSCAP을 사용하여 사용자 지정 블루프린트를 생성하려면 다음과 같은 상위 수준 단계를 수행해야 합니다.
- 마운트 지점을 수정하고 특정 요구 사항에 따라 파일 시스템 레이아웃을 구성합니다.
- 블루프린트에서 OpenSCAP 프로필을 선택합니다. 이렇게 하면 선택한 프로필에 따라 이미지 빌드 중에 수정을 트리거하도록 이미지가 구성됩니다. 또한 이미지 빌드 중에 OpenSCAP은 사전 부팅 부팅 수정을 적용합니다.
이미지 블루프린트에서 OpenSCAP
블루프린트 사용자 지정을 사용하려면 다음 정보를 제공해야 합니다.
-
datastream 수정 명령의
데이터 스트림
경로입니다.scap-security-guide
패키지의 데이터 스트림 파일은/usr/share/xml/scap/ssg/content/
디렉터리에 있습니다. -
필요한 보안 프로필의
profile_id
입니다.profile_id
필드의 값은 긴 양식과 짧은 양식을 모두 허용합니다. 예를 들어 다음과 같은 양식은 허용됩니다.cis
또는xccdf_org.ssgproject.content_profile_cis
. 자세한 내용은 RHEL 10에서 지원되는 SCAP 보안 가이드 프로필 을 참조하십시오.
다음 예제는 OpenSCAP
수정 단계가 있는 스니펫입니다.
[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"
[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"
명령을 사용하여 제공하는 보안 프로필 목록을 포함하여 scap-security-guide
패키지에서 SCAP
소스 데이터 스트림에 대한 자세한 내용을 확인할 수 있습니다.
oscap info /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
# oscap info /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
편의를 위해 OpenSCAP
툴은 scap-security-guide
데이터 스트림에서 사용 가능한 모든 프로필에 대한 강화 블루프린트를 생성할 수 있습니다.
예를 들어 명령은 다음과 같습니다.
oscap xccdf generate fix --profile=cis --fix-type=blueprint /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
# oscap xccdf generate fix --profile=cis --fix-type=blueprint /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
다음과 유사한 CIS 프로필에 대한 블루프린트를 생성합니다.
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 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"
# 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"]
이미지 강화를 위해 이 정확한 블루프린트 스니펫을 사용하지 마십시오. 이는 전체 프로필을 반영하지 않습니다. Red Hat은 scap-security-guide
패키지의 각 프로필에 대한 보안 요구 사항을 지속적으로 업데이트하고 구체화하므로 시스템에 제공된 데이터 스트림의 최신 버전을 사용하여 초기 템플릿을 항상 다시 생성하는 것이 좋습니다.
이제 블루프린트를 사용자 지정하거나 그대로 사용하여 이미지를 빌드할 수 있습니다.
RHEL 이미지 빌더는 블루프린트 사용자 지정을 기반으로 osbuild
단계에 필요한 구성을 생성합니다. 또한 RHEL 이미지 빌더에서는 이미지에 두 개의 패키지를 추가합니다.
-
OpenSCAP
-scanner
-OpenSCAP
툴. scap-security-guide
- 수정 및 평가 지침이 포함된 패키지입니다.참고이 패키지는 기본적으로 이미지에 설치되므로 수정 단계에서는 datastream에
scap-security-guide
패키지를 사용합니다. 다른 datastream을 사용하려면 필요한 패키지를 블루프린트에 추가하고oscap
구성에서 datastream의 경로를 지정합니다.