收集 Google Cloud 運算情境記錄

剖析器版本:3.0

支援的服務:

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

事前準備

請確認您符合下列必要條件:

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

建立 Cloud Storage bucket

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

    前往「Buckets」

  3. 點選「建立」。

  4. 在「Create a bucket」(建立 bucket) 頁面中,輸入 bucket 資訊。完成下列各步驟後,請點選「繼續」前往下一步:

    1. 在「Get started」(開始使用) 部分,執行下列操作:

      1. 輸入符合 bucket 名稱規定的不重複名稱,例如 compute-context-logs。
      2. 如要啟用階層命名空間,請按一下展開箭頭,展開「Optimize for file oriented and data-intensive workloads」(針對檔案導向和資料密集型工作負載進行最佳化) 專區,然後選取「Enable Hierarchical namespace on this bucket」(為這個 bucket 啟用階層命名空間)。

      3. 如要新增值區標籤,請按一下展開箭頭,展開「Labels」(標籤) 專區。

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

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

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

      3. 如要設定跨 bucket 複製作業,請展開「Set up cross-bucket replication」(設定跨 bucket 複製作業) 專區。

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

    4. 在「Choose how to control access to objects」(選取如何控制物件的存取權) 區段中,選取「不」強制執行「公開存取權防護」,並為 bucket 的物件選取「存取控管模型」。

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

      1. 在「資料保護」下方,選取要為 bucket 設定的選項。
      2. 如要選擇物件資料的加密方式,請按一下標示為「Data encryption」(資料加密) 的展開箭頭,然後選取「Data encryption method」(資料加密方法)。
  5. 點選「建立」。

設定 Google Cloud Compute 記錄檔匯出

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

    • 「Sink Name」(接收器名稱):輸入有意義的名稱,例如 Compute-Context-Sink。
    • 「Sink Destination」(接收器目的地):選取「Cloud Storage Storage」,然後輸入 bucket 的 URI,例如 gs://compute-context-logs/。
    • 記錄篩選器:

      logName="*compute*"
      resource.type="gce_instance"
      
  5. 點選「建立」。

設定 Cloud Storage 權限

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

設定動態饋給

在 Google SecOps 平台中,有兩個不同的進入點可以設定動態饋給:

  • 「設定」>「資料管理」>「動態饋給」>「新增動態饋給」 (在僅限 SIEM 的平台上,依序點選「設定」>「動態饋給」>「新增動態饋給」)
  • Content Hub > Content Packs > Get Started

如何設定 Google Cloud Compute Context 動態饋給

  1. 按一下「Google Cloud Compute platform」套件。
  2. 找出「GCP Compute Context」記錄類型。
  3. 指定下列值:

    • 來源類型:Google Cloud Storage V2。
    • Storage bucket URI:Cloud Storage bucket 網址,例如 gs://compute-context-logs/。這個網址結尾必須是正斜線 (/)。
    • 來源刪除選項:根據偏好選取刪除選項。

    • 檔案存在時間上限:過去幾天內修改過的檔案。預設值為 180 天。

    • Chronicle 服務帳戶:複製服務帳戶。您必須在 bucket 中為這個服務帳戶新增權限,Google SecOps 才能讀取或刪除 bucket 中的資料。

    進階選項

    • 動態饋給名稱:系統預先填入的值,用於識別動態饋給。
    • 資產命名空間:與動態饋給相關聯的命名空間。
    • 擷取標籤:套用至這個動態饋給所有事件的標籤。
  4. 點選「建立動態饋給」。

如要進一步瞭解如何為這個產品系列中的不同記錄類型設定多個動態饋給,請參閱「依產品設定動態饋給」。

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 如果狀態為 RUNNING、PROVISIONING、STAGING、STOPPING、SUSPENDING、SUSPENDED、REPAIRING、TERMINATED,則對應至 ACTIVE。否則,對應至 DEPLOYMENT_STATUS_UNSPECIFIED。
event.idm.entity.entity.asset.attribute.cloud.availability_zone 可用區是由 region 和 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 專業人員尋求解答。