3.12. 整合性シールド保護 (テクノロジープレビュー)
整合性シールドは、整合性管理をサポートするツールで、リソースの作成または更新要求に対する署名検証を有効にします。整合性シールドは Open Policy Agent (OPA) および Gatekeeper をサポートし、要求に署名があるかどうかを検証して、定義した制約に従って不正な要求をブロックします。
以下の整合性シールド機能を参照してください。
- 承認された Kubernetes マニフェストのデプロイメントのみをサポートします。
- リソースが許可リストに追加されていない限り、リソース設定のゼロドリフトをサポートします。
- 受付コントローラーの実施など、クラスターで全整合性の検証を実行します。
- リソースを継続的に監視して、不正な Kubernetes リソースがクラスターにデプロイされているかどうかを報告します。
-
Kubernetes マニフェスト YAML ファイルの署名には、X509、GPG、および Sigstore の署名がサポートされます。Kubernetes 整合性シールドは、
k8s-manifest-sigstore
を使用して署名した Sigstore をサポートします。
3.12.1. 整合性シールドアーキテクチャー リンクのコピーリンクがクリップボードにコピーされました!
整合性シールドは、API と Observer の 2 つの主要なコンポーネントで設定されます。整合性シールド Operator は、クラスター上の整合性シールドコンポーネントのインストールおよび管理をサポートします。以下のコンポーネントの説明を確認してください。
-
整合性シールド API は OPA または gatekeeper から Kubernetes リソースを受信し、受付要求に含まれるリソースを検証して検証結果を OPA または gatekeeper に送信します。整合性シールド API は
k8s-manifest-sigstore
のverify-resource
機能を使用して、Kubernetes マニフェスト YAML ファイルを検証します。整合性シールド API は、ManifestingIntegrityConstraint
(OPA または gatekeeper の制約フレームワークをベースとするカスタムリソース) に従ってリソースを検証します。 -
整合性シールドオブザーバー は、
ManifestingIntegrityConstraint
リソースに合わせてクラスター上の Kubernetes りそーすを継続的に検証し、ManifestIntegrityState
と呼ばれるリソースに結果をエクスポートします。整合性シールドオブザーバーもk8s-manifest-sigstore
を使用して署名を検証します。
3.12.2. サポート対象バージョン リンクのコピーリンクがクリップボードにコピーされました!
以下の製品バージョンは、整合性シールドの保護をサポートします。
詳細は 整合性シールド保護の有効化 (テクノロジープレビュー) を参照してください。
3.12.3. 整合性シールド保護の有効化 (テクノロジープレビュー) リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Advanced Cluster Management for Kubernetes クラスターで整合性シールド保護を有効にして、Kubernetes リソースの整合性を保護します。
3.12.3.1. 前提条件 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Advanced Cluster Management マネージドクラスターで整合性シールド保護を有効にするには、以下の前提条件を満たす必要がある。
-
マネージドクラスターが含まれる Red Hat Advanced Cluster Management ハブクラスターをインストールしており、そのクラスターに対して
oc
またはkubectl
コマンドを使用するためのクラスター管理者権限がある。 整合性シールドをインストールする。整合性シールドをインストールする前に、Open Policy Agent または gatekeeper をクラスターにインストールする必要がある。整合性シールド Operator をインストールするには、以下の手順を実行する。
以下のコマンドを実行して、整合性シールドの namespace に整合性シールド Operator をインストールする。
kubectl create -f https://raw.githubusercontent.com/open-cluster-management/integrity-shield/master/integrity-shield-operator/deploy/integrity-shield-operator-latest.yaml
kubectl create -f https://raw.githubusercontent.com/open-cluster-management/integrity-shield/master/integrity-shield-operator/deploy/integrity-shield-operator-latest.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを使用して、整合性シールドカスタムリソースをインストールする。
kubectl create -f https://raw.githubusercontent.com/open-cluster-management/integrity-shield/master/integrity-shield-operator/config/samples/apis_v1_integrityshield.yaml -n integrity-shield-operator-system
kubectl create -f https://raw.githubusercontent.com/open-cluster-management/integrity-shield/master/integrity-shield-operator/config/samples/apis_v1_integrityshield.yaml -n integrity-shield-operator-system
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 整合性シールドには、クラスターで保護する必要があるリソースの署名および検証用の鍵のペアが必要である。署名と検証キーペアを設定する。
以下のコマンドを使用して新規の GPG キーを生成する。
gpg --full-generate-key
gpg --full-generate-key
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを使用して、新しい GPG 公開鍵をファイルにエクスポートする。
gpg --export signer@enterprise.com > /tmp/pubring.gpg
gpg --export signer@enterprise.com > /tmp/pubring.gpg
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
yq
をインストールして、Red Hat Advanced Cluster Management ポリシーに署名するスクリプトを実行する。 -
Integrity-shield 保護を有効にし、Red Hat Advanced Cluster Management に署名することで、
integrity-shield
リポジトリーからのソースの取得およびコミットが含まれる。Git をインストールする必要がある。
3.12.3.2. 整合性シールド保護の有効化 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Advanced Cluster Management マネージドクラスターで整合性シールドを有効にするには、以下の手順を実行します。
ハブクラスターに整合性シールド用の namespace を作成します。以下のコマンドを実行します。
oc create ns your-integrity-shield-ns
oc create ns your-integrity-shield-ns
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 検証キーを Red Hat Advanced Cluster Management マネージドクラスターにデプロイします。なお、署名キーおよび検証キーを作成する必要があります。ハブクラスターで
acm-verification-key-setup.sh
を実行して検証キーを設定します。以下のコマンドを実行します。curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/ACM/acm-verification-key-setup.sh | bash -s \ --namespace integrity-shield-operator-system \ --secret keyring-secret \ --path /tmp/pubring.gpg \ --label environment=dev | oc apply -f -
curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/ACM/acm-verification-key-setup.sh | bash -s \ --namespace integrity-shield-operator-system \ --secret keyring-secret \ --path /tmp/pubring.gpg \ --label environment=dev | oc apply -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 検証キーを削除するには、以下のコマンドを実行します。
curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/ACM/acm-verification-key-setup.sh | bash -s - \ --namespace integrity-shield-operator-system \ --secret keyring-secret \ --path /tmp/pubring.gpg \ --label environment=dev | oc delete -f -
curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/ACM/acm-verification-key-setup.sh | bash -s - \ --namespace integrity-shield-operator-system \ --secret keyring-secret \ --path /tmp/pubring.gpg \ --label environment=dev | oc delete -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ハブクラスターに
policy-integrity-shield
という名前の Red Hat Advanced Cluster Management ポリシーを作成します。-
policy-collection
リポジトリーからpolicy-integrity-shield
ポリシーを取得します。リポジトリーをフォークしてください。 -
remediationAction
パラメーターの値をinform
からenforce
に更新して、Red Hat Advanced Cluster Management マネージドクラスターに整合性シールドをデプロイするように namespace を設定します。 -
signerConfig
セクションを更新して、署名および検証キーのメールを設定します。 -
整合性シールドをデプロイする Red Hat Advanced Cluster Management マネージドクラスターを決定する
PlacementRule
を設定します。 以下のコマンドを実行して、
policy-integrity-shield.yaml
を署名します。curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/gpg-annotation-sign.sh | bash -s \ signer@enterprise.com \ policy-integrity-shield.yaml
curl -s https://raw.githubusercontent.com/stolostron/integrity-shield/master/scripts/gpg-annotation-sign.sh | bash -s \ signer@enterprise.com \ policy-integrity-shield.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記: ポリシーを変更し、他のクラスターに適用する場合は、常に新規署名を作成する必要があります。そうでない場合は、変更はブロックされ、適用されません。
-
サンプルについては、policy-integrity-shield
ポリシーを参照してください。