| Server IP : 172.67.157.124 / Your IP : 216.73.216.213 Web Server : LiteSpeed System : Linux s12482.usc1.stableserver.net 5.14.0-570.32.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 6 11:30:41 EDT 2025 x86_64 User : snownico ( 1231) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
#
# Ensure CSF and Modsec are in sync - OPSPROJ-8
imunify360_binary="/usr/sbin/imunify360-webshield"
# Skip unsupported (MWP) Plesk type servers
if [ -f /sbin/plesk ]; then
exit
fi
# CSF is not supported if Imunify360 is installed.
if [ -f "${imunify360_binary}" ]; then
exit
fi
# CSF may be unmanaged - SYSENG-14499
if [ -f /opt/csf_unmanaged ]; then
echo "OK - unmanaged"
exit 0
fi
cmk_name="csfmodsec_sync"
csf_sync="/etc/csf/a2_sync"
modsec_sync="/etc/apache2/conf.d/modsec/a2_sync"
cfm_get_status=$(/opt/bin/cfm_control status)
cfm_type=$(echo ${cfm_get_status} | awk '{print $2}' | sed 's/://')
if echo "${cfm_get_status}" | grep -q active; then
exit_status=2
cfm_status="active"
else
exit_status=1
cfm_status="downtimed"
fi
if [ -f ${csf_sync} ] && [ -f ${modsec_sync} ]; then
echo "CSF and Modsec is in sync"
exit 0
elif [ ! -f ${csf_sync} ] && [ -f ${modsec_sync} ]; then
echo "CSF is not in sync and ${cfm_type} is ${cfm_status}"
exit ${exit_status}
elif [ -f ${csf_sync} ] && [ ! -f ${modsec_sync} ]; then
echo "Modsec is not in sync and ${cfm_type} is ${cfm_status}"
exit ${exit_status}
elif [ ! -f ${csf_sync} ] && [ ! -f ${modsec_sync} ]; then
echo "CSF and Modsec is not in sync and ${cfm_type} is ${cfm_status}"
exit ${exit_status}
fi