|
|
@@ -220,46 +220,61 @@ install_all_scanners() {
|
|
|
|
|
|
|
|
|
|
|
|
# Try control panel-specific methods first
|
|
|
|
# Try control panel-specific methods first
|
|
|
|
if [ -f "/usr/local/cpanel/cpanel" ]; then
|
|
|
|
if [ -f "/usr/local/cpanel/cpanel" ]; then
|
|
|
|
# cPanel method
|
|
|
|
# cPanel method - use cPanel's package management only
|
|
|
|
if rpm -qa 2>/dev/null | grep -q "cpanel-clamav"; then
|
|
|
|
if rpm -qa 2>/dev/null | grep -q "cpanel-clamav"; then
|
|
|
|
echo -e "${GREEN}✓ ClamAV already installed (cPanel)${NC}"
|
|
|
|
echo -e "${GREEN}✓ ClamAV already installed (cPanel)${NC}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
echo " → Installing via cPanel package manager..."
|
|
|
|
/scripts/update_local_rpm_versions --edit target_settings.clamav installed 2>/dev/null || true
|
|
|
|
/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
|
|
|
|
/scripts/check_cpanel_rpms --fix --targets=clamav 2>&1 | tail -3
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# IMPORTANT: Don't fall through to standard yum - cPanel packages conflict!
|
|
|
|
elif [ -f "/usr/local/psa/version" ]; then
|
|
|
|
elif [ -f "/usr/local/psa/version" ]; then
|
|
|
|
# Plesk method - use standard package manager
|
|
|
|
# Plesk method - use standard package manager
|
|
|
|
echo " → Detected Plesk system, using standard package manager..."
|
|
|
|
echo " → Detected Plesk system, using standard package manager..."
|
|
|
|
if command -v yum &>/dev/null; then
|
|
|
|
if command -v yum &>/dev/null; then
|
|
|
|
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Updating|already installed" || true
|
|
|
|
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Installed|already installed" || echo " (installation may already be complete)"
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
apt-get update 2>&1 | grep -E "Reading|Building|Hit|Get" | head -3 || true
|
|
|
|
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
|
|
|
|
apt-get install -y clamav clamav-daemon 2>&1 | grep -E "Setting up|already|newest" || echo " (installation may already be complete)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif command -v yum &>/dev/null; then
|
|
|
|
elif command -v yum &>/dev/null; then
|
|
|
|
# RHEL/CentOS based systems
|
|
|
|
# RHEL/CentOS based systems (non-cPanel)
|
|
|
|
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Updating|already installed" || true
|
|
|
|
echo " → Installing via yum..."
|
|
|
|
|
|
|
|
yum install -y clamav clamav-update 2>&1 | grep -E "Installing|Installed|already installed" || echo " (installation may already be complete)"
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
# Debian/Ubuntu: Update package list first, then install ClamAV
|
|
|
|
# Debian/Ubuntu: Update package list first, then install ClamAV
|
|
|
|
echo " → Updating package list..."
|
|
|
|
echo " → Updating package list..."
|
|
|
|
apt-get update 2>&1 | grep -E "Reading|Building|Hit|Get" | head -3 || true
|
|
|
|
apt-get update 2>&1 | grep -E "Reading|Building|Hit|Get" | head -3 || true
|
|
|
|
echo " → Installing ClamAV..."
|
|
|
|
echo " → Installing ClamAV..."
|
|
|
|
apt-get install -y clamav clamav-daemon 2>&1 | grep -E "Setting up|already|newest" || true
|
|
|
|
apt-get install -y clamav clamav-daemon 2>&1 | grep -E "Setting up|already|newest" || echo " (installation may already be complete)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if is_clamav_installed; then
|
|
|
|
if is_clamav_installed; then
|
|
|
|
echo -e "${GREEN}✓ ClamAV installed${NC}"
|
|
|
|
echo -e "${GREEN}✓ ClamAV installed${NC}"
|
|
|
|
|
|
|
|
|
|
|
|
# Find freshclam binary
|
|
|
|
# Find freshclam binary - try standard locations first before using find
|
|
|
|
local freshclam_bin=$(command -v freshclam || find /usr -name freshclam 2>/dev/null | head -1)
|
|
|
|
local freshclam_bin=""
|
|
|
|
|
|
|
|
for path in /usr/bin/freshclam /usr/sbin/freshclam \
|
|
|
|
|
|
|
|
/usr/local/bin/freshclam /usr/local/sbin/freshclam \
|
|
|
|
|
|
|
|
/usr/local/cpanel/3rdparty/bin/freshclam; do
|
|
|
|
|
|
|
|
if [ -x "$path" ]; then
|
|
|
|
|
|
|
|
freshclam_bin="$path"
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# Only use find as last resort if standard paths don't work
|
|
|
|
|
|
|
|
if [ -z "$freshclam_bin" ]; then
|
|
|
|
|
|
|
|
freshclam_bin=$(find /usr/local /usr -name freshclam -type f 2>/dev/null | head -1)
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Update virus signatures immediately
|
|
|
|
# Update virus signatures immediately
|
|
|
|
if [ -n "$freshclam_bin" ]; then
|
|
|
|
if [ -n "$freshclam_bin" ]; then
|
|
|
|
echo " → Updating virus signatures (this may take a moment)..."
|
|
|
|
echo " → Updating virus signatures (timeout 60s)..."
|
|
|
|
if "$freshclam_bin" 2>&1 | grep -qE "updated|Downloaded|up-to-date"; then
|
|
|
|
if timeout 60 "$freshclam_bin" 2>&1 | grep -qE "updated|Downloaded|up-to-date"; then
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update status unclear (may still be current)"
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update inconclusive (may still be current)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
@@ -331,12 +346,16 @@ install_all_scanners() {
|
|
|
|
echo -e "${GREEN}✓ Maldet installed${NC}"
|
|
|
|
echo -e "${GREEN}✓ Maldet installed${NC}"
|
|
|
|
rm -f "$install_log"
|
|
|
|
rm -f "$install_log"
|
|
|
|
|
|
|
|
|
|
|
|
# Update malware signatures immediately
|
|
|
|
# Update malware signatures immediately with timeout
|
|
|
|
echo " → Updating malware signatures..."
|
|
|
|
echo " → Updating malware signatures..."
|
|
|
|
if maldet -u 2>&1 | grep -qE "update completed|signatures"; then
|
|
|
|
# Try to find maldet binary (might not be in PATH yet)
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
local maldet_bin=$(command -v maldet || find /usr/local -name maldet -type f 2>/dev/null | head -1)
|
|
|
|
else
|
|
|
|
if [ -n "$maldet_bin" ]; then
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update status unclear (continuing with current definitions)"
|
|
|
|
if timeout 120 "$maldet_bin" -u 2>&1 | grep -qE "update completed|signatures"; then
|
|
|
|
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update inconclusive (continuing with current definitions)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e "${RED}✗ Maldet installation failed${NC}"
|
|
|
|
echo -e "${RED}✗ Maldet installation failed${NC}"
|
|
|
@@ -366,47 +385,191 @@ install_all_scanners() {
|
|
|
|
echo -e "${CYAN}[3/4] Installing ImunifyAV (FREE)...${NC}"
|
|
|
|
echo -e "${CYAN}[3/4] Installing ImunifyAV (FREE)...${NC}"
|
|
|
|
echo " This may take several minutes - please wait..."
|
|
|
|
echo " This may take several minutes - please wait..."
|
|
|
|
|
|
|
|
|
|
|
|
# Use deployment script method (most reliable)
|
|
|
|
# ── STANDALONE DETECTION ─────────────────────────────────────────
|
|
|
|
cd /tmp
|
|
|
|
# Detect whether this is a standalone system (no cPanel, no Plesk).
|
|
|
|
if [ -f "imav-deploy.sh" ]; then
|
|
|
|
# InterWorx is also treated as standalone for ImunifyAV purposes
|
|
|
|
rm -f imav-deploy.sh
|
|
|
|
# because imav-deploy.sh does not recognise it as a "panel".
|
|
|
|
|
|
|
|
local imav_is_standalone=0
|
|
|
|
|
|
|
|
if [ ! -f "/usr/local/cpanel/cpanel" ] && [ ! -f "/usr/local/psa/version" ]; then
|
|
|
|
|
|
|
|
imav_is_standalone=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
wget -q https://repo.imunify360.cloudlinux.com/defence360/imav-deploy.sh
|
|
|
|
# ── STANDALONE: INTEGRATION.CONF SETUP ───────────────────────────
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -eq 1 ]; then
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo -e "${YELLOW} ⚠ Standalone system detected (no cPanel or Plesk found)${NC}"
|
|
|
|
|
|
|
|
echo " ImunifyAV requires a web server path for its UI on standalone systems."
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f imav-deploy.sh ]; then
|
|
|
|
local imav_conf_dir="/etc/sysconfig/imunify360"
|
|
|
|
# Run deployment script with progress indicators
|
|
|
|
local imav_conf_file="$imav_conf_dir/integration.conf"
|
|
|
|
bash imav-deploy.sh 2>&1 | grep -E "Installing|Installed|Complete|Error|Failed" || true
|
|
|
|
local imav_ui_path=""
|
|
|
|
rm -f imav-deploy.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Enable cPanel UI plugin if installed
|
|
|
|
# Check if integration.conf already exists with ui_path set
|
|
|
|
if [ -f "/opt/alt/python35/share/imunify360/scripts/av-userside-plugin.sh" ]; then
|
|
|
|
if [ -f "$imav_conf_file" ] && grep -q "^ui_path" "$imav_conf_file" 2>/dev/null; then
|
|
|
|
echo " → Enabling cPanel UI plugin..."
|
|
|
|
# Already configured - read existing value for display only
|
|
|
|
/opt/alt/python35/share/imunify360/scripts/av-userside-plugin.sh &>/dev/null
|
|
|
|
imav_ui_path=$(grep "^ui_path" "$imav_conf_file" | head -1 | cut -d'=' -f2 | tr -d ' ')
|
|
|
|
fi
|
|
|
|
echo -e " ${GREEN}✓${NC} integration.conf already exists with ui_path: $imav_ui_path"
|
|
|
|
else
|
|
|
|
echo " Proceeding with existing configuration."
|
|
|
|
echo -e "${RED} Failed to download installation script${NC}"
|
|
|
|
else
|
|
|
|
fi
|
|
|
|
# Prompt user for ui_path with sensible default
|
|
|
|
|
|
|
|
echo " Enter the web server document root path for the ImunifyAV UI."
|
|
|
|
|
|
|
|
echo " This directory will be served by your web server (Apache/Nginx)."
|
|
|
|
|
|
|
|
echo " Example: /var/www/html/imunifyav"
|
|
|
|
|
|
|
|
echo " Enter 0 to cancel ImunifyAV installation."
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
read -p " ui_path [/var/www/html/imunifyav]: " imav_ui_input
|
|
|
|
|
|
|
|
|
|
|
|
if is_imunify_installed; then
|
|
|
|
# Handle cancel
|
|
|
|
echo -e "${GREEN}✓ ImunifyAV (FREE) installed${NC}"
|
|
|
|
if [ "$imav_ui_input" = "0" ]; then
|
|
|
|
echo " No license key required - this is the FREE version"
|
|
|
|
echo " → Skipping ImunifyAV installation."
|
|
|
|
|
|
|
|
# Jump past the download/deploy block entirely
|
|
|
|
|
|
|
|
imav_is_standalone=2
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Find imunify-antivirus binary
|
|
|
|
if [ "$imav_is_standalone" -ne 2 ]; then
|
|
|
|
local imunify_bin=$(command -v imunify-antivirus || find /usr -name imunify-antivirus 2>/dev/null | head -1)
|
|
|
|
# Apply default if blank
|
|
|
|
|
|
|
|
if [ -z "$imav_ui_input" ]; then
|
|
|
|
|
|
|
|
imav_ui_path="/var/www/html/imunifyav"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
imav_ui_path="$imav_ui_input"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Update malware signatures immediately
|
|
|
|
# Input validation: must be an absolute path, no spaces
|
|
|
|
if [ -n "$imunify_bin" ]; then
|
|
|
|
if [[ "$imav_ui_path" != /* ]]; then
|
|
|
|
echo " → Updating malware signatures..."
|
|
|
|
echo -e "${RED} ✗ Path must be absolute (start with /). Skipping ImunifyAV.${NC}"
|
|
|
|
if "$imunify_bin" update 2>&1 | grep -qE "updated|Success|completed"; then
|
|
|
|
imav_is_standalone=2
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
elif [[ "$imav_ui_path" =~ [[:space:]] ]]; then
|
|
|
|
else
|
|
|
|
echo -e "${RED} ✗ Path must not contain spaces. Skipping ImunifyAV.${NC}"
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update status unclear (continuing with current definitions)"
|
|
|
|
imav_is_standalone=2
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -ne 2 ]; then
|
|
|
|
|
|
|
|
# Create config directory if needed
|
|
|
|
|
|
|
|
echo " → Creating $imav_conf_dir ..."
|
|
|
|
|
|
|
|
mkdir -p "$imav_conf_dir" || {
|
|
|
|
|
|
|
|
echo -e "${RED} ✗ Cannot create $imav_conf_dir - check permissions. Skipping ImunifyAV.${NC}"
|
|
|
|
|
|
|
|
imav_is_standalone=2
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -ne 2 ]; then
|
|
|
|
|
|
|
|
# Write minimal integration.conf (only ui_path is required)
|
|
|
|
|
|
|
|
printf '[paths]\nui_path = %s\n' "$imav_ui_path" > "$imav_conf_file" || {
|
|
|
|
|
|
|
|
echo -e "${RED} ✗ Cannot write $imav_conf_file. Skipping ImunifyAV.${NC}"
|
|
|
|
|
|
|
|
imav_is_standalone=2
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -ne 2 ]; then
|
|
|
|
|
|
|
|
echo -e " ${GREEN}✓${NC} integration.conf written: ui_path = $imav_ui_path"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "${RED}✗ ImunifyAV installation failed${NC}"
|
|
|
|
# SELinux warning for RHEL-family systems
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -ne 2 ] && command -v getenforce &>/dev/null; then
|
|
|
|
|
|
|
|
local selinux_status
|
|
|
|
|
|
|
|
selinux_status=$(getenforce 2>/dev/null || echo "Unknown")
|
|
|
|
|
|
|
|
if [ "$selinux_status" = "Enforcing" ]; then
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠ SELinux is Enforcing${NC}"
|
|
|
|
|
|
|
|
echo " After installation, ImunifyAV may need an SELinux policy module."
|
|
|
|
|
|
|
|
echo " If the UI is inaccessible, run:"
|
|
|
|
|
|
|
|
echo " ausearch -c 'imunify' | audit2allow -M imunify && semodule -i imunify.pp"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ── END STANDALONE SETUP ─────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Only proceed with download/deploy if not cancelled (imav_is_standalone != 2)
|
|
|
|
|
|
|
|
if [ "${imav_is_standalone:-0}" -ne 2 ]; then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use deployment script method (most reliable)
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
if [ -f "imav-deploy.sh" ]; then
|
|
|
|
|
|
|
|
rm -f imav-deploy.sh
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Download deployment script with timeout
|
|
|
|
|
|
|
|
if timeout 30 wget -q -O imav-deploy.sh https://repo.imunify360.cloudlinux.com/defence360/imav-deploy.sh 2>/dev/null; then
|
|
|
|
|
|
|
|
if [ ! -f imav-deploy.sh ] || [ ! -s imav-deploy.sh ]; then
|
|
|
|
|
|
|
|
echo -e "${RED} Failed to download installation script (empty file)${NC}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# Run deployment script with timeout and capture output
|
|
|
|
|
|
|
|
echo " → Running deployment script..."
|
|
|
|
|
|
|
|
local deploy_log="/tmp/imav-deploy-$$.log"
|
|
|
|
|
|
|
|
if timeout 300 bash imav-deploy.sh > "$deploy_log" 2>&1; then
|
|
|
|
|
|
|
|
# Check if any actual installation happened
|
|
|
|
|
|
|
|
if grep -qiE "installed|complete|success" "$deploy_log"; then
|
|
|
|
|
|
|
|
echo " → Deployment script executed"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo " → Deployment script ran (check for errors below)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Show any errors from deployment
|
|
|
|
|
|
|
|
if grep -qi "error\|failed\|conflict" "$deploy_log"; then
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠ Warnings detected:${NC}"
|
|
|
|
|
|
|
|
grep -iE "error|failed|conflict" "$deploy_log" | sed 's/^/ /' | head -3
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "${YELLOW} ⚠ Deployment script timed out or failed${NC}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f "$deploy_log"
|
|
|
|
|
|
|
|
rm -f imav-deploy.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Try to start the service if installed
|
|
|
|
|
|
|
|
if command -v systemctl &>/dev/null && is_imunify_installed; then
|
|
|
|
|
|
|
|
echo " → Starting ImunifyAV service..."
|
|
|
|
|
|
|
|
systemctl start imunify-antivirus 2>/dev/null || true
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "${RED} Failed to download installation script (network error or timeout)${NC}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_imunify_installed; then
|
|
|
|
|
|
|
|
echo -e "${GREEN}✓ ImunifyAV (FREE) installed${NC}"
|
|
|
|
|
|
|
|
echo " No license key required - this is the FREE version"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find imunify-antivirus binary
|
|
|
|
|
|
|
|
local imunify_bin=$(command -v imunify-antivirus || find /usr -name imunify-antivirus 2>/dev/null | head -1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update malware signatures immediately
|
|
|
|
|
|
|
|
if [ -n "$imunify_bin" ]; then
|
|
|
|
|
|
|
|
echo " → Updating malware signatures..."
|
|
|
|
|
|
|
|
if timeout 60 "$imunify_bin" update 2>&1 | grep -qiE "updated|Success|completed"; then
|
|
|
|
|
|
|
|
echo -e " ${GREEN}✓${NC} Signatures updated"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Signature update inconclusive (continuing with current definitions)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ── STANDALONE: POST-INSTALL UI URL HINT ─────────────────
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -eq 1 ] && [ -n "${imav_ui_path:-}" ]; then
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo -e " ${CYAN}ImunifyAV UI path:${NC} $imav_ui_path"
|
|
|
|
|
|
|
|
echo " Configure your web server to serve that directory, then"
|
|
|
|
|
|
|
|
echo " access the UI at: http://YOUR-SERVER-IP/<ui_directory_name>/"
|
|
|
|
|
|
|
|
echo " (Replace <ui_directory_name> with the last component of the path above)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ── END POST-INSTALL HINT ─────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "${RED}✗ ImunifyAV installation failed${NC}"
|
|
|
|
|
|
|
|
if [ "$imav_is_standalone" -eq 1 ]; then
|
|
|
|
|
|
|
|
echo -e "${YELLOW} Note: Verify integration.conf at $imav_conf_file is correct${NC}"
|
|
|
|
|
|
|
|
echo -e "${YELLOW} and that $imav_ui_path is accessible by your web server.${NC}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "${YELLOW} Note: ImunifyAV FREE is primarily supported on CloudLinux, cPanel, and Plesk systems${NC}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ── END CANCELLED GUARD ───────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e "${GREEN}✓ ImunifyAV already installed${NC}"
|
|
|
|
echo -e "${GREEN}✓ ImunifyAV already installed${NC}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@@ -418,23 +581,32 @@ install_all_scanners() {
|
|
|
|
echo -e "${CYAN}[4/4] Installing Rootkit Hunter...${NC}"
|
|
|
|
echo -e "${CYAN}[4/4] Installing Rootkit Hunter...${NC}"
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure repo is enabled (OS-specific)
|
|
|
|
# Ensure repo is enabled (OS-specific)
|
|
|
|
if command -v yum &>/dev/null; then
|
|
|
|
if command -v dnf &>/dev/null; then
|
|
|
|
# RHEL/CentOS - EPEL repo (only on RHEL-based systems that have rpm)
|
|
|
|
# CentOS 8+, RHEL 8+, Fedora - use dnf as primary package manager
|
|
|
|
if ! rpm -qa 2>/dev/null | grep -q epel-release; then
|
|
|
|
if ! rpm -qa 2>/dev/null | grep -q epel-release; then
|
|
|
|
echo " → Installing EPEL repository..."
|
|
|
|
echo " → Installing EPEL repository..."
|
|
|
|
yum install -y epel-release 2>&1 | grep -E "Installing|Installed|already installed" || true
|
|
|
|
dnf install -y epel-release 2>&1 | grep -E "Installing|Installed|already installed" || echo " (repo may already be enabled)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Install rkhunter
|
|
|
|
# Install rkhunter
|
|
|
|
yum install -y rkhunter 2>&1 | grep -E "Installing|Installed|already installed" || true
|
|
|
|
dnf install -y rkhunter 2>&1 | grep -E "Installing|Installed|already installed" || echo " (installation may already be complete)"
|
|
|
|
|
|
|
|
elif command -v yum &>/dev/null; then
|
|
|
|
|
|
|
|
# CentOS 7, RHEL 7 - use yum
|
|
|
|
|
|
|
|
if ! rpm -qa 2>/dev/null | grep -q epel-release; then
|
|
|
|
|
|
|
|
echo " → Installing EPEL repository..."
|
|
|
|
|
|
|
|
yum install -y epel-release 2>&1 | grep -E "Installing|Installed|already installed" || echo " (repo may already be enabled)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Install rkhunter
|
|
|
|
|
|
|
|
yum install -y rkhunter 2>&1 | grep -E "Installing|Installed|already installed" || echo " (installation may already be complete)"
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
elif command -v apt-get &>/dev/null; then
|
|
|
|
# Debian/Ubuntu - universe repo (rkhunter is in universe)
|
|
|
|
# Debian/Ubuntu - universe repo (rkhunter is in universe)
|
|
|
|
echo " → Ensuring universe repository is enabled..."
|
|
|
|
echo " → Ensuring universe repository is enabled..."
|
|
|
|
grep -q "universe" /etc/apt/sources.list 2>/dev/null || \
|
|
|
|
if ! grep -q "universe" /etc/apt/sources.list 2>/dev/null; then
|
|
|
|
sed -i 's/^deb http/deb http universe\ndeb http/' /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 update 2>&1 | grep -E "Hit|Get|Reading|Building" | head -3 || true
|
|
|
|
apt-get install -y rkhunter 2>&1 | grep -E "Setting up|already|newest" || echo " (installation may already be complete)"
|
|
|
|
apt-get install -y rkhunter 2>&1 | grep -E "Setting up|already|newest" || true
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if is_rkhunter_installed; then
|
|
|
|
if is_rkhunter_installed; then
|
|
|
@@ -442,13 +614,19 @@ install_all_scanners() {
|
|
|
|
|
|
|
|
|
|
|
|
# Update definitions
|
|
|
|
# Update definitions
|
|
|
|
echo " → Updating rootkit definitions..."
|
|
|
|
echo " → Updating rootkit definitions..."
|
|
|
|
rkhunter --update 2>&1 | grep -E "updated|downloaded" || rkhunter --update &>/dev/null
|
|
|
|
if timeout 120 rkhunter --update 2>&1 | grep -qE "updated|downloaded"; then
|
|
|
|
echo -e " ${GREEN}✓${NC} Definitions updated"
|
|
|
|
echo -e " ${GREEN}✓${NC} Definitions updated"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Definitions update inconclusive (continuing)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize baseline (propupd creates file property database)
|
|
|
|
# Initialize baseline (propupd creates file property database)
|
|
|
|
echo " → Initializing baseline database..."
|
|
|
|
echo " → Initializing baseline database..."
|
|
|
|
rkhunter --propupd &>/dev/null
|
|
|
|
if timeout 300 rkhunter --propupd 2>&1 | grep -q "Updating" || timeout 300 rkhunter --propupd &>/dev/null; then
|
|
|
|
echo -e " ${GREEN}✓${NC} Baseline initialized"
|
|
|
|
echo -e " ${GREEN}✓${NC} Baseline initialized"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e " ${YELLOW}⚠${NC} Baseline initialization inconclusive"
|
|
|
|
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo -e "${RED}✗ Rootkit Hunter installation failed${NC}"
|
|
|
|
echo -e "${RED}✗ Rootkit Hunter installation failed${NC}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|