Enabling the serial console on Google Compute Engine VMs grants low-level interactive access to the instance console. This can bypass network and SSH controls, allowing actors who know project or instance details to interact with or tamper with the VM.
In Ansible, check tasks using google.cloud.gcp_compute_instance or gcp_compute_instance and ensure the metadata.serial-port-enable property is either undefined or explicitly set to false. Tasks with metadata.serial-port-enable: true are flagged. Remediate by removing the metadata key or setting it to false.
Secure Ansible example:
- name:Create GCE instance with serial port disabledgoogle.cloud.gcp_compute_instance:name:my-vmmachine_type:e2-mediummetadata:"serial-port-enable": false