Just minor changes:
1.Open the file:
/etc/csf/csf.allow
2. Put the following line into the file:
Include /etc/csf/csf.hetrixtools.allow
3. Create and open the file /etc/cron.daily/hetrixtools_whitelist using your favorite text editor (vi,ee,nano, etc).
4. Put the following content into the file:
#!/bin/bash
wget -O /tmp/uptime-monitor-ips.txt https://hetrixtools.com/resources/uptime-monitor-ips.txt > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Can't download the file"
exit 1
fi
cat /tmp/uptime-monitor-ips.txt | awk '{print $2 ,"#", $1}' > /tmp/hetrixtools.ips
diff /etc/csf/csf.hetrixtools.allow /tmp/hetrixtools.ips > /dev/null 2>&1
error=$?
if [ $error -ne 0 ]
then
echo "files are different or some file absents"
cat /tmp/hetrixtools.ips > /etc/csf/csf.hetrixtools.allow
rm -f /tmp/hetrixtools.ips /tmp/uptime-monitor-ips.txt
csf -r
fi
5. Make the file executable:
chmod 755 /etc/cron.daily/hetrixtools_whitelist
The idea is the same. Additionally the script checks the exit code of "wget" to avoid strange behavior if the file can't be downloaded.