Skip to content

Commit 2df2d28

Browse files
authored
Create create-acl-blocklists.md
Using a list we can create a rudimentary blocklist instead of paying for a WAF. YMMV
1 parent e5985c9 commit 2df2d28

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

aws-cli/create-acl-blocklists.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Simple script to modify your VPC ACL to block a list of subnets, such as... say a country?
2+
## Assumptions:
3+
4+
You need to make sure you move your default ALLOW rule from the standard 100
5+
to something like 10000. (Maximum number of 32766 as defined by [vpc-acl aws docs](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html)
6+
As with standard firewalls they read top to bottom, so if you block a country, your allow is 100,
7+
and their list is 8000+
8+
9+
```
10+
id=1; ACL=aclid; ACTION="deny"; list=your-list-of-subnets-one-per-line.txt;
11+
while read block; do
12+
aws ec2 create-network-acl-entry --cidr-block "$block" --ingress --network-acl-id "$ACL" --protocol -1 --rule-action $ACTION --rule-number $id;
13+
echo "$ACTION: $BLOCK with id: $id"
14+
((id++));
15+
sleep 1;
16+
done < $list
17+
```

0 commit comments

Comments
 (0)