diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index 442509c..e0208ce 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -218,18 +218,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 @@ -265,9 +280,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