如要找出未啟用資料庫稽核功能的 AlloyDB for PostgreSQL 正式版執行個體,並改善資安態勢,您可以查看並套用 AlloyDB 資料庫稽核建議工具提供的建議。
事前準備
您必須先完成下列步驟,才能查看建議和深入分析:
如要取得查看及使用深入分析和建議的權限,請要求管理員授予您必要的 Identity and Access Management (IAM) 角色:
Tasks 角色 查看建議 AlloyDB 建議工具檢視者 ( roles/recommender.alloydbViewer)套用建議 AlloyDB 建議工具管理員 ( roles/recommender.alloydbAdmin) 或 AlloyDB 管理員 (roles/alloydb.admin)詳情請參閱「將存取權授予其他使用者」。
列出建議
您可以使用 Google Cloud 控制台、gcloud CLI 或 Recommender API,列出啟用資料庫稽核功能的建議。
控制台
前往 Google Cloud 控制台的「Clusters」(叢集) 頁面。
詳情請參閱「使用 Active Assist 尋找建議」。
在「Resources」(資源) 清單表格中,找到叢集,然後按一下「Issues」(問題) 欄中的「View issues」(查看問題)。
「Aggregated issues」(匯總問題) 面板會顯示問題清單。選取「Auditing not enabled」(未啟用稽核功能) 建議卡。
gcloud CLI
如要使用 gcloud CLI 列出啟用資料庫稽核功能的建議,請執行 gcloud recommender recommendations list 指令,如下所示:
gcloud recommender recommendations list \ --project=PROJECT_ID \ --location=LOCATION \ --recommender=google.alloydb.instance.SecurityRecommender \ --filter=recommenderSubtype=ENABLE_DATABASE_AUDITING
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
API
如要使用 Recommender API 列出啟用資料庫稽核功能的建議,請呼叫 recommendations.list 方法,如下所示:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.alloydb.instance.SecurityRecommender/recommendations?filter=recommenderSubtype=ENABLE_DATABASE_AUDITING
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
查看洞察資料和詳細建議
您可以使用 Google Cloud 控制台、gcloud CLI 或 Recommender API,查看需要啟用資料庫稽核功能的執行個體深入分析和詳細建議。
控制台
在「Clusters」(叢集) 頁面的「Resources」(資源) 表格下方,按一下叢集「Issues」(問題) 欄中的「View issues」(查看問題)。
右側會顯示「Aggregated issues」(匯總問題) 面板,其中包含「Auditing not enabled」(未啟用稽核功能) 的深入分析和詳細建議。
gcloud CLI
請執行 gcloud recommender insights list 指令,如下所示:
gcloud recommender insights list \ --project=PROJECT_ID \ --location=LOCATION \ --insight-type=google.alloydb.instance.SecurityInsight \ --filter=insightSubtype=DATABASE_AUDITING_NOT_ENABLED
更改下列內容:
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=DATABASE_AUDITING_NOT_ENABLED
更改下列內容:
PROJECT_ID:您的專案 ID。LOCATION:執行個體所在的區域,例如us-central1。
套用建議
仔細評估最佳化建議,然後執行下列任一操作:
控制台
如要採行建議,請按照「啟用 pgAudit」中的指示操作。
gcloud CLI
如要採行建議,請按照「啟用 pgAudit」中的指示操作。