FIX: Update system-health-check.sh for true multi-platform support
CRITICAL FIXES: - Fixed $SYS_PANEL variable (should be $SYS_CONTROL_PANEL) in service checks - cPanel service check now works - Plesk service check now works - Added InterWorx service check (was missing) - Updated firewall recommendations to be platform-aware - cPanel: Recommends CSF - Plesk: Recommends Plesk built-in firewall - InterWorx: Recommends CSF or firewalld - Standalone: Generic firewall options This ensures system-health-check.sh now works correctly on all platforms.
This commit is contained in:
@@ -1183,7 +1183,7 @@ analyze_control_panel_services() {
|
|||||||
local panel_issues=""
|
local panel_issues=""
|
||||||
|
|
||||||
# Check cPanel services
|
# Check cPanel services
|
||||||
if [ "$SYS_PANEL" = "cpanel" ]; then
|
if [ "$SYS_CONTROL_PANEL" = "cpanel" ]; then
|
||||||
# Key cPanel services to check
|
# Key cPanel services to check
|
||||||
local cpanel_services=("cpanel" "whostmgrd" "cpsrvd" "tailwatchd" "dnsadmin")
|
local cpanel_services=("cpanel" "whostmgrd" "cpsrvd" "tailwatchd" "dnsadmin")
|
||||||
|
|
||||||
@@ -1206,13 +1206,22 @@ This affects control panel functionality" \
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Plesk services
|
# Check Plesk services
|
||||||
elif [ "$SYS_PANEL" = "plesk" ]; then
|
elif [ "$SYS_CONTROL_PANEL" = "plesk" ]; then
|
||||||
if ! systemctl is-active --quiet psa 2>/dev/null; then
|
if ! systemctl is-active --quiet psa 2>/dev/null; then
|
||||||
add_issue "HIGH" "PLESK - Panel service down" \
|
add_issue "HIGH" "PLESK - Panel service down" \
|
||||||
"Plesk service is not running" \
|
"Plesk service is not running" \
|
||||||
"Restart Plesk: systemctl restart psa" \
|
"Restart Plesk: systemctl restart psa" \
|
||||||
85
|
85
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check InterWorx services
|
||||||
|
elif [ "$SYS_CONTROL_PANEL" = "interworx" ]; then
|
||||||
|
if ! systemctl is-active --quiet iworx 2>/dev/null; then
|
||||||
|
add_issue "HIGH" "INTERWORX - Panel service down" \
|
||||||
|
"InterWorx service is not running" \
|
||||||
|
"Restart InterWorx: systemctl restart iworx" \
|
||||||
|
85
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check web server
|
# Check web server
|
||||||
@@ -1397,14 +1406,31 @@ Server may not be properly protected" \
|
|||||||
|
|
||||||
# Warn if no firewall detected
|
# Warn if no firewall detected
|
||||||
if [ "$firewall_active" -eq 0 ]; then
|
if [ "$firewall_active" -eq 0 ]; then
|
||||||
|
local firewall_recommendation=""
|
||||||
|
|
||||||
|
if [ "$SYS_CONTROL_PANEL" = "cpanel" ]; then
|
||||||
|
firewall_recommendation="CSF (ConfigServer Firewall) is recommended for cPanel:
|
||||||
|
cd /usr/src && wget https://download.configserver.com/csf.tgz
|
||||||
|
tar -xzf csf.tgz && cd csf && sh install.sh"
|
||||||
|
elif [ "$SYS_CONTROL_PANEL" = "plesk" ]; then
|
||||||
|
firewall_recommendation="Plesk includes built-in firewall. Enable it:
|
||||||
|
- Log in to Plesk → Tools & Settings → Firewall
|
||||||
|
- Or use the system firewall (firewalld/iptables)"
|
||||||
|
elif [ "$SYS_CONTROL_PANEL" = "interworx" ]; then
|
||||||
|
firewall_recommendation="InterWorx supports CSF or system firewall:
|
||||||
|
- CSF: cd /usr/src && wget https://download.configserver.com/csf.tgz
|
||||||
|
- Or enable firewalld: systemctl enable --now firewalld"
|
||||||
|
else
|
||||||
|
firewall_recommendation="Enable firewalld or install CSF:
|
||||||
|
- firewalld: systemctl enable --now firewalld
|
||||||
|
- CSF: cd /usr/src && wget https://download.configserver.com/csf.tgz"
|
||||||
|
fi
|
||||||
|
|
||||||
add_issue "HIGH" "FIREWALL - No active firewall detected" \
|
add_issue "HIGH" "FIREWALL - No active firewall detected" \
|
||||||
"No firewall found (CSF, iptables, firewalld)
|
"No firewall found (CSF, iptables, firewalld, Plesk)
|
||||||
Server is exposed to attacks" \
|
Server is exposed to attacks" \
|
||||||
"Install and configure a firewall:
|
"Install and configure a firewall:
|
||||||
• CSF (recommended for cPanel):
|
• $firewall_recommendation" \
|
||||||
cd /usr/src && wget https://download.configserver.com/csf.tgz
|
|
||||||
tar -xzf csf.tgz && cd csf && sh install.sh
|
|
||||||
• Or enable firewalld: systemctl enable --now firewalld" \
|
|
||||||
82
|
82
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user