LoginSignup
1
0

More than 1 year has passed since last update.

OpenScapを使用してCIS benchmarkでAlma linuxをハードニングするまで

Last updated at Posted at 2022-11-14

前提

手順

  • openscapをインストールする。
yum install openscap openscap-utils openscap-scanner scap-security-guide
  • 利用可能なプロファイルを確認する。
    今回はCIS benchmarkのワークステーションL2を使います。
oscap info /usr/share/xml/scap/ssg/content/ssg-almalinux9-ds.xml
  • 実行したいプロファイルIDを指定し、スキャンを実行する。
    --reportオプションで出力先を指定します。出力先フォルダを事前に作成しておく必要があります。
oscap xccdf eval  --profile xccdf_org.ssgproject.content_profile_cis_workstation_l2 --results /tmp/ssg-results.xml   --report ~/oscap/report/ssg-results.html     /usr/share/xml/scap/ssg/content/ssg-almalinux9-ds.xml
  • レポートを確認する。 ※Lynxを使用。
    スクロールしていくと項目の詳細を確認できます。
    修正の仕方も確認可能です。
lynx ./oscap/report/ssg-results.html

17.png
※CIS benchmarkで要求されているパーティショニングを事前に行っているため、ここではその指摘は出力されていません。
Alma linuxのセットアップ時に、構成を以下のようにしておきます。
各パーティションのサイズは、用途に応じて調整してください。
6.png

  • スキャンと修正を行う。
    --remediateをつけるとある程度自動修正してくれます。
oscap xccdf eval  --profile xccdf_org.ssgproject.content_profile_cis_workstation_l2  --remediate /usr/share/xml/scap/ssg/content/ssg-almalinux9-ds.xml

↓こんな感じでfixedしてくれます。
10.png
※アクセス権やパーミッション設定、パーティションの作成を要するものなどは、自動で修復してくれない場合があります。これらは、手動で修正する必要があります。

  • 残った項目を手動で修正する。
    私の環境では、以下ファイルのパーミッションがread onlyであったため自動でfixされませんでした。なので、これらは手動で修正を行いました。
    18.png

  • 以上。 ※私は全部PASSするように設定しましたが、全部対応する必要はありません。目的に応じてどこまで対応するか検討するとよいでしょう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0