Created
September 9, 2018 09:22
-
-
Save antipatico/3bc4cc2769ba4e16951e39ca468e8572 to your computer and use it in GitHub Desktop.
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 | |
# Created by antipatico (antipatico.ml) | |
# Download the latest cloudflare's IPv4 ranges and create an ipset | |
# named "cloudflare" you can later use in your iptables rules. | |
IPSV4=$(mktemp) | |
wget --quiet -O $IPSV4 https://www.cloudflare.com/ips-v4 | |
ipset destroy cloudflare | |
ipset create cloudflare hash:net | |
while read -r range; do | |
ipset add cloudflare $range | |
done < $IPSV4 | |
rm $IPSV4 | |
ipset list cloudflare | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment