π Google Cloud SQL Instance has public IP addresses π’
- Contextual name: π SQL Instance has public IP addresses π’
- ID:
/ce/ca/google/sql/sql-instance-with-public-ip
- Located in: π Google Cloud SQL
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Cloud Conformity
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
It is recommended to configure Second Generation Sql instance to use private IPs instead of public IPs.
Rationaleβ
To lower the organization's attack surface, Cloud SQL databases should not have public IPs. Private IPs provide improved network security and lower latency for your application.
Impactβ
Removing the public IP address on SQL instances may break some applications that relied on it for database connectivity.
Auditβ
From Google Cloud Consoleβ
- Go to the Cloud SQL Instances page in the Google Cloud Console: https://console.cloud.google.com/sql/instances
- Ensure that every instance has a private IP address and no public IP address configured.
From Google Cloud CLIβ
List all Cloud SQL database instances using the following command:
gcloud sql instances list
For every instance of type
instanceType: CLOUD_SQL_INSTANCE
withbackendType: SECOND_GEN
, get detailed configuration. Ignore instances of typeREAD_REPLICA_INSTANCE
because these instances inherit their settings from the primary instance. Also, note that first generation instances cannot be configured to have a private IP address.... see more
Remediationβ
Remediationβ
From Google Cloud Consoleβ
- Go to the Cloud SQL Instances page in the Google Cloud Console: https://console.cloud.google.com/sql/instances
- Click the instance name to open its Instance details page.
- Select the
Connections
tab.- Deselect the
Public IP
checkbox.- Click
Save
to update the instance.From Google Cloud CLIβ
For every instance remove its public IP and assign a private IP instead:
gcloud sql instances patch <INSTANCE_NAME> --network=<VPC_NETWORK_NAME> --no-assign-ip
Confirm the changes using the following command:
gcloud sql instances describe <INSTANCE_NAME>
policy.yamlβ
Linked Framework Sectionsβ
Section | Sub Sections | Internal Rules | Policies | Flags |
---|---|---|---|---|
πΌ CIS GCP v3.0.0 β πΌ 6.6 Ensure That Cloud SQL Database Instances Do Not Have Public IPs - Level 2 (Automated) | 1 | |||
πΌ Cloudaware Framework β πΌ Public and Anonymous Access | 24 |