Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

8.4. oscapの使用

oscap コマンドラインユーティリティーを使用すると、ユーザーはローカルシステムのスキャン、セキュリティーコンプライアンスコンテンツの確認、ならびにスキャンおよび評価を基にしたレポートとガイドの生成が可能です。このユーティリティーは、OpenSCAP ライブラリーのフロントエンドとして機能し、その機能を処理する SCAP コンテンツのタイプに基づいてモジュール(サブコマンド)にグループ化します。
以下のセクションでは、oscap のインストール、最も一般的な操作を実行し、これらのタスクの関連する例を表示する方法を説明します。特定のサブコマンドの詳細は、oscap コマンドで --help オプションを使用します。
oscap [options] module module_operation [module_operation_options_and_arguments] --help
module は処理される SCAP コンテンツのタイプを表し、module_operation は SCAP コンテンツ上の特定の操作のサブコマンドになります。

例8.4 特定の oscap 操作に関するヘルプの取得

~]$ oscap ds sds-split --help
oscap -> ds -> sds-split

Split given SourceDataStream into separate files

Usage: oscap [options] ds sds-split [options] SDS TARGET_DIRECTORY

SDS - Source data stream that will be split into multiple files.
TARGET_DIRECTORY - Directory of the resulting files.

Options:
   --datastream-id <id>          - ID of the datastream in the collection to use.
   --xccdf-id <id>               - ID of XCCDF in the datastream that should be evaluated.
oscap の機能とそのオプションの完全なリストの詳細は、man ページの oscap(8) を参照してください。

8.4.1. oscapのインストール

oscap をシステムにインストールするには、root で以下のコマンドを実行します。
~]# yum install openscap-scanner
このコマンドを使用すると、oscap で、パッケージなど、適切に機能するために必要なパッケージをすべてインストールでき openscap ます。
独自のセキュリティーコンテンツを作成する場合は、Script Check Engine(SCE)を提供する openscap-engine-sce パッケージもインストールする必要があります。SCE は SCAP プロトコルの拡張機能で、コンテンツ作成者は Bash、Python、Ruby などのスクリプト言語を使用してセキュリティーコンテンツを記述できるようにします。openscap-engine-sce パッケージは、openscap-scanner パッケージと同じ方法でインストールできますが、Red Hat Enterprise Linux バリアントのオプションパッケージを使用して、リポジトリーまたはチャネルにアクセスできる必要があります。システムが Red Hat Subscription Management に登録されている場合は、『Red Hat Enterprise Linux 6 デプロイメントガイド』の Yum の章 で説明しているように、rhel-6-variant-optional-rpms リポジトリーを有効にします。variant は、サーバーワークステーション などの Red Hat Enterprise Linux バリアントです。システムが RHN Classic に登録されている場合は、システムを rhel-architecturevariant-6-optional チャンネル)にサブスクライブします https://access.redhat.com/site/solutions/9907
必要に応じて、oscap のインストール後に、oscap のバージョンの機能、サポートする仕様、特定の oscap ファイルを保存する場所、使用可能な SCAP オブジェクトの種類、その他の有用な情報を確認できます。この情報を表示するには、以下のコマンドを入力します。
~]$ oscap -V
OpenSCAP command line tool (oscap) 1.0.8
Copyright 2009--2014 Red Hat Inc., Durham, North Carolina.

==== Supported specifications ====
XCCDF Version: 1.2
OVAL Version: 5.10.1
CPE Version: 2.3
CVSS Version: 2.0
CVE Version: 2.0
Asset Identification Version: 1.1
Asset Reporting Format Version: 1.1

==== Capabilities added by auto-loaded plugins ====
SCE Version: 1.0 (from libopenscap_sce.so.8)

==== Paths ====
Schema files: /usr/share/openscap/schemas
Schematron files: /usr/share/openscap/xsl
Default CPE files: /usr/share/openscap/cpe
Probes: /usr/libexec/openscap

==== Inbuilt CPE names ====
Red Hat Enterprise Linux - cpe:/o:redhat:enterprise_linux
Red Hat Enterprise Linux 5 - cpe:/o:redhat:enterprise_linux:5
Red Hat Enterprise Linux 6 - cpe:/o:redhat:enterprise_linux:6
Red Hat Enterprise Linux 7 - cpe:/o:redhat:enterprise_linux:7
Fedora 16 - cpe:/o:fedoraproject:fedora:16
Fedora 17 - cpe:/o:fedoraproject:fedora:17
Fedora 18 - cpe:/o:fedoraproject:fedora:18
Fedora 19 - cpe:/o:fedoraproject:fedora:19
Fedora 20 - cpe:/o:fedoraproject:fedora:20
Fedora 21 - cpe:/o:fedoraproject:fedora:21
Red Hat Enterprise Linux Optional Productivity Applications - cpe:/a:redhat:rhel_productivity
Red Hat Enterprise Linux Optional Productivity Applications 5 - cpe:/a:redhat:rhel_productivity:5

==== Supported OVAL objects and associated OpenSCAP probes ====
system_info                  probe_system_info           
family                       probe_family                
filehash                     probe_filehash              
environmentvariable          probe_environmentvariable   
textfilecontent54            probe_textfilecontent54     
textfilecontent              probe_textfilecontent       
variable                     probe_variable              
xmlfilecontent               probe_xmlfilecontent        
environmentvariable58        probe_environmentvariable58 
filehash58                   probe_filehash58            
inetlisteningservers         probe_inetlisteningservers  
rpminfo                      probe_rpminfo               
partition                    probe_partition             
iflisteners                  probe_iflisteners           
rpmverify                    probe_rpmverify             
rpmverifyfile                probe_rpmverifyfile         
rpmverifypackage             probe_rpmverifypackage      
selinuxboolean               probe_selinuxboolean        
selinuxsecuritycontext       probe_selinuxsecuritycontext
file                         probe_file                  
interface                    probe_interface             
password                     probe_password              
process                      probe_process               
runlevel                     probe_runlevel              
shadow                       probe_shadow                
uname                        probe_uname                 
xinetd                       probe_xinetd                
sysctl                       probe_sysctl                
process58                    probe_process58             
fileextendedattribute        probe_fileextendedattribute 
routingtable                 probe_routingtable
oscap ユーティリティーを効果的に使用を開始する前に、一部のセキュリティーコンテンツをシステムにインストールするか、またはインポートする必要があります。各 Web サイトから SCAP コンテンツをダウンロードしたり、RPM ファイルまたはパッケージとして指定された場合は Yum パッケージマネージャーを使用して、指定した場所(既知のリポジトリー)からインストールできます。
たとえば、Linux システム向けの最新のセキュリティーポリシーを含む SCAP Security Guide(SSG)パッケージをインストールするには、以下のコマンドを実行します。
~]# yum install scap-security-guide
scap-security-guide パッケージをシステムにインストールし、指定しない限り、SSG セキュリティーコンテンツが /usr/share/xml/scap/ssg/content/ ディレクトリーで利用可能になり、他のセキュリティーコンプライアンス操作に進むことができます。
ニーズに適した既存の SCAP コンテンツの他のソースを確認するには、を参照してください 「その他のリソース」
システムに SCAP コンテンツをインストールした後、oscap は、コンテンツのファイルパスを指定してコンテンツを処理できます。oscap ユーティリティーは SCAP バージョン 1.2 に対応しており、SCAP バージョン 1.1 および 1.0 と後方互換性があるので、特別な要件なしで SCAP コンテンツの以前のバージョンを処理することができます。