Auto Update IP Cloudflare Whitelist in my Server with CSF

Hello, I am using the CSF firewall on my server and would like it to auto update its whitelist from time to time with the new cloudlare IPs (which I also use) so that the server firewall does not block the cloudflare. Does anyone have any command that I can do this routine (even by crontab)? Thanks

#!/usr/bin/env bash

IPS=`curl -s https://www.cloudflare.com/ips-v4`
IPS+=`echo -e "\n" && curl -s https://www.cloudflare.com/ips-v6`

for ip in ${IPS}; do
  sudo csf -a $ip
done

sudo csf -r
3 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.