如要找出允許未加密直接連線的 AlloyDB for PostgreSQL 正式環境執行個體,並保護傳輸中的資料,您可以查看並套用 AlloyDB 強制執行 SSL 模式建議工具提供的建議。
AlloyDB 強制執行 SSL 模式建議工具會分析執行個體中繼資料。如果執行個體是正式環境執行個體,且未針對直接連線強制執行加密規定,建議工具會建議您啟用 SSL 模式。
系統每天都會產生建議。
事前準備
您必須先完成下列步驟,才能查看建議和深入分析:
如要取得查看及使用深入分析和建議的權限,請要求管理員授予您必要的 Identity and Access Management (IAM) 角色:
Tasks 角色 查看建議 AlloyDB 建議工具檢視者 ( roles/recommender.alloydbViewer)套用建議 AlloyDB 建議工具管理員 ( roles/recommender.alloydbAdmin) 或 AlloyDB 管理員 (roles/alloydb.admin)詳情請參閱「將存取權授予其他使用者」。
列出建議
您可以使用 Google Cloud 控制台、gcloud CLI 或 Recommender API,列出強制執行 SSL 模式的建議。
控制台
前往 Google Cloud 控制台的「Clusters」(叢集) 頁面。
詳情請參閱「使用 Active Assist 尋找建議」。
在「Resources」(資源) 清單表格中,找到叢集,然後按一下「Issues」(問題) 欄中的「View issues」(查看問題)。
「Aggregated issues」(匯總問題) 面板會顯示問題清單。選取「Allows direct unencrypted connections」(允許未加密的直接連線) 建議資訊卡。
gcloud CLI
如要使用 gcloud CLI 列出強制執行 SSL 模式的建議,請執行 gcloud recommender recommendations list 指令,如下所示:
gcloud recommender recommendations list \ --project=PROJECT_ID \ --location=LOCATION \ --recommender=google.alloydb.instance.SecurityRecommender \ --filter=recommenderSubtype=REQUIRE_SSL
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
API
如要使用 Recommender API 列出強制執行 SSL 模式的建議,請呼叫 recommendations.list 方法,如下所示:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.alloydb.instance.SecurityRecommender/recommendations?filter=recommenderSubtype=REQUIRE_SSL
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
查看洞察資料和詳細建議
您可以使用 Google Cloud 控制台、gcloud CLI 或 Recommender API,查看需要強制執行 SSL 模式的執行個體深入分析和詳細建議。
如要查看洞察和詳細建議,請按照下列步驟操作:
控制台
在「Clusters」(叢集) 頁面的「Resources」(資源) 表格下方,按一下叢集「Issues」(問題) 欄中的「View issues」(查看問題)。
右側會顯示「Aggregated issues」(匯總問題) 面板,其中包含「Allows direct unencrypted connections」(允許未加密的直接連線) 的深入分析和詳細建議。
gcloud CLI
請執行 gcloud recommender insights list 指令,如下所示:
gcloud recommender insights list \ --project=PROJECT_ID \ --location=LOCATION \ --insight-type=google.alloydb.instance.SecurityInsight \ --filter=insightSubtype=SSL_NOT_REQUIRED
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
API
呼叫 insights.list 方法,如下所示:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.alloydb.instance.SecurityInsight/insights?filter=insightSubtype=SSL_NOT_REQUIRED
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
套用建議
仔細評估最佳化建議,然後執行下列任一操作:
控制台
如要採行建議,請在執行個體上強制執行 SSL/TLS 模式。
gcloud CLI
如要採行建議,請在執行個體上強制執行 SSL/TLS 模式。