| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/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