Google Cloud
TMA-GCP-CLOUDSQL-REQUIRE-SSL
Ensure Cloud SQL instances require all incoming connections to use SSL
高等級 1自動化gcp
說明
Without enforced TLS, database credentials and data can cross the network unencrypted. Every instance must have requireSsl true or sslMode ENCRYPTED_ONLY / TRUSTED_CLIENT_CERTIFICATE_REQUIRED. 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 指令
shell
out=$(gcloud sql instances list --format='value(name,settings.ipConfiguration.requireSsl,settings.ipConfiguration.sslMode)' 2>/dev/null) || exit 1
printf '%s\n' "$out" | awk -F '\t' 'NF && $2 != "True" && $3 != "ENCRYPTED_ONLY" && $3 != "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" { n++; print "SSL not required: " $1 } END { if (!n) print "compliant" }'- 預期輸出
compliant
修補方式
修補方法: 操作指南或基礎設施修補檔
gcloud sql instances patch <instance> --ssl-mode=ENCRYPTED_ONLY (or TRUSTED_CLIENT_CERTIFICATE_REQUIRED). Update clients to connect with TLS or via the Cloud SQL Auth Proxy first.
屬性
- 作業系統
- 不限
- 標籤
- gcpdatabase
- 參考資料
- CIS Google Cloud Platform Foundation Benchmark v5.0.0 - Cloud SQL - require SSL/TLS for incoming connections (verify section number for your release)
檢查此主機
請在您有權稽核的機器上執行此指令。掃描為唯讀操作。
shell
tmaegis scan --target gcp