Google Cloud
TMA-GCP-CLOUDSQL-NO-PUBLIC-IP
Ensure Cloud SQL instances do not have public IPs
높음레벨 2자동gcp
설명
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.
점검 방법
감사 방식: 셸 명령
shell
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" }'- 예상 출력
compliant
조치 방법
조치 방식: 가이드 또는 인프라 패치
Configure private IP (gcloud sql instances patch <instance> --network=<vpc> ...) then gcloud sql instances patch <instance> --no-assign-ip. Enforce with constraints/sql.restrictPublicIp.
속성
- 운영 체제
- 모두
- 태그
- gcpdatabase
- 참고 자료
- CIS Google Cloud Platform Foundation Benchmark v5.0.0 - Cloud SQL - no public IP (verify section number for your release)
이 호스트 점검하기
감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.
shell
tmaegis scan --target gcp --level 2