收集 Cloudflare Page Shield 記錄

支援的國家/地區:

本文說明如何使用 Amazon S3,將 Cloudflare Page Shield 記錄檔擷取至 Google Security Operations。

Page Shield 可協助管理網站訪客載入的資源,包括指令碼、連線和 Cookie,並在資源變更或被視為惡意時觸發快訊通知。

事前準備

  • Google SecOps 執行個體
  • 已啟用 Page Shield 的 Cloudflare 帳戶
  • Cloudflare 資訊主頁的特殊存取權
  • AWS (S3、IAM) 的特殊存取權

這個選項會使用 Cloudflare Logpush 將 Page Shield 事件匯出至 Amazon S3,然後由 Google SecOps 擷取。

啟用 Page Shield

  1. 登入 Cloudflare 資訊主頁
  2. 選取帳戶和網域。
  3. 依序前往「安全性」>「Page Shield」
  4. 按一下「啟用網頁防護」

建立 Amazon S3 儲存貯體

  1. 開啟 Amazon S3 控制台
  2. 按一下「建立值區」
  3. 請提供下列設定詳細資料:
    • Bucket Name:輸入 bucket 的名稱 (例如 cloudflare-pageshield-logs)。
    • 「Region」(區域):選取偏好的 AWS 區域 (例如 us-east-1)。
  4. 點選「建立」
  5. 請儲存 bucket 名稱和區域,以供日後參考。

建立具有 S3 存取權的 IAM 使用者

  1. 開啟 IAM 主控台
  2. 依序點選「使用者」>「新增使用者」
  3. 輸入使用者名稱 (例如 chronicle-s3-user)。
  4. 選取「程式輔助存取」
  5. 點選 [Next: Permissions] (下一步:權限)。
  6. 選擇「直接附加現有政策」
  7. 搜尋並選取 AmazonS3FullAccess 政策。
  8. 按一下「下一步:代碼」
  9. 點選「下一步:檢閱」
  10. 按一下「建立使用者」
  11. 按一下「Download .csv file」(下載 .csv 檔案),儲存「Access Key ID」(存取金鑰 ID) 和「Secret Access Key」(存取密鑰)

為 Cloudflare 設定 S3 儲存貯體政策

  1. Amazon S3 主控台中,選取所需值區。
  2. 依序點選「權限」>「Bucket 政策」
  3. 按一下 [編輯]
  4. 貼上下列政策,並將 <BUCKET_NAME> 替換為您的 bucket 名稱:

    {
      "Id": "Policy1506627184792",
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "Stmt1506627150918",
          "Action": ["s3:PutObject"],
          "Effect": "Allow",
          "Resource": "arn:aws:s3:::<BUCKET_NAME>/*",
          "Principal": {
            "AWS": ["arn:aws:iam::391854517948:user/cloudflare-logpush"]
          }
        }
      ]
    }
    
  5. 按一下 [儲存變更]。

建立 Cloudflare Logpush 工作

  1. 登入 Cloudflare 資訊主頁
  2. 選取帳戶和網域。
  3. 依序前往「Analytics & Logs」>「Logs」
  4. 按一下「建立 Logpush 工作」
  5. 在「選取目的地」中,選擇「Amazon S3」
  6. 輸入下列目的地資訊:
    • 值區名稱:輸入 S3 值區名稱 (例如 cloudflare-pageshield-logs)。
    • 值區區域:選取與 S3 值區相符的區域。
    • bucket 路徑 (選用):輸入路徑前置字元 (例如 pageshield/)。
  7. 按一下「繼續」
  8. 為證明擁有權,Cloudflare 會將檔案傳送至您指定的目的地。如要尋找權杖,請在擁有權驗證檔案的「總覽」分頁中選取「開啟」按鈕,然後將權杖貼到 Cloudflare 資訊主頁,驗證您對 bucket 的存取權。輸入擁有權權杖,然後選取「繼續」。
  9. 在「選取資料集」中,選擇「Page Shield 事件」
  10. 點選 [下一步]。
  11. 設定記錄檔推送作業:
    • 工作名稱:輸入描述性名稱 (例如 pageshield-to-s3)。
    • 如果記錄檔相符:留空即可納入所有事件,或視需要設定篩選器。
    • 傳送下列欄位:選取「所有欄位」或選擇特定欄位。
  12. 按一下「提交」

在 Google SecOps 中設定動態饋給,擷取 Page Shield 記錄

  1. 依序前往「SIEM 設定」>「動態饋給」
  2. 按一下「新增動態消息」
  3. 在下一個頁面中,按一下「設定單一動態饋給」
  4. 在「動態饋給名稱」欄位中輸入動態饋給名稱 (例如 Cloudflare Page Shield S3)。
  5. 選取「Amazon S3 V2」做為「來源類型」
  6. 選取「Cloudflare Page Shield」做為「記錄類型」
  7. 點選 [下一步]。
  8. 指定下列輸入參數的值:

    • S3 URI:以 s3://<BUCKET_NAME>/<BUCKET_PATH>/ 格式輸入 bucket URI

    • 來源刪除選項:根據偏好設定選取刪除選項:

      • 永不:轉移後一律不刪除任何檔案。
      • 刪除已轉移的檔案:成功轉移檔案後刪除檔案。
      • 刪除已轉移的檔案和空白目錄:成功轉移後刪除檔案和空白目錄。
    • 檔案存在時間上限:包含在過去天數內修改的檔案。預設值為 180 天。

    • 存取金鑰 ID:具有 S3 儲存空間存取權的使用者存取金鑰。

    • 存取密鑰:具有 S3 bucket 存取權的使用者私密金鑰。

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

    • 擷取標籤:要套用至這個動態饋給事件的標籤。

  9. 點選 [下一步]。

  10. 在「Finalize」(完成) 畫面中檢查新的動態饋給設定,然後按一下「Submit」(提交)

