收集 Forseti Open Source 記錄

剖析器版本:2.0

支援的國家/地區:

本文說明如何使用 Google Cloud Storage V2,將 Forseti Open Source 記錄檔擷取至 Google Security Operations。

Forseti Security 是依據社群需求推出的一套開放原始碼工具,可協助您增強 Google Cloud Platform 環境的安全性。Forseti 會擷取 GCP 資源的清單快照、掃描存取權控管法規遵循情況,並提供 Cloud IAM 政策的瀏覽權限。

事前準備

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

  • Google SecOps 執行個體。
  • 已啟用 Cloud Storage API 的 GCP 專案。
  • 具備建立及管理 GCS 值區和 IAM 政策的權限。
  • 現有的 Forseti Security 部署作業。
  • 存取 Forseti 伺服器設定檔 (forseti_conf_server.yaml)。

建立 Google Cloud Storage bucket

使用 Google Cloud 控制台

  1. 前往 Google Cloud 控制台
  2. 選取專案或建立新專案。
  3. 在導覽選單中,依序前往「Cloud Storage」>「bucket」
  4. 按一下「建立值區」
  5. 請提供下列設定詳細資料:

    設定
    為 bucket 命名 輸入全域不重複的名稱 (例如 forseti-violations-export)
    位置類型 根據需求選擇 (區域、雙區域、多區域)
    位置 選取位置 (例如 us-central1)
    儲存空間級別 標準 (建議用於經常存取的記錄)
    存取控管 統一 (建議)
    保護工具 選用:啟用物件版本管理或保留政策
  6. 點選「建立」

使用 gcloud 指令列工具

  • 或者,使用 gcloud 指令建立值區:

    gcloud storage buckets create gs://forseti-violations-export \
        --location=us-central1 \
        --default-storage-class=STANDARD
    
  • forseti-violations-export 替換成所需的全域不重複值區名稱。

  • us-central1 替換為您偏好的區域。

設定 Forseti Security,將違規事項匯出至 GCS

Forseti Security 會使用 forseti_conf_server.yaml 檔案中的通知程式設定,將掃描器違規事項匯出至 GCS。

  1. 使用 SSH 連線至 Forseti 伺服器 VM: bash gcloud compute ssh forseti-server-vm --project=YOUR_PROJECT_ID --zone=YOUR_ZONE
  2. 開啟設定檔進行編輯: bash sudo nano /home/ubuntu/forseti-security/configs/forseti_conf_server.yaml 如果使用以 GCS 為基礎的設定,請先下載: bash gsutil cp gs://YOUR_FORSETI_SERVER_BUCKET/configs/forseti_conf_server.yaml ~/forseti_conf_server.yaml
  3. 前往 notifier 區段,找出 resources 子節。
  4. 針對要匯出的每個違規事項資源類型,設定 gcs_violations 通知器:

    notifier:
        resources:
            - resource: iam_policy_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: firewall_rule_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: cloudsql_acl_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: bucket_acl_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
            - resource: config_validator_violations
                should_notify: true
                notifiers:
                    - name: gcs_violations
                        configuration:
                            data_format: csv
                            gcs_path: gs://forseti-violations-export/violations/
    

    重要參數:

    • resource:違規類型 (例如 iam_policy_violations)。
    • data_format:設為 csvjson
    • gcs_path:Cloud Storage 路徑 (必須包含尾端斜線)。
  5. 儲存檔案,並視需要將檔案上傳回 GCS。

  6. 重新載入設定: bash forseti server configuration reload

  7. 驗證: bash forseti server configuration get | grep gcs_violations

擷取 Google SecOps 服務帳戶

在 Google SecOps 中設定動態饋給

  1. 依序前往「SIEM 設定」>「動態消息」
  2. 按一下「新增動態饋給」,然後選取「設定單一動態饋給」
  3. 動態饋給名稱:輸入名稱 (例如 Forseti Violations)。
  4. 來源類型:選取「Google Cloud Storage V2」
  5. 記錄類型:選取「Forseti Open Source」
  6. 按一下「取得服務帳戶」
  7. 複製專屬服務帳戶電子郵件地址 (例如 chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com)。
  8. 點選「下一步」
  9. 指定輸入參數:
    • 儲存空間值區網址gs://forseti-violations-export/violations/
    • 來源刪除選項:根據偏好設定選取 (例如測試時選取「永不」)。
  10. 點選「下一步」,檢查設定,然後點選「提交」

將 IAM 權限授予 Google SecOps 服務帳戶

使用 Google Cloud 控制台

  1. 依序前往「Cloud Storage」>「Buckets」
  2. 按一下 bucket 名稱,然後前往「Permissions」(權限) 分頁標籤。
  3. 按一下「授予存取權」
  4. 新增主體:貼上 Google SecOps 服務帳戶電子郵件地址。
  5. 指派角色:選取「Storage 物件檢視者」。(如果已在動態饋給中選取刪除選項,請使用「Storage 物件管理員」)。
  6. 按一下 [儲存]
  • 使用 gcloud 指令列工具

    gcloud storage buckets add-iam-policy-binding gs://forseti-violations-export \
        --member="serviceAccount:CHRONICLE_SERVICE_ACCOUNT_EMAIL" \
        --role="roles/storage.objectViewer"
    

UDM 對應表

記錄欄位 UDM 對應 邏輯
data.resource_data.instanceGroupUrls about 從 instanceGroupUrls 陣列合併。
data.resource_data.nodePools.*.statusMessage metadata.description nodePool.statusMessage 的值。
data.resource_type metadata.event_type KMS/FW 的特定類型;否則為 GENERIC_EVENT
data.scanner_index_id metadata.product_log_id 直接複製為字串。
不適用 metadata.product_name 設為「FORSETI SECURITY」
不適用 metadata.vendor_name 設為 FORSETI
data.resource_data.direction network.direction 如果方向為「INGRESS」,請設為「INBOUND」。
data.resource_data.endpoint principal.ip 直接複製值。
data.full_nameserviceAccount principal.user.userid full_nameserviceAccount 擷取。
data.violation_type security_result.category 對應至 POLICY_VIOLATIONACL_VIOLATION
data.rule_name security_result.rule_name 直接複製值。
data.full_name target.asset.attribute.cloud.project.id 使用 grok 從 full_name 擷取。
data.resource_type target.resource.resource_type 根據 resource_type 對應至特定類型。

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