Show Table of Contents
6.5. Docker での OpenSCAP の使用
oscap-docker コマンドラインユーティリティーでは、oscap プログラムを使用して docker 形式のコンテナーイメージやコンテナーをローカルのシステムとほぼ同じようにスキャンすることができます。
以下のセクションでは、
oscap-docker のインストールについて説明し、使用方法の基本例を紹介します。サブコマンドに関する情報は、oscap-docker または oscap に --help オプションを指定して使用します。
イメージおよびコンテナーのスキャンを有効にするには、docker パッケージもインストールする必要があります。Docker のインストールに関する説明は、『Getting Started with Containers』の「Getting Docker in Red Hat Enterprise Linux 7」の章を参照してください。
以下のコマンドを実行して
oscap-docker をインストールします。
#yum install openscap-utils
例6.12 oscap-docker の使用
oscap-docker scan_target[-cve] target_identifier [oscap-arguments]
scan_target iはスキャンするイメージまたはコンテナー、target_identifier はターゲットの名前または ID に置き換えてください。
以下のコマンドの 2 番目は、コンテナーイメージをアタッチし、オペレーティングシステムの系統およびバージョンを判断して、指定のシステムに適した CVE ストリームをダウンロードしてから、最終的に脆弱性スキャンを実行します。
#docker imagesREPOSITORY TAG IMAGE ID registry.access.redhat.com/rhel7 latest c453594215e4
#oscap-docker image-cve registry.access.redhat.com/rhel7
以下のコマンドの 2 番目は、実行中のコンテナーの chroot 環境で OpenSCAP スキャンを実行します。結果は、定義したマウントポイントによって、コンテナーイメージのスキャンとは異なる可能性があります。今回の例では、OVAL パッチ定義
com.redhat.rhsa-all.xml を使用しました。
#docker psCONTAINER ID IMAGE COMMAND NAMES 5ef05eef4a01 registry.access.redhat.com/rhel7 "/bin/bash" sleepy_kirch
#oscap-docker container 5ef05eef4a01 oval eval com.redhat.rhsa-all.xml

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.