UDM 對應表

記錄欄位 UDM 對應 邏輯
URLContainsCDNCGIPath event.idm.read_only_udm.additional.fields.CGI_label 取自 URLContainsCDNCGIPath 的值,在標籤中設為 string_value,並以「CGI」做為鍵
動作 event.idm.read_only_udm.additional.fields.action_label 從動作取得的值,在標籤中設為 string_value,並以「action」做為鍵
resource.first_page_url event.idm.read_only_udm.additional.fields.first_page_label 取自 resource.first_page_url 的值,在標籤中設為 string_value,並以「first_page_url」做為鍵
resource.last_page_url event.idm.read_only_udm.additional.fields.last_page_label 取自 resource.last_page_url 的值,在標籤中以鍵「last_page_url」設為 string_value
名稱 event.idm.read_only_udm.additional.fields.name_label 從名稱取得的值,在索引鍵為「name」的標籤中設為 string_value
ts event.idm.read_only_udm.metadata.event_timestamp 從 ts (UNIX) 轉換為時間戳記
event.idm.read_only_udm.metadata.event_type 根據 has_principal、has_target、has_target_user 衍生:如果主體和目標都有,則為 NETWORK_CONNECTION;如果是 target_user,則為 USER_UNCATEGORIZED;如果是主體,則為 STATUS_UPDATE;否則為 GENERIC_EVENT
resource.url event.idm.read_only_udm.network.http.referral_url 取自 resource.url 的值
主機 event.idm.read_only_udm.principal.asset.hostname 取自主機或 host.hostname 的值
主機 event.idm.read_only_udm.principal.hostname 取自主機或 host.hostname 的值
alert_type event.idm.read_only_udm.principal.resource.attribute.labels.alert_type_label 從 alert_type 取得的值,設為標籤中的值,鍵為「alert_type」
resource.cryptomining_score event.idm.read_only_udm.principal.resource.attribute.labels.crypto_label 取自 resource.cryptomining_score 的值,並設為標籤中的值,鍵為「cryptominingscore%{index2}」
resource.dataflow_score event.idm.read_only_udm.principal.resource.attribute.labels.dataflow_label 取自 resource.dataflow_score 的值,並在標籤中設為值,鍵為「dataflowscore%{index2}」
policie.description event.idm.read_only_udm.principal.resource.attribute.labels.desc_label 取自 policie.description 的值,並設為鍵為「description_%{index}」的標籤值
version.fetched_at event.idm.read_only_udm.principal.resource.attribute.labels.fetched_at_label 從 version.fetched_at 取得的值,並在標籤中設為值,金鑰為「fetchedat%{index2}」
version.hash event.idm.read_only_udm.principal.resource.attribute.labels.hash_label 取自 version.hash 的值,設為標籤中的值,並以「hash_%{index2}」做為鍵
policie.id event.idm.read_only_udm.principal.resource.attribute.labels.id_label 從 policie.id 取得值,並在鍵為「policyid%{index}」的標籤中設為值
data.options.remove_dashboard_links event.idm.read_only_udm.principal.resource.attribute.labels.remove_dash_label 值取自 data.options.remove_dashboard_links,並設為鍵為「remove_dashboard_links」的標籤值
resource.resource_type event.idm.read_only_udm.principal.resource.attribute.labels.res_type_label 取自 resource.resource_type 的值,並設為標籤中的值,索引鍵為「resourcetype%{index2}」
data.type event.idm.read_only_udm.principal.resource.attribute.labels.type_label 取自 data.type 的值,在標籤中設為值,並以「type」做為鍵
data.zones event.idm.read_only_udm.principal.resource.attribute.labels.zones_label 從 data.zones 取得的值,設為鍵為「zones」的標籤值
resource.id event.idm.read_only_udm.principal.resource.id 取自 resource.id 的值
PageURL event.idm.read_only_udm.principal.url 從 PageURL 取得的值
account_id event.idm.read_only_udm.principal.user.product_object_id 從 account_id 取得的值
policy_id event.idm.read_only_udm.security_result.detection_fields.policy_id_label 從 policy_id 取得的值,設為鍵為「policy_id」的標籤值
policy_name event.idm.read_only_udm.security_result.detection_fields.policy_name_label 從 policy_name 取得的值,設為索引鍵為「policy_name」的標籤值
文字 event.idm.read_only_udm.security_result.description 從文字取得的值
resource.first_seen_at event.idm.read_only_udm.security_result.first_discovered_time 從 resource.first_seen_at 轉換為 ISO8601 時間戳記
PolicyID event.idm.read_only_udm.security_result.rule_name 從 PolicyID 取得的值
data.severity event.idm.read_only_udm.security_result.severity 衍生自 data.severity:如果為「INFO」→「INFORMATIONAL」;如果為「WARN」→「MEDIUM」;否則為「UNKNOWN_SEVERITY」
網址 event.idm.read_only_udm.target.url 取自網址的值
URLHost event.idm.read_only_udm.target.user.email_addresses 如果符合電子郵件模式,則取自 URLHost 的值

需要其他協助嗎?向社群成員和 Google SecOps 專業人員尋求答案。