收集 Google Cloud Compute 內容記錄

支援以下發布途徑:

本文件說明如何使用 Cloud Storage 匯出及擷取 Google Cloud Compute 情境記錄,並將其匯入 Google 安全作業。剖析器會以 JSON 格式從記錄中擷取資訊。接著,系統會將擷取的資料正規化並建構為 Google SecOps UDM 格式,並著重於虛擬機器的詳細資料,例如硬體規格、網路設定、安全性設定,以及與其他實體的關係。

事前準備

請確認您已完成下列事前準備:

  • Google SecOps 執行個體。
  • 在 Google Cloud 環境中設定並啟用運算功能。
  • Google Cloud 的特殊存取權和適當權限。

建立 Cloud Storage 值區

  1. 登入 Google Cloud 控制台
  2. 前往「Cloud Storage Buckets」(Cloud Storage 值區) 頁面。

    前往「Buckets」(值區) 頁面

  3. 按一下 [建立]。

  4. 在「Create a bucket」(建立值區) 頁面中輸入值區資訊。完成下列每個步驟後,請按一下「繼續」繼續下一步:

    1. 在「開始使用」部分執行下列操作:

      1. 輸入符合值區名稱規定的不重複名稱,例如 compute-context-logs
      2. 如要啟用階層命名空間,請按一下展開箭頭,展開「Optimize for file oriented and data-intensive workloads」部分,然後選取「Enable Hierarchical namespace on this bucket」

      3. 如要新增分類標籤,請按一下展開箭頭,展開「Labels」部分。

      4. 按一下「新增標籤」,然後指定標籤的鍵和值。

    2. 在「Choose where to store your data」(選擇資料的儲存位置) 專區中執行下列操作:

      1. 選取「位置類型」
      2. 使用位置類型選單選取位置,指定要永久儲存值區內物件資料的位置。

      3. 如要設定跨值區複製作業,請展開「設定跨值區複製作業」部分。

    3. 在「Choose a storage class for your data」專區中,為值區選取預設儲存空間級別,或選取「Autoclass」,讓系統自動管理值區的資料儲存空間級別。

    4. 在「選取如何控制物件的存取權」專區中,選取「否」來強制執行公開存取防護,然後為值區物件選取存取權控管模型

    5. 在「Choose how to protect object data」(選擇保護物件資料的方式) 專區中執行下列操作:

      1. 選取「資料保護」下方的任一選項,設定值區。
      2. 如要選擇物件資料的加密方式,請按一下標示為「資料加密」的展開箭頭,然後選取「資料加密方法」
  5. 按一下 [建立]。

設定 Google Cloud 運算記錄匯出功能

  1. 登入 Google Cloud 控制台
  2. 依序前往「Logging」>「Log Router」
  3. 按一下「建立接收器」
  4. 提供下列設定參數:

    • Sink Name:輸入有意義的名稱,例如 Compute-Context-Sink
    • 匯出目的地:選取「Cloud Storage Storage」,然後輸入值區的 URI,例如 gs://compute-context-logs
    • 記錄檔篩選器

      logName="*compute*"
      resource.type="gce_instance"
      
  5. 按一下 [建立]。

設定 Cloud Storage 權限

  1. 依序前往「IAM 與管理」>「身分與存取權管理」
  2. 找出 Cloud Logging 服務帳戶。
  3. 授予值區的 roles/storage.admin 角色。

設定動態饋給

在 Google SecOps 平台中,有兩個不同的入口可用來設定動態消息:

  • SIEM 設定 > 動態饋給
  • 內容中心 > 內容包

依序前往「SIEM 設定」>「動態饋給」,設定動態饋給

如要設定動態饋給,請按照下列步驟操作:

  1. 依序前往「SIEM 設定」>「動態」
  2. 按一下「新增動態消息」
  3. 在下一頁中,按一下「設定單一動態饋給」
  4. 在「動態饋給名稱」欄位中輸入動態饋給的名稱,例如「Google Cloud Compute Context Logs」
  5. 選取「Google Cloud Storage」做為「來源類型」
  6. 選取「GCP Compute Context」做為「Log type」
  7. 按一下「Chronicle Service Account」欄位旁的「Get Service Account」
  8. 點選「下一步」
  9. 指定下列輸入參數的值:

    • Storage Bucket URI:Cloud Storage 值區網址,例如 gs://compute-context-logs
    • URI Is A:選取「Directory which includes subdirectories」
    • 來源刪除選項:根據偏好選取刪除選項。

    • 資產命名空間資產命名空間

  10. 點選「下一步」

  11. 在「完成」畫面中查看新的動態饋給設定,然後按一下「提交」

透過內容中心設定動態饋給

指定下列欄位的值:

  • Storage Bucket URI:Cloud Storage 值區網址,例如 gs://compute-context-logs
  • URI Is A:選取「Directory which includes subdirectories」
  • 來源刪除選項:根據偏好選取刪除選項。

進階選項

  • 動態饋給名稱:預先填入的值,用於識別動態饋給。
  • 來源類型:用於收集記錄並匯入 Google SecOps 的方法。
  • 素材資源命名空間:與動態饋給相關聯的命名空間。
  • 攝入標籤:套用至這個動態饋給中所有事件的標籤。

UDM 對應表

記錄欄位 UDM 對應 邏輯
上階 event.idm.entity.entity.asset.attribute.labels.value ancestors 陣列中的每個祖系值都會對應至標記,並使用鍵 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 系統會使用規則運算式,從 resource.data.networkInterfaces.0.network 欄位擷取網路 ID。
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 如果狀態為 RUNNINGPROVISIONINGSTAGINGSTOPPINGSUSPENDINGSUSPENDEDREPAIRINGTERMINATED 之一,則會對應至 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

異動

2024-01-27

修正錯誤:

  • nameresource.data.idresource.data.nameregionresource.data.selfLinkproject_idasset_network_id{region}-%{zone_suffix} 的對應項目分割成個別的變異區塊。

2024-01-05

改善項目:

  • 已移除 event.idm.entity.entity.namespace 的對應項目。
  • 新增支援功能,可從 resource.data.networkInterfaces 剖析所有 networkIP

2022-07-29

  • 新增 resource.data.lastStartTimestamp 的條件式檢查,並對應至 entity.asset.last_boot_time
  • 新增 resource.data.networkInterfaces.0.networkIP 的條件式檢查,並對應至 entity.asset.ip

2022-04-04

  • 更新供應商名稱。

還有其他問題嗎?向社群成員和 Google SecOps 專家尋求解答。