Review Shielded VM protection settings

Configure boot-integrity protection on supported VM images.

Description

Secure Boot checks signatures on Shielded VM boot components. A vTPM records boot measurements, which integrity monitoring compares with a trusted baseline.

Potential impact

Without integrity monitoring, changes to boot components can go unnoticed. Incompatible kernels or drivers may fail to boot with Secure Boot.

Remediation

In shielded_instance_config, enable enable_vtpm and enable_integrity_monitoring. Enable enable_secure_boot after testing image and driver compatibility. Stop an existing VM before changing these options. After restarting it, check the boot integrity results in Cloud Logging and configure alerts for failures.

Examples

The tasks create differently named VMs. test-object1 uses the image defaults, test-object5 turns off monitoring, and test-object enables all three features. Supply a compatible boot disk, network, project and service account JSON file.

Before

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

After

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

References