TMAegisベータ
gcp のその他のルール

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

修正方法

修正方法: ガイダンスまたは IaC パッチ

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