AWS WAF
Collect AWS WAF metrics. This integration uses the WAFv2 API and script ID integration_aws_wafv2.
Configuration¶
Permissions¶
For AWS cloud collection permissions, see AWS cloud integration role authorization. The read-only permissions required by this integration are listed below.
wafv2:ListWebACLs: Get WAF Web ACL list.wafv2:GetWebACL: Get WAF Web ACL details.tag:GetResources: Read resource tags through the shared tag collection module to supplement asset tags.cloudwatch:ListMetrics: Discover CloudWatch monitoring metrics and dimensions.cloudwatch:GetMetricData: Read in batches: CloudWatch monitoring metric data.
Install Func¶
We recommend enabling hosted Func under Integration - Extensions in Guance. All prerequisites are installed automatically; continue with the script installation.
If deploying Func manually, refer to Manual Deployment of Func
Install Script¶
Prepare AWS AK in advance and authorize access as described in Permissions.
Activate Scripts in Hosted Func¶
- Log in to the Guance console
- Click the 【Integration】 menu and select 【Cloud Account Management】
- Click 【Add Cloud Account】, select 【AWS】, and fill in the required information on the interface. If you have already configured the cloud account information before, ignore this step
- Click 【Test】, and if the test is successful, click 【Save】. If the test fails, please check if the relevant configuration information is correct and test again
- Click 【Cloud Account Management】, and you can see the added cloud account in the list. Click the corresponding cloud account to enter the details page
- Click 【Integration】 on the cloud account details page, find
AWS WAFin theNot Installedlist and click 【Install】 to open the installation form.
Manual Activation Script¶
-
Log in to the Func console, click 【Script Market】, open the Guance script market and search for
integration_aws_wafv2. -
Click 【Install】, then enter the corresponding parameters: AWS AK ID, AK Secret, and account name.
-
Click 【Deploy Startup Script】 to create the
Startupscript set and configure the corresponding startup scripts automatically. -
After enabling the script, open 【Management / Automatic Trigger Configuration】 to view its automatic trigger configuration. Click 【Execute】 to run it immediately without waiting for the scheduled time. After a short wait, review the task records and logs.
Verification¶
- Under 【Management / Automatic Trigger Configuration】, confirm that the task has an automatic trigger configuration. Review its task records and logs for errors.
- In Guance, check 【Infrastructure - Resource Catalog】 for asset information.
- In Guance, check 【Metrics】 for the corresponding monitoring data.
Metrics¶
AWS WAF Metrics are under the aws_AWS/WAFV2 Measurement. Below are descriptions of some metrics along with their units and statistical data.
| Metric | Description | Unit |
|---|---|---|
AllowedRequests |
Number of allowed web requests | count |
BlockedRequests |
Number of blocked web requests | count |
RequestsWithValidChallengeToken |
Number of web requests with a valid challenge token | count |
SampleBlockedRequest |
Number of sampled requests that executed a Block operation | count |
CaptchaRequests |
Number of web requests with CAPTCHA controls applied | count |
PassedRequests |
Number of passed requests. This is only used for requests that pass the rule group evaluation but do not match any rule group rules | count |
RequestsWithValidChallengeToken |
Number of web requests with a valid challenge token | count |
SampleAllowedRequest |
Number of sampled requests that executed an Allow operation | count |
SampleCaptchaRequest |
Number of sampled requests that executed a CAPTCHA operation | count |
SampleChallengeRequest |
Number of sampled requests that executed a Challenge operation | count |
SampleCountRequest |
Number of sampled requests that executed a Count operation | count |
Object¶
The collected AWS WAF object data structure can be viewed in "Infrastructure - Resource Catalog".
{
"measurement": "aws_wafv2",
"tags": {
"Id" : "91d10100-xxxxxxxxx-89fb90d1f566",
"ARN" : "arn:aws:wafv2:us-east-1:87626xxxxx4:regional/webacl/test-123/446cc7d0-d87e-xxxxxxxxxx",
"Capacity" : "CN",
"LabelNamespace" : "awswaf:87626xxxxx4:webacl:test-us-east-1:xxxxx",
"ManagedByFirewallManager" : "False",
"RegionId" : "ap-southeast-1"
},
"fields": {
"LockToken" : "6fe50442-fdfe-4dd5-ba54-5xxxxxxxxxxx",
"Description" : "test-123",
"AssociationConfig" : "{xxxxxxx}",
"CaptchaConfig" : "{xxxxxxx}",
"ChallengeConfig" : "{xxxxxxx}",
"CustomResponseBodies" : "xxxxxxx",
"DefaultAction" : "{"Allow": {}}",
"PostProcessFirewallManagerRuleGroups" : "Success",
"PreProcessFirewallManagerRuleGroups" : "{xxxxxxxx}",
"Rules" : "{Rules}",
"TokenDomains" : "xxxxxxxx",
"VisibilityConfig" : "{xxxxxxx}"
}
}
Note: The fields in
tagsandfieldsmay change with subsequent updates