Shielded VM の保護設定の確認

対応する VM イメージで、起動時の整合性保護を設定します。

説明

Shielded VM の Secure Boot は起動コンポーネントの署名を確認します。vTPM は起動時の測定値を記録し、整合性モニタリングが信頼済みの基準値と比較します。

想定される影響

整合性を監視しないと起動コンポーネントの改変を見逃すおそれがあります。Secure Boot に対応していないカーネルやドライバーでは起動に失敗する場合があります。

対処方法

shielded_instance_config で enable_vtpm と enable_integrity_monitoring を有効にします。enable_secure_boot はイメージとドライバーの互換性を試してから有効にしてください。既存 VM は停止中に設定を変更し、再起動後に Cloud Logging で整合性の検証結果を確認します。失敗時の通知も設定してください。

例

3 つのタスクはそれぞれ別名の VM を作成します。test-object1 はイメージの既定値を使い、test-object5 は監視を無効にし、test-object は 3 つとも有効にします。対応するブートディスク、ネットワーク、プロジェクト、サービスアカウントの JSON ファイルを指定してください。

変更前

yaml
- name: create a instance1
  google.cloud.gcp_compute_instance:
    name: test-object1
    machine_type: n1-standard-1
    zone: us-central1-a
    project: "{{ gcp_project_id }}"
    auth_kind: serviceaccount
    service_account_file: "{{ gcp_credentials_file }}"
    state: present

- name: create a instance5
  google.cloud.gcp_compute_instance:
    name: test-object5
    machine_type: n1-standard-1
    zone: us-central1-a
    project: "{{ gcp_project_id }}"
    auth_kind: serviceaccount
    service_account_file: "{{ gcp_credentials_file }}"
    state: present
    shielded_instance_config:
      enable_integrity_monitoring: no
      enable_secure_boot: yes
      enable_vtpm: yes

変更後

yaml
- name: create a instance
  google.cloud.gcp_compute_instance:
    name: test-object
    machine_type: n1-standard-1
    zone: us-central1-a
    project: "{{ gcp_project_id }}"
    auth_kind: serviceaccount
    service_account_file: "{{ gcp_credentials_file }}"
    state: present
    shielded_instance_config:
      enable_integrity_monitoring: yes
      enable_secure_boot: yes
      enable_vtpm: yes

参考資料