Skip to content

Automatically generate GCP shell commands to set firewall that blocks ingress from certain region

License

Notifications You must be signed in to change notification settings

jerryzj/GCP_firewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCP_firewall

Automatically generate GCP shell commands to set firewall that blocks ingress from certain region

1. Get the latest IP blacklist

Get the latest IP list here, and choose the output format as CIDR.

2. Build command generator

Note that this program requires C++17 standard, make sure your compiler is not too old

mkdir build && cd build
cmake .. -G Ninja
ninja

3. Run and generate commands

./command_generator -i (input ip list) -id (GCP project id)

4. Run the generated file in GCP cloud shell

chmod +x block_china.sh
./block_china.sh

Notes

If you are updating firewall rules, make sure clear the old ones before adding the latest rules.

About

Automatically generate GCP shell commands to set firewall that blocks ingress from certain region

Topics

Resources

License

Stars

Watchers

Forks