CloudFlare IP range

Hello,

If you are using CloudFlare and have CSF (ConfigServer Firewall) installed on a VPS, I would suggest to add the following IP range to the CSF whitelist:

WHM > Plugins > ConfigServer Security & Firewall > Firewall Allow IP

# start of cloudflare ip range - added June 9th 2013 #
204.93.240.0/24
204.93.177.0/24
199.27.128.0/21
173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
# end of cloudflare ip range #

Source: https://www.cloudflare.com/ips
 
Hi Jean,

This is a great recommendation as if CSF blocks their IPs (which would be very possible with the kind of traffic you would see with CloudFlare) then the service would not work at all for you.

If I recall correctly I even had to add cPanel's update servers to the allow list at one point as everytime I would run an update it would block them lol
 
Yeah my list of CSF Allowed IP is pretty large with all the addons and auto-update we have. It can range from CloudFlare, Softaculous, PingDom, HyperSpin, eNom or whmcs licence server!

Keeping those firewall tight can be a full time job!

Ohh, I forgot KnownHost NOC IP's !!
 
I can't remember where I found this, but here is a script I run in cron to make sure the Pingdom probes are not blocked. I am sure this could be easily modified for Cloudflare or other services that publish their IPs publicly.

Code:
#!/bin/bash
# Update the pingdom firewall rules based on their feed
 
# rotate pingdom ip list (keep 8 days)
LIST=$(ls -r /root/pingdom_ips*);
for i in $LIST; do
    # get index of file
    INDEX=$(ls $i | cut -d"." -f 2)
 
    # if there's no index, rename to pingdom_ips.0
    if [ $INDEX = "/root/pingdom_ips" ]; then
        NEW=$INDEX.0
        mv $i $NEW
    # remove files with index > 6 (keep 8 files)
    elif [ $INDEX -gt 6 ]; then
        rm $i
    # increment index for all other files
    else
        BASE=$(ls $i | cut -d"." -f 1)
        NEW=$BASE.$(($INDEX+1))
        mv $i $NEW
    fi
done
 
# get pingdom ips from their rss feed
wget https://www.pingdom.com/rss/probe_servers.xml -O /root/probe_servers.xml -o /dev/null
cat /root/probe_servers.xml | grep IP | sed -e 's/.*IP: //g' | sed -e 's/; Host.*//g' | grep -v IP > /root/pingdom_ips
 
# if old lists do not exist, just allow all ips
if [ ! -f /root/pingdom_ips.0 ]; then
    cat /root/pingdom_ips | xargs -n 1 csf -a
else
    # if there any differences between previous and current list, replace ips in allow list
    if ! diff -q /root/pingdom_ips /root/pingdom_ips.0 > /dev/null; then
        cat /root/pingdom_ips.0 | xargs -n 1 csf -ar
        cat /root/pingdom_ips | xargs -n 1 csf -a
    fi
fi
 
Top