5.6.8.2. 未加工の結果の取得
コンプライアンススキャンが完了すると、個別のチェックの結果は生成される ComplianceCheckResult カスタムリソース (CR) にリスト表示されます。ただし、管理者または監査担当者にはスキャンの詳細情報が必要になる場合があります。OpenSCAP ツールは、詳細な結果で Advanced Recording Format (ARF) 形式のファイルを作成します。この ARF ファイルは設定マップまたは他の標準の Kubernetes リソースに保存するには大き過ぎるため、永続ボリューム (PV) がこれを組み込むように作成されます。
手順
Compliance Operator を使用した PV からの結果の取得は 4 つの手順で実行されます。ただし、
oc-complianceプラグインでは、単一のコマンドを使用できます。$ oc compliance fetch-raw <object-type> <object-name> -o <output-path>-
<object-type>は、スキャンの機能に使用されたオブジェクトによって、scansettingbinding、compliancescanまたはcompliancesuiteのいずれかにすることができます。 <object-name>は、ARF ファイルを収集に使用するバインディング、スイート、またはスキャンオブジェクトの名前です。<output-path>は、結果を配置するローカルディレクトリーです。以下に例を示します。
$ oc compliance fetch-raw scansettingbindings my-binding -o /tmp/出力例
Fetching results for my-binding scans: ocp4-cis, ocp4-cis-node-worker, ocp4-cis-node-master Fetching raw compliance results for scan 'ocp4-cis'....... The raw compliance results are available in the following directory: /tmp/ocp4-cis Fetching raw compliance results for scan 'ocp4-cis-node-worker'........... The raw compliance results are available in the following directory: /tmp/ocp4-cis-node-worker Fetching raw compliance results for scan 'ocp4-cis-node-master'...... The raw compliance results are available in the following directory: /tmp/ocp4-cis-node-master
ディレクトリー内のファイルの一覧を表示します。
$ ls /tmp/ocp4-cis-node-master/
出力例
ocp4-cis-node-master-ip-10-0-128-89.ec2.internal-pod.xml.bzip2 ocp4-cis-node-master-ip-10-0-150-5.ec2.internal-pod.xml.bzip2 ocp4-cis-node-master-ip-10-0-163-32.ec2.internal-pod.xml.bzip2
結果を抽出します。
$ bunzip2 -c resultsdir/worker-scan/worker-scan-stage-459-tqkg7-compute-0-pod.xml.bzip2 > resultsdir/worker-scan/worker-scan-ip-10-0-170-231.us-east-2.compute.internal-pod.xml
結果を表示します。
$ ls resultsdir/worker-scan/
出力例
worker-scan-ip-10-0-170-231.us-east-2.compute.internal-pod.xml
worker-scan-stage-459-tqkg7-compute-0-pod.xml.bzip2
worker-scan-stage-459-tqkg7-compute-1-pod.xml.bzip2