Created
December 15, 2016 13:12
-
-
Save ABeltramo/8f321c6cc3fa8c5267cc1f9a09e2f90f to your computer and use it in GitHub Desktop.
Cloudflare iptables
This file contains hidden or 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 | |
# Only once setup: | |
# iptables -N cloudflare | |
# iptables -t filter -I INPUT -j cloudflare -p tcp -m multiport --dports http,https | |
iptables -F cloudflare | |
for i in `curl https://www.cloudflare.com/ips-v4`; do | |
iptables -A cloudflare -p tcp -s $i -m multiport --dports domain,http,https -j ACCEPT; | |
done | |
iptables -A cloudflare -j RETURN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment