Skip to content

Instantly share code, notes, and snippets.

@HitLuca
Last active July 28, 2022 13:54
Show Gist options
  • Save HitLuca/ddceb8634a8bebb6475f03f79d6842f9 to your computer and use it in GitHub Desktop.
Save HitLuca/ddceb8634a8bebb6475f03f79d6842f9 to your computer and use it in GitHub Desktop.
Outputs a series of ufw rules that enable external access from legitimate Cloudflare ips to port 443
#!/bin/sh
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-v4-$$.tmp`; do echo "sudo ufw allow from $cfip to any port 443 proto tcp comment 'Cloudflare ipv4'"; done
for cfip in `cat ips-v6-$$.tmp`; do echo "sudo ufw allow from $cfip to any port 443 proto tcp comment 'Cloudflare ipv6'"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment