Edit file File name : a2_csf_modsecsync.mvps.mdedi Content :#!/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 Save