From 8b0888cfa6dc93ae6f5bd3a1cdfff34026129dd1 Mon Sep 17 00:00:00 2001 From: George Liu Date: Fri, 6 Mar 2020 13:05:22 +1000 Subject: [PATCH] Install & config tools/csfcsf.sh auto cronjob by default in 123.09beta01 For fresh Centmin Mod 123.09beta01 and newer initial installs automatically configure /usr/local/src/centminmod/tools/csfcf.sh auto cronjob to update Cloudflare IP whitelisting in CSF Firewall instead of relying on folks to manually do it https://community.centminmod.com/threads/6241/. This has no harm or ill effects for folks who do not use Cloudflare anyway so might as well set it up by default and save folks one extra manual step for each Centmin Mod installation. You can verify it's properly setup cronjob via SSH command listing your cronjobs via: crontab -l --- centmin.sh | 5 ++++- inc/csfinstall.inc | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/centmin.sh b/centmin.sh index 1a84f5e89..ba3bcb2d1 100755 --- a/centmin.sh +++ b/centmin.sh @@ -27,7 +27,7 @@ DT=$(date +"%d%m%y-%H%M%S") branchname='123.09beta01' SCRIPT_MAJORVER='1.2.3' SCRIPT_MINORVER='09' -SCRIPT_INCREMENTVER='449' +SCRIPT_INCREMENTVER='450' SCRIPT_VERSIONSHORT="${branchname}" SCRIPT_VERSION="${SCRIPT_VERSIONSHORT}.b${SCRIPT_INCREMENTVER}" SCRIPT_DATE='29/02/2020' @@ -2212,6 +2212,9 @@ incmemcachedinstall echo "csfinstalls" csfinstalls +echo "csfcron_setup" +csfcron_setup + echo "siegeinstall" siegeinstall diff --git a/inc/csfinstall.inc b/inc/csfinstall.inc index cc17144bf..6d5259bd8 100644 --- a/inc/csfinstall.inc +++ b/inc/csfinstall.inc @@ -1,3 +1,15 @@ +csfcron_setup() { + if [[ -f /usr/local/src/centminmod/tools/csfcf.sh && -f /etc/csf/csf.conf && "$(csf -l >/dev/null 2>&1; echo $?)" -eq '0' ]]; then + # if CSF Firewall exists and running ensure Cloudflare IP updater cronjob + # is setup and whitelisted in CSF Firewall for new Centmin Mod initial installs + # https://community.centminmod.com/threads/6241/ + crontab -l > cronjoblist + sed -i '/csfcf.sh/d' cronjoblist + echo "22 */12 * * * /usr/local/src/centminmod/tools/csfcf.sh auto >/dev/null 2>&1" >> cronjoblist + crontab cronjoblist + fi +} + csf_maxmind_geolite_two_download() { csf_maxmind_silent=$1 if [[ -f /etc/csf/csf.conf && -d /var/lib/csf/ ]] && [[ ! -f /var/lib/csf/Geo/GeoLite2-Country-Blocks-IPv4.csv || ! -f /var/lib/csf/Geo/GeoLite2-Country-Blocks-IPv6.csv || ! -f GeoLite2-Country-Locations-en.csv ]]; then