收集 Google Cloud 運算內容記錄
本文說明如何使用 Cloud Storage,將 Compute 內容記錄檔匯出及擷取 Google Cloud 至 Google Security Operations。剖析器會從 JSON 格式的記錄檔中擷取資訊。接著,系統會將擷取的資料正規化並轉換為 Google SecOps UDM 格式,著重於虛擬機器的詳細資料,例如硬體規格、網路設定、安全性設定,以及與其他實體的關係。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體。
- 在 Google Cloud 環境中設定並啟用 Compute。
- Google Cloud 的特殊存取權和適當權限。
建立 Cloud Storage 值區
- 登入Google Cloud 控制台。
前往「Cloud Storage Buckets」(Cloud Storage bucket) 頁面。
點選「建立」。
在「建立 bucket」頁面中,輸入 bucket 資訊。完成下列每個步驟後,請按一下「繼續」前往下一個步驟:
在「開始使用」部分執行下列操作:
- 輸入符合值區名稱規定的專屬名稱,例如 compute-context-logs。
如要啟用階層命名空間,請按一下展開箭頭,展開「為檔案導向和資料密集型工作負載提供最理想的儲存空間」部分,然後選取「為這個值區啟用階層結構式命名空間」。
如要新增值區標籤,請按一下展開箭頭,展開「標籤」部分。
按一下「新增標籤」,然後指定標籤的鍵和值。
在「Choose where to store your data」(選擇資料的儲存位置) 專區中執行下列操作:
- 選取「位置類型」。
使用位置類型選單選取位置,永久儲存 bucket 中的物件資料。
如要設定跨 bucket 複製作業,請展開「設定跨 bucket 複製作業」部分。
在「為資料選擇儲存空間級別」部分,選取值區的預設儲存空間級別,或選取「Autoclass」,讓系統自動管理值區資料的儲存空間級別。
在「選取如何控制物件的存取權」部分,選取「否」以強制禁止公開存取,並為值區物件選取存取權控管模型。
在「選擇保護物件資料的方式」部分,執行下列操作:
- 選取「資料保護」下要為值區設定的任何選項。
- 如要選擇物件資料的加密方式,請按一下標示為「資料加密」的展開箭頭,然後選取「資料加密方法」。
點選「建立」。
設定 Google Cloud 運算記錄匯出作業
- 登入Google Cloud 控制台。
- 依序前往「Logging」>「Log Router」。
- 按一下「建立接收器」。
提供下列設定參數:
- 接收器名稱:輸入有意義的名稱,例如
Compute-Context-Sink
。 - 接收器目的地:選取「Cloud Storage Storage」,然後輸入值區的 URI,例如
gs://compute-context-logs
。 記錄檔篩選器:
logName="*compute*" resource.type="gce_instance"
- 接收器名稱:輸入有意義的名稱,例如
點選「建立」。
設定 Cloud Storage 的權限
- 前往「IAM 與管理」>「IAM」。
- 找到 Cloud Logging 服務帳戶。
- 授予值區的 roles/storage.admin。
設定動態饋給
如要設定動態消息,請按照下列步驟操作:
- 依序前往「SIEM 設定」>「動態消息」。
- 按一下「新增動態消息」。
- 在下一個頁面中,按一下「設定單一動態饋給」。
- 在「Feed name」(動態消息名稱) 欄位中輸入動態消息名稱,例如「Google Cloud Compute Context Logs」。
- 選取「Google Cloud Storage」做為「來源類型」。
- 選取「GCP Compute Context」做為「記錄類型」。
- 按一下「Chronicle Service Account」(Chronicle 服務帳戶) 欄位旁的「Get Service Account」(取得服務帳戶)。
- 點選「下一步」。
指定下列輸入參數的值:
- 儲存空間值區 URI:Cloud Storage 值區網址,例如
gs://compute-context-logs
。 - 「URI Is A」(URI 為):選取「Directory which includes subdirectories」(包含子目錄的目錄)。
來源刪除選項:根據偏好選取刪除選項。
資產命名空間:資產命名空間。
- 儲存空間值區 URI:Cloud Storage 值區網址,例如
點選「下一步」。
在「Finalize」畫面上檢查新的動態饋給設定,然後按一下「Submit」。
從內容中心設定動態饋給
為下列欄位指定值:
- 儲存空間值區 URI:Cloud Storage 值區網址,例如
gs://compute-context-logs
。 - 「URI Is A」(URI 為):選取「Directory which includes subdirectories」(包含子目錄的目錄)。
- 來源刪除選項:根據偏好選取刪除選項。
進階選項
- 動態饋給名稱:系統預先填入的值,用於識別動態饋給。
- 來源類型:將記錄收集到 Google SecOps 的方法。
- 資產命名空間:與動態饋給相關聯的命名空間。
- 擷取標籤:套用至這個動態饋給所有事件的標籤。
UDM 對應表
記錄欄位 | UDM 對應 | 邏輯 |
---|---|---|
上階 | event.idm.entity.entity.asset.attribute.labels.value | 祖先陣列中的每個祖先值都會對應到具有 ancestors 鍵的個別標籤。 |
assetType | event.idm.entity.entity.asset.category | 直接從 assetType 欄位對應。 |
asset_type | event.idm.entity.entity.asset.category | 直接從 asset_type 欄位對應。 |
名稱 | event.idm.entity.entity.resource.name | 直接從名稱欄位對應。 |
resource.data.cpuPlatform | event.idm.entity.entity.asset.hardware.cpu_platform | 直接從 resource.data.cpuPlatform 欄位對應。 |
resource.data.creationTimestamp | event.idm.entity.entity.asset.attribute.creation_time | 從 resource.data.creationTimestamp 欄位剖析為時間戳記格式。 |
resource.data.id | event.idm.entity.entity.asset.product_object_id | 直接從 resource.data.id 欄位對應。 |
resource.data.labels.business_function | event.idm.entity.entity.asset.attribute.labels.value | 直接從 resource.data.labels.business_function 欄位對應,並將鍵設為 business_function 。 |
resource.data.labels.environment | event.idm.entity.entity.asset.attribute.labels.value | 直接從 resource.data.labels.environment 欄位對應,並將鍵設為 environment 。 |
resource.data.labels.infra_location | event.idm.entity.entity.asset.attribute.labels.value | 直接從 resource.data.labels.infra_location 欄位對應,並將鍵設為 infra_location 。 |
resource.data.labels.instance_group | event.idm.entity.user.group_identifiers | 直接從 resource.data.labels.instance_group 欄位對應。 |
resource.data.labels.os | event.idm.entity.entity.asset.platform_software.platform_version | 直接從 resource.data.labels.os 欄位對應。 |
resource.data.labels.primary_application | event.idm.entity.entity.asset.attribute.labels.value | 直接從 resource.data.labels.primary_application 欄位對應,且鍵設為 primary_application 。 |
resource.data.labels.project_code | event.idm.entity.entity.asset.attribute.labels.value | 直接從 resource.data.labels.project_code 欄位對應,並將鍵設為 project_code 。 |
resource.data.lastStartTimestamp | event.idm.entity.entity.asset.last_boot_time | 從 resource.data.lastStartTimestamp 欄位剖析為時間戳記格式。 |
resource.data.machineType | event.idm.entity.entity.asset.hardware.model | 系統會使用規則運算式,從 resource.data.machineType 欄位擷取機器類型。 |
resource.data.name | event.idm.entity.entity.asset.hostname | 直接從 resource.data.name 欄位對應。 |
resource.data.networkInterfaces.0.accessConfigs.0.natIP | event.idm.entity.entity.asset.nat_ip | 系統會對應第一個網路介面的第一個 NAT IP 位址。 |
resource.data.networkInterfaces.0.network | event.idm.entity.entity.asset.attribute.cloud.vpc.name | 網路 ID 是使用規則運算式,從 resource.data.networkInterfaces.0.network 欄位中擷取而來。 |
resource.data.networkInterfaces.0.networkIP | event.idm.entity.entity.asset.ip | 系統會對應第一個網路介面的 IP 位址。 |
resource.data.networkInterfaces.1.networkIP | event.idm.entity.entity.asset.ip | 第二個網路介面的 IP 位址已對應。 |
resource.data.selfLink | event.idm.entity.entity.url | 直接從 resource.data.selfLink 欄位對應。 |
resource.data.serviceAccounts.0.email | event.idm.entity.relations.entity.user.email_addresses | 第一個服務帳戶的電子郵件地址已對應。 |
resource.data.status | event.idm.entity.entity.asset.deployment_status | 如果狀態為 RUNNING 、PROVISIONING 、STAGING 、STOPPING 、SUSPENDING 、SUSPENDED 、REPAIRING 或 TERMINATED ,則會對應至 ACTIVE 。否則會對應至 DEPLOYMENT_STATUS_UNSPECIFIED 。 |
event.idm.entity.entity.asset.attribute.cloud.availability_zone | 可用區是由地區和 zone_suffix 欄位組合而成。 | |
event.idm.entity.entity.asset.attribute.cloud.environment | 設為 GOOGLE_CLOUD_PLATFORM 。 |
|
event.idm.entity.entity.asset.attribute.cloud.project.name | 系統會使用規則運算式,從名稱欄位擷取專案 ID。 | |
event.idm.entity.entity.asset.attribute.cloud.project.resource_type | 設為 CLOUD_PROJECT 。 |
|
event.idm.entity.entity.asset.attribute.cloud.vpc.resource_type | 設為 VPC_NETWORK 。 |
|
event.idm.entity.entity.resource.resource_type | 如果 asset_type 或 assetType 包含 Instance ,請設為 VIRTUAL_MACHINE 。 |
|
event.idm.entity.entity.resource.type | 如果 asset_type 或 assetType 包含 Instance ,請設為 VIRTUAL_MACHINE 。 |
|
event.idm.entity.metadata.collected_timestamp | 設為 Logstash 事件時間戳記。 | |
event.idm.entity.metadata.entity_type | 設為 ASSET 。 |
|
event.idm.entity.metadata.product_name | 設為 GCP Compute Context 。 |
|
event.idm.entity.metadata.vendor_name | 設為 Google Cloud Platform 。 |
|
event.idm.entity.relations.entity.user.attribute.cloud.environment | 設為 GOOGLE_CLOUD_PLATFORM 。 |
|
event.idm.entity.relations.entity_type | 設為 USER 。 |
|
event.idm.entity.relations.relationship | 設為 ADMINISTERS 。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。