Forked from jhoelzel/gist:1c015e667c162fc8f3f3712b1c6417c5
Created
March 1, 2023 13:19
-
-
Save Hadryan/0ecd63eb3f4c42aa51602725303e9d54 to your computer and use it in GitHub Desktop.
iptables / ip6tables allow only cloudflare IPs to acces our server
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
# https://www.cloudflare.com/ips | |
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables- | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment