Created
February 14, 2019 21:02
-
-
Save activeshadow/ff5a03b1c457334458514e1b35bac9b9 to your computer and use it in GitHub Desktop.
Remove AWS WAF ACLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACLS=$(aws waf list-web-acls | jq -r ".WebACLs[] | .WebACLId") | |
for acl in $ACLS; do | |
TOKEN=$(aws waf get-change-token | jq -r .ChangeToken) | |
RULE=$(aws waf get-web-acl --web-acl-id $acl | jq ".WebACL.Rules[0]") | |
aws waf update-web-acl --cli-input-json '{"WebACLId": "'$acl'", "ChangeToken": "'$TOKEN'", "Updates": [{"Action": "DELETE", "ActivatedRule": '"$RULE"'}]}' | |
TOKEN=$(aws waf get-change-token | jq -r .ChangeToken) | |
aws waf delete-web-acl --web-acl-id $acl --change-token $TOKEN | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment