

**推出 的新主控台體驗 AWS WAF**

您現在可以使用更新後的體驗，在主控台的任何位置存取 AWS WAF 功能。如需詳細資訊，請參閱[使用 主控台](https://docs.aws.amazon.com/waf/latest/developerguide/working-with-console.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# ATP 範例：針對遺失和洩露的登入資料進行自訂處理
<a name="waf-atp-control-example-user-agent-exception"></a>

根據預設，規則群組執行的登入資料檢查會`AWSManagedRulesATPRuleSet`處理 Web 請求，如下所示：
+ **缺少登入**資料 – 標記和封鎖請求。
+ **遭入侵的登入**資料 – 標記請求，但不封鎖或計數。

如需規則群組和規則行為的詳細資訊，請參閱 [AWS WAF 詐騙控制帳戶接管預防 (ATP) 規則群組](aws-managed-rule-groups-atp.md)。

您可以執行下列動作，為憑證遺失或遭到入侵的 Web 請求新增自訂處理：
+ **覆寫`MissingCredential`規則至 Count** – 此規則動作覆寫會導致規則僅計數和標記相符請求。
+ **使用自訂處理新增標籤比對規則** – 設定此規則以比對兩個 ATP 標籤，並執行您的自訂處理。例如，您可以將客戶重新導向至您的註冊頁面。

下列規則顯示先前範例中的 ATP 受管規則群組，規則`MissingCredential`動作會覆寫為計數。這會導致規則將其標籤套用至相符的請求，然後只計算請求，而不是封鎖請求。

```
"Rules": [
    {
        "Priority": 1,
        "OverrideAction": {
            "None": {}
        },
        "VisibilityConfig": {
            "SampledRequestsEnabled": true,
            "CloudWatchMetricsEnabled": true,
            "MetricName": "AccountTakeOverValidationRule"
        },
        "Name": "DetectCompromisedUserCredentials",
        "Statement": {
            "ManagedRuleGroupStatement": {
                "ManagedRuleGroupConfigs": [
                  {
                    "AWSManagedRulesATPRuleSet": {
                      "LoginPath": "/web/login",
                      "RequestInspection": {
                        "PayloadType": "JSON",
                        "UsernameField": {
                          "Identifier": "/form/username"
                        },
                        "PasswordField": {
                          "Identifier": "/form/password"
                        }
                      },
                      "EnableRegexInPath": false
                    }
                  }
                ]
                "VendorName": "AWS",
                "Name": "AWSManagedRulesATPRuleSet",
                "RuleActionOverrides": [
                  {
                    "ActionToUse": {
                      "Count": {}
                    },
                    "Name": "MissingCredential"
                  }
                ],
                "ExcludedRules": []
            }
        }
    }
],
```

使用此組態，當此規則群組評估任何缺少或洩露憑證的 Web 請求時，它會標記請求，但不會將其封鎖。

下列規則的優先順序設定在數值上高於上述規則群組。 會以數值順序 AWS WAF 評估規則，從最低開始，因此此規則會在規則群組評估之後進行評估。規則設定為符合其中一個登入資料標籤，並傳送相符請求的自訂回應。

```
"Name": "redirectToSignup",
      "Priority": 10,
      "Statement": {
        "OrStatement": {
          "Statements": [
            {
              "LabelMatchStatement": {
                "Scope": "LABEL",
                "Key": "awswaf:managed:aws:atp:signal:missing_credential"
              }
            },
            {
              "LabelMatchStatement": {
                "Scope": "LABEL",
                "Key": "awswaf:managed:aws:atp:signal:credential_compromised"
              }
            }
          ]
        }
      },
      "Action": {
        "Block": {
          "CustomResponse": {
             {{your custom response settings}} 
          }
        }
      },
      "VisibilityConfig": {
        "SampledRequestsEnabled": true,
        "CloudWatchMetricsEnabled": true,
        "MetricName": "redirectToSignup"
      }
```