Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Web ACL (WAF) attachment on ELBv2/ELBv1 #209

Closed
hobietje opened this issue Oct 13, 2021 · 5 comments · Fixed by #226
Closed

Web ACL (WAF) attachment on ELBv2/ELBv1 #209

hobietje opened this issue Oct 13, 2021 · 5 comments · Fixed by #226
Assignees
Labels
enhancement New feature or request

Comments

@hobietje
Copy link

We would like to audit whether our ELBv2/ELBv1 have a WAFv2 attached or not. The aws_elbv2_load_balancers and aws_elbv2_load_balancer_atributes tables currently do not include this information. There similarly isn't a table listing all Web ACL attachments.

It appears a separate API call is needed to determine whether a Web ACL is attached:
https://docs.aws.amazon.com/cli/latest/reference/waf-regional/get-web-acl-for-resource.html

Can this please be added?

@yevgenypats yevgenypats added the enhancement New feature or request label Oct 17, 2021
@roneli roneli assigned zagronitay and amanenk and unassigned zagronitay Oct 19, 2021
@amanenk
Copy link
Contributor

amanenk commented Oct 19, 2021

Hi there.

I have just ran a short test.
There is a resources_for_web_acl column in aws_wafv2_web_acls table that should contain all resources ARNs linked to Web ACL.

@hobietje
Copy link
Author

Thanks @fdistorted, I missed that. I can see ALBs but not ELBs, CF Distributions or API Gateways... could be due to those mappings not existing in my AWS environment though. Do you know if those should be included?

@amanenk
Copy link
Contributor

amanenk commented Oct 26, 2021

As I see from the documentation list-resources-for-web-acl support --resource-type parameter which can be APPLICATION_LOAD_BALANCER or API_GATEWAY.
get-web-acl-for-resource wants --resource-arn in next formats arn:aws:elasticloadbalancing:region :account-id :loadbalancer/app/load-balancer-name/load-balancer-id and arn:aws:apigateway:region ::/restapis/api-id /stages/stage-name

Let me try some other resource type to check if it works.

@amanenk
Copy link
Contributor

amanenk commented Oct 26, 2021

I have tried to associate different resources but only APPLICATION_LOAD_BALANCER or API_GATEWAY can be mapped to web_acl. Also I have noticed an interesting behavior. list-resources-for-web-acl does not list API_GATEWAYs but get-web-acl-for-resource confirms that api gateway is linked to web_acl. It seems that we need to implement web_acl column in some api gateways and load balancers

@amanenk
Copy link
Contributor

amanenk commented Oct 26, 2021

After short investigation I have found out that aws_apigateway_rest_api_stages already has a web_acl_arn column. I have made a PR to add such a column to aws_elbv2_load_balancers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants