Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
3.16. アトミックスキャン
atomic scan <image>/<container>
イメージおよびコンテナーで Common Vulnerabilities and Exposures (CVE)をスキャンします。デフォルトでは、atomic スキャン は openscap スキャナーを使用してイメージをスキャンしますが、プラグ可能な設計ではカスタムを含む追加のスキャナーの追加がサポートされます。atomic scan を初めて実行すると、openscap スキャナーを提供する rhel7/openscap コンテナーをダウンロードします。openscap のデフォルトのスキャンタイプは、脆弱性をチェックすることです。openscap は、RHEL ベースのイメージおよびコンテナーでのみ機能することに注意してください。
openscap コンテナーを適切に使用するには、atomic install rhel7/openscap を実行してから、そのコンテナーを atomic scan で使用します。詳細は、Atomic Release Notes の 既知の問題 の atomic scan issue を参照してください。
たとえば、rhel7 ベースイメージをスキャンするには、以下を実行します。
# atomic scan rhel7/rhel
コンテナーおよびイメージをすべてスキャンして詳細なレポートを作成するには、以下を実行します。
# atomic scan --all --verbose
結果が正である場合、出力は以下のようになります。
# atomic scan rhel7/rhel docker run -it --rm -v /etc/localtime:/etc/localtime -v /run/atomic/2016-06-21-10-10-28-942890:/scanin -v /var/lib/atomic/openscap/2016-06-21-10-10-28-942890:/scanout:rw,Z -v /etc/oscapd:/etc/oscapd:ro rhel7/openscap oscapd-evaluate scan --no-standard-compliance --targets chroots-in-dir:///scanin --output /scanout rhel7/rhel (sha256:bf203442) The following issues were found: RHSA-2016:1025: pcre security update (Important) Severity: Important RHSA URL: https://rhn.redhat.com/errata/RHSA-2016-1025.html RHSA ID: RHSA-2016:1025-00 Associated CVEs: CVE ID: CVE-2015-2328 CVE URL: https://access.redhat.com/security/cve/CVE-2015-2328 CVE ID: CVE-2015-3217 CVE URL: https://access.redhat.com/security/cve/CVE-2015-3217 CVE ID: CVE-2015-5073 CVE URL: https://access.redhat.com/security/cve/CVE-2015-5073 CVE ID: CVE-2015-8385 CVE URL: https://access.redhat.com/security/cve/CVE-2015-8385 CVE ID: CVE-2015-8386 CVE URL: https://access.redhat.com/security/cve/CVE-2015-8386 CVE ID: CVE-2015-8388 CVE URL: https://access.redhat.com/security/cve/CVE-2015-8388 CVE ID: CVE-2015-8391 CVE URL: https://access.redhat.com/security/cve/CVE-2015-8391 CVE ID: CVE-2016-3191 CVE URL: https://access.redhat.com/security/cve/CVE-2016-3191 Files associated with this scan are in /var/lib/atomic/openscap/2016-06-21-10-10-28-942890.
設定済みのスキャナーの一覧を表示するには、以下を使用します。
# atomic scan --list Scanner: openscap * Image Name: rhel7/openscap Scan type: cve * Description: Performs a CVE scan based on known CVE data Scan type: standards_compliance Description: Performs a standards scan * denotes defaults
この出力では、各スキャナーで利用可能なスキャンタイプを確認することもできます。OpenSCAP には 2 つの定義があり、--scan_type オプションを使用して両方の間でスワッチすることができます。
# atomic scan --scan_type standards_compliance rhel7/rhel docker run -it --rm -v /etc/localtime:/etc/localtime -v /run/atomic/2016-07-12-16-08-03-011887:/scanin -v /var/lib/atomic/openscap/2016-07-12-16-08-03-011887:/scanout:rw,Z -v /etc/oscapd:/etc/oscapd:ro rhel7/openscap oscapd-evaluate scan --targets chroots-in-dir:///scanin --output /scanout --no-cve-scan rhel7 (sha256:5fbb7430) The following issues were found: Ensure Software Patches Installed Severity: Important XCCDF result: notchecked Files associated with this scan are in /var/lib/atomic/openscap/2016-07-12-16-08-03-011887.
新規スキャナーを追加するだけで、そのスキャナーに atomic install を提供し、これがローカルでカスタムのイメージである場合は以下を使用します。
# atomic install localhost:5000/custom_scanner
--scanner オプションを指定して、新しいスキャナーを使用できます。
# atomic scan --scanner custom_scanner rhel7/rhel
デフォルトのスキャナーを変更するには、/etc/atomic.conf の default_scanner 行を編集します。この行を使用して、openscap を明示的にデフォルトとして設定することもできます。これが明示的に設定されていない場合、atomic scan は openscap を使用します。
default_scanner: custom_scanner
atomic スキャン のもう 1 つの機能は、ホストファイルシステムもスキャンできることです。これは、--rootfs オプションを使用してホストにパスを提供するように設定できます。以下に例を示します。
# atomic scan --rootfs /tmp/chroot