Protect a proxy with AWS WAF
Elastic Load Balancing for Envoy (ELB for Envoy) can inspect the traffic that passes through a proxy with an AWS WAF web ACL. You bring your own web ACL and associate it with the proxy. ELB for Envoy never creates, owns, or deletes a web ACL for you.
Associating an AWS WAF web ACL with a proxy is optional. A proxy runs without a web ACL until you associate one. You associate or change the web ACL in the console, either in the create wizard at the Add service integrations step (see Associate a web ACL when you create a proxy) or later on the proxy's Integrations tab (see Associate or change the web ACL after creation). This chapter covers the association lifecycle, how inspection works, and the attributes that control it.
Topics
Run a proxy without a web ACL
A proxy without a web ACL transitions to active after infrastructure
provisioning completes. AWS WAF does not gate the status.
To confirm that a proxy has no web ACL, read its attributes and check that
waf.web_acl_arn is empty.
aws elb-proxy get-proxy-attributes --proxy-identifier <proxy-arn>
Replace proxy-arn with the ARN of your proxy. An empty
waf.web_acl_arn value means that no web ACL is attached.
{ "attributes": [ { "key": "waf.web_acl_arn", "value": "" }, { "key": "waf.fail_open.enabled", "value": "false", "defaultValue": "false" }, { "key": "deletion_protection.enabled", "value": "false", "defaultValue": "false" }, ... ] }
The response lists every proxy attribute, in no fixed order. The examples on this page show the AWS WAF attributes.
Associate a web ACL when you create a proxy
To protect a proxy from the start, pass your web ACL ARN with the
waf.web_acl_arn attribute at create time. ELB for Envoy associates the web ACL
synchronously using your credentials.
Before you begin, you must have the wafv2:AssociateWebACL permission on the web
ACL resource.
Associate a web ACL at create time using the console, the AWS CLI, or CloudFormation. Choose the tab for the method that you want to use.
Associate or change the web ACL after creation
Associate a web ACL with the associate-web-acl command in AWS WAF, passing your proxy ARN. ELB for Envoy updates waf.web_acl_arn to the
new ARN. This works whether the proxy currently has no web ACL or an existing one. Any previous
association is replaced atomically.
Associate or change the web ACL using the console, the AWS CLI, or CloudFormation. Choose the tab for the method that you want to use.
View the web ACL for a proxy
View the web ACL associated with a proxy using the console or the AWS CLI. Choose the tab for the method that you want to use.
List the proxies that use a web ACL
You can list the proxies associated with a web ACL from the AWS WAF side.
Remove the web ACL from a proxy
The proxy console has no action to remove a web ACL. Remove the association from the AWS WAF console, or with the disassociate-web-acl command. ELB for Envoy
clears waf.web_acl_arn, and your web ACL is untouched. ELB for Envoy never deletes a
customer web ACL.
Deleting a proxy does not affect your web ACL. ELB for Envoy removes only the association, and your web ACL remains in your account.
The reverse is blocked. While a web ACL is associated with a proxy, AWS WAF refuses to delete the web ACL (WAFAssociatedItemException).
Disassociate it from the proxy first.
Allow traffic when AWS WAF is unavailable
By default, the proxy blocks requests when AWS WAF is unavailable. To let
traffic through instead, set the waf.fail_open.enabled attribute to
true.
When fail open is enabled, requests pass through uninspected if AWS WAF is unavailable.
Change this behavior using the console or the AWS CLI. Choose the tab for the method that you want to use.
How AWS WAF inspection works
When you associate a web ACL, ELB for Envoy performs AWS WAF inspection inside your Envoy data plane. You do not modify your configuration to enable it. ELB for Envoy makes the following changes:
-
Inserts an AWS WAF filter into the
http_filterschain of everyHttpConnectionManagerin your configuration, immediately before the final router filter. The filter inspects requests after your own HTTP filters run. This applies to connection managers in your bootstrap configuration and to those delivered over xDS. -
Adds a cluster for the AWS WAF data plane to your static resources.
-
Places a TLS inspector listener filter, with JA3 and JA4 fingerprinting enabled, at the front of every listener's filter chain. If your configuration already declares a TLS inspector, ELB for Envoy replaces it with the fingerprinting-enabled one. ELB for Envoy sends the JA3 and JA4 fingerprints with each inspection request, so your web ACL rules can use them as match and aggregation keys.
For each HTTP request, the filter sends the request headers and up to the first 64 KB of the request body to AWS WAF for evaluation, and enforces the allow or block decision. If AWS WAF is unavailable, the proxy blocks requests by default. To let traffic through instead, see Allow traffic when AWS WAF is unavailable.
When no web ACL is associated, the filter stays inactive and adds no inspection step to your traffic.
AWS WAF inspection limitations
-
AWS WAF inspection applies to HTTP and HTTPS traffic handled by an
HttpConnectionManager. Traffic proxied by other network filters, for example plaintcp_proxy, is not inspected. -
HTTP/3 (QUIC) traffic cannot use JA3 and JA4 fingerprints with AWS WAF. The TLS inspector captures the fingerprints, and it sees only TCP connections.
-
Request body inspection is limited to the first 64 KB.
AWS WAF attributes reference
The following proxy attributes control AWS WAF protection. For how to view and change proxy attributes, see Proxy attributes.
| Attribute | Default | Description |
|---|---|---|
waf.web_acl_arn |
"" |
ARN of the associated web ACL. An empty value means that no web ACL is associated. Set it at create time, or change it with the AWS WAF associate-web-acl and disassociate-web-acl commands, not with update-proxy-attributes. |
waf.fail_open.enabled |
false |
Allow traffic when AWS WAF is unavailable. Change it with the update-proxy-attributes command. |