收集 Security Command Center 錯誤記錄
本文說明如何使用 Cloud Storage,將 Security Command Center 錯誤記錄匯出及擷取至 Google Security Operations。剖析器會將原始 JSON 格式的記錄轉換為統一資料模型 (UDM)。這項功能會從原始記錄中擷取相關欄位、執行資料清理和正規化作業,並根據 UDM 結構定義輸出資料,以利進行一致的安全性分析。
事前準備
請確認您已完成下列事前準備事項:
- 在 Google Cloud 環境中啟用並設定 Security Command Center。
- Google SecOps 執行個體。
- 具備 Security Command Center 和 Cloud Logging 的特殊權限。
建立 Cloud Storage 值區
- 登入Google Cloud 控制台。
前往「Cloud Storage Buckets」(Cloud Storage bucket) 頁面。
點選「建立」。
在「建立 bucket」頁面中,輸入 bucket 資訊。完成下列每個步驟後,請按一下「繼續」前往下一個步驟:
在「開始使用」部分,執行下列操作:
- 輸入符合值區名稱規定的專屬名稱,例如 gcp-scc-error-logs。
如要啟用階層命名空間,請按一下展開箭頭,展開「為檔案導向和資料密集型工作負載提供最理想的儲存空間」部分,然後選取「為這個值區啟用階層結構式命名空間」。
如要新增值區標籤,請按一下展開箭頭,展開「標籤」部分。
按一下「新增標籤」,然後指定標籤的鍵和值。
在「Choose where to store your data」(選擇資料的儲存位置) 部分,執行下列操作:
- 選取「位置類型」。
使用位置類型選單選取位置,永久儲存 bucket 中的物件資料。
如要設定跨 bucket 複製作業,請展開「設定跨 bucket 複製作業」部分。
在「為資料選擇儲存空間級別」部分,選取 bucket 的預設儲存空間級別,或選取「Autoclass」,讓系統自動管理 bucket 資料的儲存空間級別。
在「選取如何控制物件的存取權」部分,選取「否」來強制執行禁止公開存取,並為值區物件選取存取權控管模型。
在「選擇保護物件資料的方式」部分,執行下列操作:
- 選取「資料保護」下方的任何選項,為 bucket 設定資料保護措施。
- 如要選擇物件資料的加密方式,請按一下標示為「資料加密」的展開箭頭,然後選取「資料加密方法」。
點選「建立」。
設定 Security Command Center 記錄
- 登入Google Cloud 控制台。
前往 Security Command Center 頁面。
選取您的機構。
按一下「設定」。
按一下「持續匯出」分頁標籤。
在「匯出名稱」下方,按一下「記錄匯出」。
在「接收器」下方,開啟「將發現項目記錄至 Logging」。
在「記錄專案」下方,輸入或搜尋要記錄調查結果的專案。
按一下 [儲存]。
設定匯出 Security Command Center 錯誤記錄
- 登入Google Cloud 控制台。
- 依序前往「Logging」>「Log Router」。
- 按一下「建立接收器」。
提供下列設定參數:
- 接收器名稱:輸入有意義的名稱,例如
scc-error-logs-sink。 - 接收器目的地:選取「Cloud Storage Storage」,然後輸入值區的 URI,例如
gs://gcp-scc-error-logs/。 記錄檔篩選器:
logName="projects/<your-project-id>/logs/cloudsecurityscanner.googleapis.com%2Ferror_logs" resource.type="security_command_center_error"設定匯出選項:包含所有記錄項目。
- 接收器名稱:輸入有意義的名稱,例如
點選「建立」。
設定 Cloud Storage 的權限
- 依序前往「IAM 與管理」>「身分與存取權管理」。
- 找出 Cloud Logging 服務帳戶。
- 授予值區的 roles/storage.admin。
設定動態饋給
如要設定動態消息,請按照下列步驟操作:
- 依序前往「SIEM 設定」>「動態消息」。
- 按一下「新增動態消息」。
- 在下一個頁面中,按一下「設定單一動態饋給」。
- 在「動態消息名稱」欄位中,輸入動態消息的名稱,例如「Security Command Center 錯誤記錄」。
- 選取「Google Cloud Storage V2」做為「來源類型」。
- 選取「Security Command Center Error」(Security Command Center 錯誤) 做為「Log type」(記錄類型)。
- 按一下「Chronicle Service Account」(Chronicle 服務帳戶) 欄位旁的「Get Service Account」(取得服務帳戶)。
- 點選「下一步」。
- 指定下列輸入參數的值:
- 儲存空間值區 URI:Cloud Storage 值區網址,例如
gs://gcp-scc-error-logs/。這個網址必須以尾端斜線 (/) 結尾。 - 來源刪除選項:根據偏好設定選取刪除選項。
注意:如果選取
Delete transferred files或Delete transferred files and empty directories選項,請務必授予服務帳戶適當的權限。 - 檔案存在時間上限:包含在過去天數內修改的檔案。預設值為 180 天。
- 儲存空間值區 URI:Cloud Storage 值區網址,例如
- 點選「下一步」。
- 在「Finalize」(完成) 畫面中檢查新的動態饋給設定,然後按一下「Submit」(提交)。
UDM 對應表
| 記錄欄位 | UDM 對應 | 邏輯 |
|---|---|---|
| access.principalEmail | about.user.email_addresses | 取自 access.principalEmail 欄位的值。 |
| category | metadata.product_event_type | 視記錄格式而定,取自 category 或 findings.category 欄位的值。 |
| contacts.security.contacts.email | security_result.about.user.email_addresses | 取自 contacts.security.contacts.email 欄位的值。角色設為 Security。 |
| contacts.technical.contacts.email | security_result.about.user.email_addresses | 取自 contacts.technical.contacts.email 欄位的值。角色設為 Technical。 |
| createTime | security_result.detection_fields.value | 視記錄格式而定,取自 createTime 或 findings.createTime 欄位的值。金鑰已設為 createTime。 |
| 說明 | security_result.description | 視記錄格式而定,取自 description 或 findings.description 欄位的值。 |
| eventTime | metadata.event_timestamp | 系統會根據記錄格式,從 eventTime 或 findings.eventTime 欄位取得值,並轉換為時間戳記。 |
| externalUri | about.url | 視記錄格式而定,取自 externalUri 或 findings.externalUri 欄位的值。 |
| findingClass | security_result.category_details | 視記錄格式而定,取自 findingClass 或 findings.findingClass 欄位的值。 |
| findingProviderId | target.resource.attribute.labels.value | 視記錄格式而定,取自 findingProviderId 或 findings.findingProviderId 欄位的值。金鑰已設為 finding_provider_id。 |
| 靜音 | security_result.detection_fields.value | 視記錄格式而定,取自 mute 或 findings.mute 欄位的值。金鑰已設為 mute。 |
| nextSteps | security_result.outcomes.value | 視記錄格式而定,取自 nextSteps 或 findings.nextSteps 欄位的值。金鑰已設為 nextSteps。 |
| resourceName | target.resource.name | 視記錄格式而定,取自 resourceName、findings.resourceName、resource_name 或 findings.resource_name 欄位的值。 |
| securityMarks.name | security_result.detection_fields.value | 視記錄格式而定,取自 securityMarks.name 或 findings.securityMarks.name 欄位的值。金鑰已設為 securityMarks_name。 |
| 嚴重性 | security_result.severity | 視記錄格式而定,取自 severity 或 findings.severity 欄位的值,並對應至相應的 UDM 嚴重程度。 |
| sourceDisplayName | target.resource.attribute.labels.value | 視記錄格式而定,取自 sourceDisplayName 或 findings.sourceDisplayName 欄位的值。金鑰已設為 source_display_name。 |
| sourceProperties.ReactivationCount | target.resource.attribute.labels.value | 視記錄格式而定,取自 sourceProperties.ReactivationCount 或 findings.sourceProperties.ReactivationCount 欄位的值。金鑰已設為 sourceProperties_ReactivationCount。 |
| state | security_result.detection_fields.value | 視記錄格式而定,取自 state 或 findings.state 欄位的值。金鑰已設為 state。 |
| metadata.event_type | 設為 GENERIC_EVENT 的預設值。 |
|
| metadata.log_type | 硬式編碼值 GCP_SECURITYCENTER_ERROR。 |
|
| metadata.description | 硬式編碼值 Security Command Center。 |
|
| metadata.product_name | 硬式編碼值 Security Command Center。 |
|
| metadata.vendor_name | 硬式編碼值 Google。 |
|
| target.resource.attribute.labels.key | 硬式編碼值 finding_id。 |
|
| target.resource.attribute.labels.value | 從 name 或 findings.name 欄位擷取,擷取最後一個 / 字元後的最後一部分。 |
|
| target.resource.product_object_id | 從 parent 或 findings.parent 欄位擷取,擷取最後一個 / 字元後的值。 |
|
| target.resource.ancestors.name | 視記錄格式而定,取自 parent 或 findings.parent 欄位的值。 |
|
| target.resource_ancestors.name | 從 resourceName 或 findings.resourceName 欄位擷取,擷取 //cloudresourcemanager.googleapis.com/projects/ 前置字元後的值。 |
|
| target.resource_ancestors.resource_type | 硬式編碼值 CLOUD_PROJECT。 |
|
| target.resource.attribute.labels.key | 硬式編碼值 source_id。 |
|
| target.resource.attribute.labels.value | 從 parent 或 findings.parent 欄位擷取,擷取第二個 / 字元後的值。 |
|
| security_result.alert_state | 根據 state 或 findings.state 欄位對應。如果狀態為 ACTIVE,alert_state 會設為 ALERTING,否則為 NOT_ALERTING。 |
|
| about.user.email_addresses | 取自 iamBindings.member 欄位的值。 |
|
| about.user.attribute.roles.name | 硬式編碼值 Security。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。