https://github.com/jerryzj/gcp_firewall
Automatically generate GCP shell commands to set firewall that blocks ingress from certain region
https://github.com/jerryzj/gcp_firewall
automation firewall-rules gcp gcp-compute gcp-firewall
Last synced: about 1 month ago
JSON representation
Automatically generate GCP shell commands to set firewall that blocks ingress from certain region
- Host: GitHub
- URL: https://github.com/jerryzj/gcp_firewall
- Owner: jerryzj
- License: mit
- Created: 2020-10-27T06:49:32.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-17T08:54:36.000Z (about 4 years ago)
- Last Synced: 2023-03-09T23:26:34.793Z (over 3 years ago)
- Topics: automation, firewall-rules, gcp, gcp-compute, gcp-firewall
- Language: C++
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.ip2location.com/free/visitor-blocker), 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
```shell
mkdir build && cd build
cmake .. -G Ninja
ninja
```
## 3. Run and generate commands
```shell
./command_generator -i (input ip list) -id (GCP project id)
```
## 4. Run the generated file in GCP cloud shell
```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.