收集 Cloudflare Page Shield 記錄

剖析器版本:1.0

支援的服務:

本文說明如何使用 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. 依序前往「Security」(安全性) >「Page Shield」。
  4. 按一下「Enable Page Shield」。

建立 Amazon S3 bucket

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

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

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

設定 Cloudflare 的 S3 bucket 政策

  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. 按一下「Create a Logpush job」。
  5. 在「Select a destination」(選取目的地) 中,選擇「Amazon S3」。
  6. 輸入下列目的地資訊:
    • Bucket 名稱:輸入 S3 bucket 名稱 (例如 cloudflare-pageshield-logs)。
    • Bucket region:選取與 S3 bucket 相符的區域。
    • bucket 路徑 (選填):輸入路徑前置字串 (例如 pageshield/)。
  7. 按一下「繼續」。
  8. 為證明擁有權,Cloudflare 會將檔案傳送至你指定的目的地。如要找出權杖,請在擁有權驗證檔案的「總覽」分頁中選取「開啟」按鈕,然後將權杖貼到 Cloudflare 資訊主頁,驗證您是否能存取 bucket。輸入擁有權權杖,然後選取「繼續」。
  9. 在「Select a dataset」(選取資料集) 中,選擇「Page Shield events」(Page Shield 事件)。
  10. 點選「下一步」。
  11. 設定 Logpush 工作:
    • 工作名稱:輸入描述性名稱 (例如 pageshield-to-s3)。
    • If logs match:留空即可納入所有事件,或視需要設定篩選器。
    • 傳送下列欄位:選取「所有欄位」或選擇特定欄位。
  12. 按一下「提交」。

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

  1. 依序前往「設定」>「資料管理」>「動態饋給」。如果使用的是 SIEM 專用平台,請依序前往「設定」>「動態饋給」。
  2. 按一下「新增動態饋給」。
  3. 在下一頁,點按「設定單一動態饋給」。
  4. 在「Feed name」(動態饋給名稱) 欄位中,輸入動態饋給名稱 (例如 Cloudflare Page Shield S3)。
  5. 在「來源類型」部分,選取「Amazon S3 V2」。
  6. 選取「Cloudflare Page Shield」做為「Log type」(記錄類型)。
  7. 點選「下一步」。
  8. 指定下列輸入參數的值:

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

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

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

    • 存取金鑰 ID:可存取 S3 bucket 的使用者存取金鑰。

    • Secret Access Key:可存取 S3 bucket 的使用者私密金鑰。

    • Asset namespace:資產命名空間。

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

  9. 點選「下一步」。

  10. 在「完成」畫面中檢查新的新聞動態消息設定,然後按一下「提交」。

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 取得的值,在標籤中設為 string_value,鍵為「last_page_url」
名稱 event.idm.read_only_udm.additional.fields.name_label 從名稱取得的值,在標籤中設為 string_value,鍵為「name」
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 或 host.hostname 擷取的值
主機 event.idm.read_only_udm.principal.hostname 值取自 Host 或 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 專家尋求解答。