收集 Cloud Storage 情境記錄

剖析器版本:1.0

支援的服務:

本文說明如何使用 Cloud Storage,將 Cloud Storage 情境記錄匯出並擷取至 Google Security Operations。剖析器會清理並結構化 Cloud Storage 記錄檔傳入的 JSON 資料。接著,系統會將相關欄位對應至統一資料模型 (UDM),並為資料加上標籤和中繼資料,以便在資安生態系統中以一致的方式呈現及分析資料。

事前準備

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

  • Google SecOps 執行個體。
  • Cloud Storage 已在 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 名稱規定的不重複名稱,例如 google-storage-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. 點選「建立」。

設定 Cloud Storage 情境記錄匯出作業

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

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

      logName="*storage*"
      resource.type="gcs_bucket"
      
  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

如何設定 Cloud Storage 情境資訊動態饋給

  1. 按一下「Google Cloud Compute platform」套件。
  2. 找到「GCP Google Cloud Storage Context」記錄類型,然後點選「新增動態饋給」。
  3. 為下列欄位指定值:

    • 來源類型:Google Cloud Storage V2。
    • Storage bucket URI:Cloud Storage bucket 網址,例如 gs://compute-context-logs/。這個網址結尾必須是正斜線 (/)。
    • 來源刪除選項:根據偏好選取刪除選項。
  • 檔案存在時間上限:納入過去幾天內修改過的檔案。預設值為 180 天。

進階選項

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

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

UDM 對應表

記錄欄位 UDM 對應 邏輯
上階 event.idm.entity.entity.resource.attribute.labels.value 祖系值是從原始記錄中的祖系陣列擷取而來。
assetType event.idm.entity.entity.resource.type 直接從原始記錄中的 assetType 欄位對應。
insertId event.idm.entity.metadata.product_entity_id 直接從原始記錄中的 insertId 欄位對應。
labels.compute.googleapis.com/resource_name event.idm.entity.entity.resource.name 直接從原始記錄中的 labels.compute.googleapis.com/resource_name 欄位對應。
labels.k8s-pod/controller-revision-hash event.idm.entity.entity.file.sha1 直接從原始記錄中的 labels.k8s-pod/controller-revision-hash 欄位對應。
labels.k8s-pod/name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 labels.k8s-pod/name 欄位對應。
labels.k8s-pod/pod-template-generation event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 labels.k8s-pod/pod-template-generation 欄位對應。
logName event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄的 logName 欄位對應。
名稱 event.idm.entity.entity.resource.name 直接從原始記錄中的名稱欄位對應。
receiveTimestamp event.idm.entity.entity.resource.attribute.creation_time 從原始記錄的 receiveTimestamp 欄位轉換為時間戳記格式。
resource.data.iamConfiguration.publicAccessPrevention event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.iamConfiguration.publicAccessPrevention 欄位對應。
resource.data.id event.idm.entity.entity.resource.product_object_id 直接從原始記錄中的 resource.data.id 欄位對應。
resource.data.kind event.idm.entity.entity.resource.type 直接從原始記錄中的 resource.data.kind 欄位對應。
resource.data.labels.app_id event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.app_id 欄位對應。
resource.data.labels.app_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.app_name 欄位對應。
resource.data.labels.bucket_id event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.bucket_id 欄位對應。
resource.data.labels.data_classification event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.data_classification 欄位對應。
resource.data.labels.dept_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.dept_name 欄位對應。
resource.data.labels.dept_no event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.dept_no 欄位對應。
resource.data.labels.environment event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.environment 欄位對應。
resource.data.labels.goog-composer-environment event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.goog-composer-environment 欄位對應。
resource.data.labels.goog-composer-location event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.goog-composer-location 欄位對應。
resource.data.labels.goog-composer-version event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.goog-composer-version 欄位對應。
resource.data.labels.technical_contact event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.technical_contact 欄位對應。
resource.data.labels.type event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.data.labels.type 欄位對應。
resource.data.location event.idm.entity.entity.location.name 直接從原始記錄中的 resource.data.location 欄位對應。
resource.data.projectNumber event.idm.entity.entity.resource.attribute.cloud.project.id 直接從原始記錄中的 resource.data.projectNumber 欄位對應。
resource.data.selfLink event.idm.entity.entity.url 直接從原始記錄中的 resource.data.selfLink 欄位對應。
resource.data.timeCreated event.idm.entity.entity.resource.attribute.creation_time 從原始記錄的 resource.data.timeCreated 欄位轉換為時間戳記格式。
resource.data.updated event.idm.entity.entity.resource.attribute.last_update_time 從原始記錄的 resource.data.updated 欄位轉換為時間戳記格式。
resource.discoveryDocumentUri event.idm.entity.entity.file.full_path 直接從原始記錄中的 resource.discoveryDocumentUri 欄位對應。
resource.labels.cluster_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.labels.cluster_name 欄位對應。
resource.labels.container_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.labels.container_name 欄位對應。
resource.labels.location event.idm.entity.entity.location.name 直接從原始記錄中的 resource.labels.location 欄位對應。
resource.labels.namespace_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.labels.namespace_name 欄位對應。
resource.labels.pod_name event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.labels.pod_name 欄位對應。
resource.labels.project_id event.idm.entity.entity.resource.attribute.cloud.project.id 直接從原始記錄中的 resource.labels.project_id 欄位對應。
resource.parent event.idm.entity.entity.resource.parent 直接從原始記錄中的 resource.parent 欄位對應。
resource.type event.idm.entity.entity.resource.type 直接從原始記錄中的 resource.type 欄位對應。
resource.version event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 resource.version 欄位對應。
textPayload event.idm.entity.entity.resource.attribute.labels.value 直接從原始記錄中的 textPayload 欄位對應。
不適用 event.idm.entity.metadata.collected_timestamp 收集的時間戳記是記錄項目時間戳記。
不適用 event.idm.entity.metadata.entity_type 硬式編碼為 RESOURCE。
不適用 event.idm.entity.metadata.product_name 硬式編碼為 GCP Storage Context。
不適用 event.idm.entity.metadata.vendor_name 硬式編碼為 Google Cloud Platform。
不適用 event.idm.entity.entity.resource.attribute.cloud.environment 硬式編碼為 GOOGLE_CLOUD_PLATFORM。
不適用 event.idm.entity.entity.resource.resource_type 硬式編碼為 STORAGE_BUCKET。
不適用 event.timestamp 事件時間戳記就是記錄項目時間戳記。

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