Last active
March 27, 2023 09:22
-
-
Save AlexanderMatveev/0fef4ece27f57c1f17fd91c2ad478674 to your computer and use it in GitHub Desktop.
Whitelist Cloudflare with ufw
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 | |
for x in $(curl https://www.cloudflare.com/ips-v4) | |
do | |
ufw allow proto tcp from $x to any port 80,443 comment "cf4 $(date '+%Y-%m-%d')" | |
done | |
for x in $(curl https://www.cloudflare.com/ips-v6) | |
do | |
ufw allow proto tcp from $x to any port 80,443 comment "cf6 $(date '+%Y-%m-%d')" | |
done | |
ufw status numbered |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment