ENHANCEMENT: Improve multi-platform compatibility for scanner installation

IMPROVED:
- Maldet: Try HTTPS first (secure), fallback to HTTP if needed
- ClamAV: Added explicit Plesk detection and handling
- apt-get: Better package update and installation feedback
- Better error message formatting for Debian/Ubuntu systems
- Improved rpm command error suppression (add 2>/dev/null)

COMPATIBILITY:
- cPanel: Uses cPanel-specific RPM method when available
- Plesk: Now properly detected and uses standard package manager
- RHEL/CentOS: Uses yum package manager
- Debian/Ubuntu: Uses apt-get with proper error handling
- InterWorx: Falls back to standard package manager methods
- Standalone: Works with any available package manager
This commit is contained in:
cschantz
2026-03-21 01:55:55 -04:00
parent 655bf18f91
commit 92da267f4c
+24 -6
View File
@@ -215,18 +215,33 @@ install_all_scanners() {
if ! is_clamav_installed; then
echo -e "${CYAN}[1/4] Installing ClamAV...${NC}"
# Try control panel-specific methods first
if [ -f "/usr/local/cpanel/cpanel" ]; then
# cPanel method - check if already installed but not configured
if rpm -qa | grep -q "cpanel-clamav"; then
# cPanel method
if rpm -qa 2>/dev/null | grep -q "cpanel-clamav"; then
echo -e "${GREEN}✓ ClamAV already installed (cPanel)${NC}"
else
/scripts/update_local_rpm_versions --edit target_settings.clamav installed 2>/dev/null || true
/scripts/check_cpanel_rpms --fix --targets=clamav 2>&1 | grep -E "Installing|Updating|up to date" || true
fi
elif [ -f "/usr/local/psa/version" ]; then
# Plesk method - use standard package manager
echo " → Detected Plesk system, using standard package manager..."
if command -v yum &>/dev/null; then
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Updating|already installed" || true
elif command -v apt-get &>/dev/null; then
apt-get update 2>&1 | grep -E "Reading|Building|Hit|Get" | head -3 || true
apt-get install -y clamav clamav-daemon 2>&1 | grep -E "Setting up|already|newest" || true
fi
elif command -v yum &>/dev/null; then
# RHEL/CentOS based systems
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Updating|already installed" || true
elif command -v apt-get &>/dev/null; then
apt-get update && apt-get install -y clamav clamav-daemon || true
# Debian/Ubuntu: Update package list first, then install ClamAV
echo " → Updating package list..."
apt-get update 2>&1 | grep -E "Reading|Building|Hit|Get" | head -3 || true
echo " → Installing ClamAV..."
apt-get install -y clamav clamav-daemon 2>&1 | grep -E "Setting up|already|newest" || true
fi
if is_clamav_installed; then
@@ -262,9 +277,12 @@ install_all_scanners() {
# Download Maldet
echo " → Downloading Maldet..."
if ! wget -q http://www.rfxn.com/downloads/maldetect-current.tar.gz; then
echo -e "${RED}✗ Download failed - check internet connectivity${NC}"
return 1
# Try HTTPS first (more secure), fallback to HTTP if needed
if ! wget -q https://www.rfxn.com/downloads/maldetect-current.tar.gz 2>/dev/null; then
if ! wget -q http://www.rfxn.com/downloads/maldetect-current.tar.gz; then
echo -e "${RED}✗ Download failed - check internet connectivity${NC}"
return 1
fi
fi
if [ -f maldetect-current.tar.gz ]; then