diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index 12e1533..b201947 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -476,8 +476,8 @@ install_all_scanners() { # Debian/Ubuntu - universe repo (rkhunter is in universe) echo " → Ensuring universe repository is enabled..." if ! grep -q "universe" /etc/apt/sources.list 2>/dev/null; then - # Add universe to existing deb lines correctly - sed -i 's/^deb http\(.*\) \(main\|restricted\)$/deb http\1 \2 universe/' /etc/apt/sources.list 2>/dev/null || true + # Add universe to existing deb lines (handles both HTTP and HTTPS) + sed -i 's/^\(deb.*\) \(main\|restricted\)$/\1 \2 universe/' /etc/apt/sources.list 2>/dev/null || true apt-get update 2>&1 | grep -E "Hit|Get|Reading|Building" | head -3 || true fi apt-get install -y rkhunter 2>&1 | grep -E "Setting up|already|newest" || echo " (installation may already be complete)" @@ -488,13 +488,19 @@ install_all_scanners() { # Update definitions echo " → Updating rootkit definitions..." - rkhunter --update 2>&1 | grep -E "updated|downloaded" || rkhunter --update &>/dev/null - echo -e " ${GREEN}✓${NC} Definitions updated" + if timeout 120 rkhunter --update 2>&1 | grep -qE "updated|downloaded"; then + echo -e " ${GREEN}✓${NC} Definitions updated" + else + echo -e " ${YELLOW}⚠${NC} Definitions update inconclusive (continuing)" + fi # Initialize baseline (propupd creates file property database) echo " → Initializing baseline database..." - rkhunter --propupd &>/dev/null - echo -e " ${GREEN}✓${NC} Baseline initialized" + if timeout 300 rkhunter --propupd 2>&1 | grep -q "Updating" || timeout 300 rkhunter --propupd &>/dev/null; then + echo -e " ${GREEN}✓${NC} Baseline initialized" + else + echo -e " ${YELLOW}⚠${NC} Baseline initialization inconclusive" + fi else echo -e "${RED}✗ Rootkit Hunter installation failed${NC}" fi