Created
August 6, 2018 00:44
-
-
Save lmlsna/442bba9aad729c80c55dffe3a4612502 to your computer and use it in GitHub Desktop.
Allow fresh cloudflare IPs via 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 | |
iptables -A INPUT -p tcp -m multiport --dports 80,443 -s $(curl -sSL --tlsv1.2 'https://www.cloudflare.com/ips-v4' | xargs | sed 's/ /,/g') -j ACCEPT | |
iptables -A INPUT -p tcp -m multiport --dports 80,443 -j REJECT --reject-with tcp-reset | |
ip6tables -A INPUT -p tcp -m multiport --dports 80,443 -s $(curl -sSL --tlsv1.2 'https://www.cloudflare.com/ips-v6' | xargs | sed 's/ /,/g') -j ACCEPT | |
ip6tables -A INPUT -p tcp -m multiport --dports 80,443 -j REJECT --reject-with tcp-reset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment