Control: 4.5 Ensure 'Enable connecting to serial ports' is not enabled for VM Instance
Description
Interacting with a serial port is often referred to as the serial console, which is similar to using a terminal window, in that input and output is entirely in text mode and there is no graphical interface or mouse support. If you enable the interactive serial console on an instance, clients can attempt to connect to that instance from any IP address. Therefore interactive serial console support should be disabled.
A virtual machine instance has four virtual serial ports. Interacting with a serial port is similar to using a terminal window, in that input and output is entirely in text mode and there is no graphical interface or mouse support.
The interactive serial console does not support IP-based access restrictions such as IP whitelists. If you enable the interactive serial console on an instance, clients can attempt to connect to that instance from any IP address. This allows anybody to connect to that instance if they know the correct SSH key, username, project ID, zone, and instance name.Therefore interactive serial console support should be disabled.
Remediation
Interactive serial console support should be disabled.
From Console
- Login to Google Cloud console
- Go to Computer Engine
- Go to VMinstances
- Click on the Specific VM
- Click
EDIT
- Unselect
Enable connecting to serial ports
belowRemote access
block. - Click
Save
From Command Line
Use the below command to disable
gcloud compute instances add-metadata INSTANCE_NAME --zone=ZONE --metadata=serial-port-enable=false
or
gcloud compute instances add-metadata <INSTANCE_NAME> --zone=<ZONE> --metadata=serial-port-enable=0
Prevention
You can prevent VMs from having serial port access enable by Disable VM serial port access
organization policy:
https://console.cloud.google.com/iam-admin/orgpolicies/compute-disableSerialPortAccess.
Default Value
By default, connecting to serial ports is not enabled.
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.cis_v200_4_5
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.cis_v200_4_5 --share
SQL
This control uses a named query:
compute_instance_serial_port_connection_disabled