7.3. OpenSCAP ブループリントのカスタマイズ
OpenSCAP
によるブループリントのカスタマイズのサポートにより、特定のセキュリティープロファイルの scap-security-guide
コンテンツからブループリントを生成し、それを使用して独自の独自のハードニング済みイメージを構築できます。カスタマイズしたハードニング済みイメージを作成するには、マウントポイントを変更し、特定の要件に応じてファイルシステムレイアウトを設定します。OpenSCAP
プロファイルを選択すると、OpenSCAP
ブループリントが、選択されたプロファイルに従ってイメージのビルド中に修復をトリガーするようにイメージを設定します。OpenSCAP
は、イメージのビルド中に初回起動前の修復を適用します。
イメージブループリントで OpenSCAP
ブループリントのカスタマイズを使用するには、次の情報を提供する必要があります。
-
datastream
修復手順へのデータストリームパス。scap-security-guide
パッケージのデータストリームファイルは、/usr/share/xml/scap/ssg/content/
ディレクトリーにあります。1 必要なセキュリティープロファイルの
profile_id
。profile_id
フィールドの値は、長い形式と短い形式の両方を受け入れます。たとえば、cis
やxccdf_org.ssgproject.content_profile_cis
を受け入れることができます。詳細は、RHEL 9 でサポートされている 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-rhel9-ds.xml" profile_id = "xccdf_org.ssgproject.content_profile_cis"
次のコマンドを使用すると、
scap-security-guide
パッケージのSCAP
ソースデータストリームの詳細 (データストリームによって提供されるセキュリティープロファイルのリストを含む) を確認できます。# oscap info /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
ユーザーの便宜のために、OpenSCAP
ツールでは、scap-security-guide
データストリームで利用可能な任意のプロファイルのハードニングブループリントを生成できます。
たとえば、次のコマンドを実行します。
# oscap xccdf generate fix --profile=cis --fix-type=blueprint /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
これにより、CIS プロファイルのブループリントが生成されます。
# Blueprint for CIS Red Hat Enterprise Linux 9 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 9 Benchmark™, v3.0.0, released 2023-10-30. # This profile includes Center for Internet Security® # Red Hat Enterprise Linux 9 CIS Benchmarks™ content. # # Profile ID: xccdf_org.ssgproject.content_profile_cis # Benchmark ID: xccdf_org.ssgproject.content_benchmark_RHEL-9 # Benchmark Version: 0.1.74 # XCCDF Version: 1.2 name = "hardened_xccdf_org.ssgproject.content_profile_cis" description = "CIS Red Hat Enterprise Linux 9 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 Image Builder は、ブループリントのカスタマイズに基づいて、osbuild
ステージに必要な設定を生成します。さらに、RHEL Image Builder は 2 つのパッケージをイメージに追加します。
-
openscap-scanner
-OpenSCAP
ツール。 scap-security-guide
- 修復および評価の手順が含まれるパッケージ。注記このパッケージはデフォルトでイメージにインストールされるため、修復ステージではデータストリームに
scap-security-guide
パッケージを使用します。別のデータストリームを使用する場合は、必要なパッケージをブループリントに追加し、oscap
設定でデータストリームへのパスを指定します。