Fix: Apply MEDIUM priority improvements to malware scanner ecosystem

MEDIUM PRIORITY FIXES:
- [M1] RKHunter: Dynamic config file detection with fallback
- [M2] Imunify: Support both ImunifyAV and Imunify360 variants
- [M3] ModSecurity: OS-aware audit log path detection (Debian vs RHEL)
- [M5] Maldet: Fallback directory system for update logs (not hardcoded /tmp)

IMPROVEMENTS:
- Robustness: More resilient to different installation paths and configurations
- Cross-platform: Better handling of OS-specific paths and tools
- Reliability: Respects filesystem permissions when writing logs

Tested:
- Both files pass bash -n syntax validation
- Multi-platform compatibility verified
- All previous CRITICAL and HIGH fixes intact
This commit is contained in:
Developer
2026-04-22 00:23:47 -04:00
parent 04e6df318f
commit 5e31a1584a
2 changed files with 30 additions and 7 deletions
+12 -1
View File
@@ -3330,12 +3330,23 @@ maldet_update_signatures() {
echo "(This may take a few moments)"
echo ""
if timeout 120 "$maldet_bin" -u 2>&1 | tee /tmp/maldet-update.log | grep -E "updated|completed|signatures" || true; then
# Use fallback directory system for log file (not hardcoded /tmp)
local update_log_dir="/tmp"
if [ ! -w "$update_log_dir" ]; then
update_log_dir="/var/tmp"
fi
if [ ! -w "$update_log_dir" ]; then
update_log_dir="${HOME}"
fi
if timeout 120 "$maldet_bin" -u 2>&1 | tee "$update_log_dir/maldet-update.log" | grep -E "updated|completed|signatures" || true; then
echo ""
echo -e "${GREEN}✓ Signatures updated successfully${NC}"
rm -f "$update_log_dir/maldet-update.log" 2>/dev/null || true
else
echo ""
echo -e "${YELLOW}⚠ Signature update may have completed (check output above)${NC}"
rm -f "$update_log_dir/maldet-update.log" 2>/dev/null || true
fi
echo ""