Skip to content

Instantly share code, notes, and snippets.

@numanturle
Created April 18, 2020 13:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numanturle/1726dc0886885ed4f9d2c42c07b5713b to your computer and use it in GitHub Desktop.
Save numanturle/1726dc0886885ed4f9d2c42c07b5713b to your computer and use it in GitHub Desktop.
web server only cloudflare
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done;
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done;
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP;
ip6tables -A INPUT -p tcp -m multiport --dports http,https -j DROP;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment