收集 AWS WAF 記錄

剖析器版本:11.0

支援的國家/地區:

本文說明如何設定 Google Security Operations 動態饋給,收集 AWS 網頁應用程式防火牆 (WAF) 記錄。剖析器會將原始 JSON 格式記錄轉換為符合 Google SecOps UDM 的結構化格式。這項功能會擷取 IP 位址、網址、使用者代理程式和安全性規則詳細資料等欄位,並將這些欄位對應至相應的 UDM 欄位,以確保呈現和分析結果一致。

事前準備

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

  • Google SecOps 執行個體
  • AWS 特殊存取權

設定 Amazon S3 儲存貯體

  1. 按照這份使用手冊的指示建立 Amazon S3 儲存空間:建立儲存空間
  2. 儲存 bucket 的名稱和區域,稍後會用到。
  3. 按照這份使用手冊建立使用者:建立 IAM 使用者。
  4. 選取建立的使用者。
  5. 選取「安全憑證」分頁標籤。
  6. 在「Access Keys」部分,按一下「Create Access Key」。
  7. 選取「第三方服務」做為「用途」。
  8. 點選「下一步」。
  9. 選用:新增說明標記。
  10. 按一下「Create access key」。
  11. 按一下「Download CSV file」,儲存「Access Key」和「Secret Access Key」,以供日後使用。
  12. 按一下「完成」。
  13. 選取 [權限] 分頁標籤。
  14. 在「權限政策」部分,按一下「新增權限」。
  15. 選取「新增權限」。
  16. 選取「直接附加政策」。
  17. 搜尋並選取「AmazonS3FullAccess」AmazonS3FullAccess政策。
  18. 點選「下一步」。
  19. 按一下「Add permissions」。

建立 WAF 網頁 ACL (存取控制清單)

如果尚未設定 AWS WAF,請建立 WAF 網頁 ACL (存取控制清單)。如果是現有設定,請跳到下一個程序。

  1. 在 AWS 控制台中,搜尋並選取「AWS WAF & Shield」。
  2. 按一下「Create web ACL」。
  3. 提供下列設定:
    • 名稱:為 ACL 命名 (例如 my-waf-web-acl)。
    • 區域:選擇要套用 WAF 的區域。
    • CloudWatch 指標:啟用指標收集功能,追蹤活動和觸發的規則。
  4. 建立完成後,選取要啟用記錄功能的網路 ACL。

如何設定 AWS WAF 記錄

  1. 在 AWS WAF 控制台中,前往 Web ACL 的「Logging」分頁。
  2. 按一下「啟用記錄功能」。
  3. 選取「Amazon S3」做為記錄目的地。
  4. 選擇稍早建立的 S3 bucket,用於儲存記錄。
  5. 選用:設定記錄檔前置字元,方便整理記錄檔 (例如 waf-logs/)。
  6. 按一下 [儲存]。

確認 S3 值區的權限

確認 S3 值區具備適當權限,可讓 AWS WAF 寫入記錄。

  1. 前往 S3 控制台。
  2. 選取要儲存記錄檔的值區。
  3. 在「Permissions」分頁中,新增下列值區政策,允許 AWS WAF 寫入記錄:

    {
      "Version": "2012-10-17",
      "Statement": [
          {
            "Effect": "Allow",
            "Principal": {
                "Service": "wafv2.amazonaws.com"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::your-log-bucket-name/*"
          }
      ]
    }
    
  1. 按一下 [儲存]。

設定動態饋給

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

  • SIEM 設定 > 摘要 > 新增摘要
  • Content Hub > Content Packs > Get Started

如何設定 AWS WAF 動態饋給

  1. 按一下「Amazon Cloud Platform」套件。
  2. 找出 AWS WAF 記錄類型。
  3. 在下列欄位中指定值。

    • 來源類型:Amazon SQS V2
    • 佇列名稱:要從中讀取的 SQS 佇列名稱
    • S3 URI:值區 URI。
      • s3://your-log-bucket-name/
        • 將 your-log-bucket-name 替換為 S3 bucket 的實際名稱。
    • 來源刪除選項:根據擷取偏好設定選取刪除選項。

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

    • SQS 佇列存取金鑰 ID:帳戶存取金鑰,為 20 個英數字元的字串。

    • SQS 佇列私密存取金鑰:帳戶存取金鑰,為 40 個英數字元的字串。

    進階選項

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

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

UDM 對應表

記錄欄位 UDM 對應 邏輯
動作 security_result.action 如果動作為 ALLOW,請將 security_result.action 設為 ALLOW,並將 security_result.severity 設為 INFORMATIONAL。如果動作為 BLOCK,請將 security_result.action 設為 BLOCK。如果動作為 CAPTCHA,且 captchaResponse.responseCode 為 405,請將 security_result.action 設為 BLOCK,並將 security_result.action_details 設為「CAPTCHA {captchaResponse.failureReason}」。
captchaResponse.failureReason security_result.action_details 與 action 和 captchaResponse.responseCode 搭配使用,可判斷 security_result.action_details。
captchaResponse.responseCode security_result.action_details 與 action 和 captchaResponse.failureReason 搭配使用,可判斷 security_result.action_details。
httpRequest.clientIp principal.ip、principal.asset.ip 直接對應至 principal.ip 和 principal.asset.ip。
httpRequest.headers target.hostname、target.asset.hostname、network.http.user_agent、network.http.parsed_user_agent、network.http.referral_url、target.location.country_or_region、target.resource.attribute.labels、target.user.userid 逐一疊代 httpRequest.headers 中的每個標頭。如果標題名稱為「host」或「Host」,則值會對應至 target.hostname 和 target.asset.hostname。如果標頭名稱為「User-Agent」或「user-agent」,系統會將值對應至 network.http.user_agent,並剖析至 network.http.parsed_user_agent。如果標頭名稱為「Referer」或「referer」,則值會對應至 network.http.referral_url。如果標頭名稱為「(?i)time-zone」,值會對應至 target.location.country_or_region。如果標題名稱為「authorization」,系統會解碼該值、擷取使用者名稱,並對應至 target.user.userid。其他所有標頭都會以鍵/值組合的形式新增至 target.resource.attribute.labels。
httpRequest.httpMethod network.http.method 直接對應至 network.http.method。
httpRequest.requestId network.session_id 直接對應至 network.session_id。
httpRequest.uri target.url 直接對應至 target.url。
httpSourceId target.resource.name 直接對應至 target.resource.name。
httpSourceName metadata.product_event_type 直接對應至 metadata.product_event_type。
標籤 security_result.rule_labels 逐一疊代 labels 中的每個標籤。如果標籤名稱不為空白,系統會將其新增為鍵/值組合至 security_result.rule_labels。
nonTerminatingMatchingRules security_result.action_details、security_result.rule_labels 逐一疊代 nonTerminatingMatchingRules 中的每項規則。如果動作為 ALLOW 且規則動作為 CAPTCHA,請將 security_result.action_details 設為「CAPTCHA SUCCESSFUL」,並使用「nonTerminatingCaptchaRuleName」鍵將規則 ID 新增至 security_result.rule_labels。如果動作為 BLOCK 或 ALLOW,且規則動作為 COUNT,請將 security_result.action_details 設為「COUNT RULE」,並使用「nonTerminatingCountRuleName」鍵,將規則 ID 新增至 security_result.rule_labels。如果動作為 BLOCK 或 ALLOW,且規則動作為 CHALLENGE,請將 security_result.action_details 設為「COUNT RULE」,並在 security_result.rule_labels 中新增規則 ID,金鑰為「nonTerminatingChallengeRuleName」。
rateBasedRuleList security_result.rule_id、security_result.rule_name、security_result.description 如果 terminatingRuleType 為「RATE_BASED」,則會逐一疊代 rateBasedRuleList 中的每項規則。如果 terminatingRuleId 與規則名稱相符,規則 ID、規則名稱和說明會分別對應至 security_result.rule_id、security_result.rule_name 和 security_result.description。
responseCodeSent network.http.response_code 直接對應至 network.http.response_code,並轉換為整數。
ruleGroupList intermediary.labels、security_result.rule_id、security_result.rule_name、security_result.description、security_result.detection_fields 逐一疊代 ruleGroupList 中的每個規則群組。系統會將規則群組 ID 以鍵/值組合的形式新增至 intermediary.labels。如果 terminatingRuleType 為「MANAGED_RULE_GROUP」,且 terminatingRuleId 與規則群組 ID 相符,則規則 ID、規則名稱和說明會分別對應至 security_result.rule_id、security_result.rule_name 和 security_result.description。如果 terminatingRuleType 為「GROUP」,系統會擷取終止規則 ID,並對應至 security_result.rule_name 和 security_result.description。終止規則群組 ID 會新增至 security_result.rule_labels,並以「terminatingRuleGroupName」做為鍵。如果 terminatingRuleType 為「REGULAR」,系統會擷取終止規則動作,並新增至 security_result.detection欄位,鍵為「terminatingRuleAction{index}」。
terminatingRuleId security_result.rule_id、security_result.rule_name、security_result.description 如果 terminatingRuleType 為「RATE_BASED」、「MANAGED_RULE_GROUP」或「REGULAR」,terminatingRuleId 會對應至 security_result.rule_id、security_result.rule_name,並用於建構 security_result.description。
terminatingRuleMatchDetails security_result.description、security_result.category_details、security_result.detection_fields 疊代處理 terminatingRuleMatchDetails 中的每個相符項目。將 security_result.description 設為「Terminating Rule」。如果條件類型不是空白,系統會將其新增至 security_result.category_details。如果位置資訊不為空白,系統會將其新增至 security_result.detection_fields,並使用「location」鍵。系統會將每個相符的資料元素新增至 security_result.detection_fields,並以「matchedData」做為鍵。
terminatingRuleType security_result.rule_type 直接對應至 security_result.rule_type。
時間戳記 metadata.event_timestamp 轉換為時間戳記,並對應至 metadata.event_timestamp。
webaclId intermediary.resource.name 直接對應至 intermediary.resource.name。
metadata.vendor_name 設為「AMAZON」。
metadata.product_name 設為「AWS 網頁應用程式防火牆」。
metadata.log_type 設為「AWS_WAF」。
network.application_protocol 設為「HTTP」。
metadata.event_type 如果 httpRequest.headers 包含「host」或「Host」標頭,請設為「NETWORK_HTTP」。否則請設為「STATUS_UPDATE」。

變更記錄

查看這個剖析器的變更記錄

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