๐ก๏ธ Google GCE Instance has a public IP address๐ข
- Contextual name: ๐ก๏ธ Instance has a public IP address๐ข
- ID:
/ce/ca/google/compute-engine/instance-public-ip - Tags:
- ๐ข Policy with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: Check for Virtual Machine Instances with Public IP Addresses
Descriptionโ
Descriptionโ
Compute instances should not be configured to have external IP addresses.
Rationaleโ
To reduce your attack surface, Compute instances should not have public IP addresses. Instead, instances should be configured behind load balancers, to minimize the instance's exposure to the internet.
Impactโ
Removing the external IP address from your Compute instance may cause some applications to stop working.
Auditโ
From Google Cloud Consoleโ
- Go to the
VM instancespage by visiting: https://console.cloud.google.com/compute/instances.- For every VM, ensure that there is no
External IPconfigured.From Google Cloud CLIโ
gcloud compute instances list --format=json
- The output should not contain an
accessConfigssection undernetworkInterfaces. Note that thenatIPvalue is present only for instances that are running or for instances that are stopped but have a static IP address. For instances that are stopped and are configured to have an ephemeral public IP address, thenatIPfield will not be present. Example output:... see more
Remediationโ
Remediationโ
From Google Cloud Consoleโ
- Go to the
VM instancespage by visiting: https://console.cloud.google.com/compute/instances.- Click on the instance name to go the the
Instance detail page.- Click
Edit.- For each Network interface, ensure that
External IPis set toNone.- Click
Doneand then clickSave.From Google Cloud CLIโ
Describe the instance properties:
gcloud compute instances describe <INSTANCE_NAME> --zone=<ZONE>Identify the access config name that contains the external IP address. This access config appears in the following format:
networkInterfaces:
- accessConfigs:
- kind: compute#accessConfig
name: External NAT
natIP: 130.211.181.55
type: ONE_TO_ONE_NATDelete the access config.
gcloud compute instances delete-access-config <INSTANCE_NAME> --zone=<ZONE> --access-config-name <ACCESS_CONFIG_NAME>In the above example, the
ACCESS_CONFIG_NAMEisExternal NAT. The name of your access config might be different.