Created
October 22, 2018 14:11
-
-
Save eaguad1337/59cb07d1d21421245082b87878182a8e to your computer and use it in GitHub Desktop.
UFW Whitelist Cloudflare
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/sh | |
# @author Eduardo Aguad <[email protected]> | |
cd /tmp | |
wget https://www.cloudflare.com/ips-v4 -O ips-v4-$$.tmp | |
wget https://www.cloudflare.com/ips-v6 -O ips-v6-$$.tmp | |
for cfip in `cat ips-v6-$$.tmp`; do ufw allow from $cfip to any port 443 proto tcp; done | |
for cfip in `cat ips-v4-$$.tmp`; do ufw allow from $cfip to any port 443 proto tcp; done | |
for cfip in `cat ips-v4-$$.tmp`; do ufw allow from $cfip to any port 80 proto tcp; done | |
for cfip in `cat ips-v6-$$.tmp`; do ufw allow from $cfip to any port 80 proto tcp; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment