Google Cloud
TMA-GCP-CLOUDSQL-NO-PUBLIC-IP
Ensure Cloud SQL instances do not have public IPs
Opis
A public IPv4 address exposes the instance to the Internet, guarded only by authorised networks. Every instance must have ipConfiguration.ipv4Enabled false (private IP / PSC only). Read-only gcloud calls against the active project (gcloud config set project, or CLOUDSDK_CORE_PROJECT); credentials come from the SDK's normal configuration (gcloud auth login, a service account or ADC). A missing CLI, credential or disabled API fails the check.
Kako se proverava
Metod provere: Komanda ljuske
out=$(gcloud sql instances list --format='value(name,settings.ipConfiguration.ipv4Enabled)' 2>/dev/null) || exit 1
printf '%s\n' "$out" | awk -F '\t' 'NF && $2 == "True" { n++; print "public IP: " $1 } END { if (!n) print "compliant" }'- Očekivani izlaz
compliant
Kako se ispravlja
Metod ispravke: Smernica ili zakrpa infrastrukture
Configure private IP (gcloud sql instances patch <instance> --network=<vpc> ...) then gcloud sql instances patch <instance> --no-assign-ip. Enforce with constraints/sql.restrictPublicIp.
Svojstva
- Operativni sistemi
- Bilo koji
- Oznake
- gcpdatabase
- Referenca
- CIS Google Cloud Platform Foundation Benchmark v5.0.0 - Cloud SQL - no public IP (verify section number for your release)
Proverite ovaj računar
Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.
tmaegis scan --target gcp --level 2