Description
Associating a web ACL with CloudFront lets AWS WAF inspect HTTP and HTTPS requests. Its rules and default action determine which requests are blocked.
Potential impact
Requests sent directly to the origin bypass this CloudFront web ACL.
Remediation
Set web_acl_id to the ARN of a CLOUDFRONT-scope WAFv2 web ACL in us-east-1. Check WAF metrics and, if request logging is enabled on the web ACL, its logs for the effect on legitimate traffic. Restrict direct origin access where needed and keep application authentication and security fixes in place.
Examples
Both tasks illustrate creating a distribution. Supply the real origin. To update an existing distribution, omit default_origin_domain_name and identify the distribution, for example by distribution_id.
Before
- name: Create a CloudFront distribution
community.aws.cloudfront_distribution:
state: present
default_origin_domain_name: www.my-cloudfront-origin.com
After
- name: Create a CloudFront distribution
community.aws.cloudfront_distribution:
state: present
default_origin_domain_name: www.my-cloudfront-origin.com
web_acl_id: "{{ cloudfront_web_acl_arn }}"
The second task associates the existing web ACL named by cloudfront_web_acl_arn. Configure managed and service-specific rules on that ACL.