本頁說明如何查看及實作伺服器憑證輪替建議,適用於伺服器憑證即將在 30 天內到期的執行個體。如果執行個體的伺服器憑證即將在 30 天內到期,使用這個憑證的用戶端就無法安全地連線至執行個體,因此容易發生安全漏洞。這項建議稱為「輪替伺服器憑證」。
這項建議工具每天都會檢查執行個體中即將到期的憑證,並提供洞察資訊和建議,協助您提升執行個體安全性。您可以使用 Google Cloud 控制台、gcloud CLI 或 Recommender API,查看這些執行個體的深入分析和詳細建議。
事前準備
必要角色和權限
如要取得查看及使用洞察和建議的權限,請確認您具備必要的身分與存取權管理 (IAM) 角色。
Tasks | 角色 |
---|---|
查看建議 |
recommender.cloudsqlViewer 或
cloudsql.admin 。
|
套用建議 |
cloudsql.editor
或 cloudsql.admin 。
|
列出建議
如要列出建議,請按照下列步驟操作:
主控台
如要列出執行個體安全性的相關建議,請按照下列步驟操作:
前往「Cloud SQL 執行個體」頁面。
查看例項表格中的「問題」欄。
或者,請按照下列步驟操作:
gcloud
執行 gcloud recommender recommendations list
指令,如下所示:
gcloud recommender recommendations list \ --project=PROJECT_ID \ --location=LOCATION \ --recommender=google.cloudsql.instance.SecurityRecommender \ --filter=recommenderSubtype=ROTATE_SERVER_CERT
更改下列內容:
- PROJECT_ID:您的專案 ID。
- LOCATION:執行個體所在的區域,例如 us-central1。
API
呼叫 recommendations.list
方法,如下所示:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.SecurityRecommender/recommendations?filter=recommenderSubtype=ROTATE_SERVER_CERT
更改下列內容:
- PROJECT_ID:您的專案 ID。
- LOCATION:執行個體所在的區域,例如
us-central1
。
查看洞察資料和詳細建議
如要查看洞察資料和詳細建議,請按照下列步驟操作:
主控台
列出建議後,請點選其中一項。 系統會顯示建議面板,其中包含洞察資料和詳細建議。
gcloud
執行 gcloud recommender insights list
指令,如下所示:
gcloud recommender insights list \ --project=PROJECT_ID \ --location=LOCATION \ --insight-type=google.cloudsql.instance.SecurityInsight \ --filter=insightSubtype=SERVER_CERT_EXPIRING
更改下列內容:
- PROJECT_ID:您的專案 ID。
- LOCATION:執行個體所在的區域,例如
us-central1
。
API
呼叫 insights.list
方法,如下所示:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.SecurityInsight/insights?filter=insightSubtype=SERVER_CERT_EXPIRING
更改下列內容:
- PROJECT_ID:您的專案 ID。
- LOCATION:執行個體所在的區域,例如
us-central1
。
套用最佳化建議
主控台
如要實作這項建議,請按一下「管理伺服器憑證」,並在執行個體上輪替伺服器憑證。
gcloud
如要實作這項建議,請在執行個體上輪替伺服器憑證。
API
如要實作這項建議,請在執行個體上輪替伺服器憑證。