Last active
January 29, 2025 12:31
-
Star
(166)
You must be signed in to star a gist -
Fork
(50)
You must be signed in to fork a gist
-
-
Save Manouchehri/cdd4e56db6596e7c3c5a to your computer and use it in GitHub Desktop.
Allow CloudFlare only
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
# Source: | |
# 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 | |
# Avoid racking up billing/attacks | |
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable. | |
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP | |
ip6tables -A INPUT -p tcp -m multiport --dports http,https -j DROP | |
# WARNING: This does NOT block Cloudflare's clients from accessing your website over HTTP or HTTPS with a Cloudflare Worker. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My life saver thx man i was facing DDos Attack on with 20milion request per hour