feat: Add comprehensive log path mapping for all platforms

NEW FILES:
- lib/log-paths.sh: Derives all log file paths based on detected system

ENHANCEMENTS:
- Added detect_mail_system() to lib/system-detect.sh
  - Detects: Exim (cPanel), Postfix (Plesk), Sendmail
- Updated initialize_system_detection() to call derive_all_log_paths()
- Updated launcher.sh to source log-paths.sh

LOG PATH CATEGORIES NOW DERIVED:
1. Web Server Logs (domain + main access/error)
2. Authentication Logs (SSH, sudo, logins)
3. Mail System Logs (Exim, Postfix, Sendmail)
4. Firewall Logs (CSF, firewalld, iptables)
5. Control Panel Logs (cPanel, Plesk, InterWorx)
6. Database Logs (MySQL, MariaDB, PostgreSQL)
7. Security Scanner Logs (ClamAV, Maldet, Rkhunter, Imunify)
8. System Logs (messages/syslog, kernel, auth)
9. PHP Logs (FPM, error logs)
10. Service Logs (FTP, DNS, SSH)

All paths now account for:
- Control panel differences (cPanel vs Plesk vs InterWorx vs Standalone)
- OS differences (RHEL/CentOS/AlmaLinux vs Ubuntu/Debian)
- Mail system differences (Exim vs Postfix vs Sendmail)
- Database differences (MySQL vs MariaDB vs PostgreSQL)
This commit is contained in:
Developer
2026-03-20 02:42:29 -04:00
parent 7361b89f0e
commit 64793cb7b8
3 changed files with 412 additions and 0 deletions
+44
View File
@@ -397,6 +397,43 @@ detect_firewall() {
return 1
}
#############################################################################
# MAIL SYSTEM DETECTION
#############################################################################
detect_mail_system() {
[ -n "$SYS_DETECTION_COMPLETE" ] || print_info "Detecting mail system..."
# Exim (cPanel default)
if command_exists exim; then
SYS_MAIL_SYSTEM="exim"
SYS_MAIL_SYSTEM_VERSION=$(exim -bV 2>/dev/null | head -1 | grep -oP 'Exim version \K[^ ]+' || echo "unknown")
print_success "Detected Exim ${SYS_MAIL_SYSTEM_VERSION}"
return 0
fi
# Postfix
if command_exists postqueue; then
SYS_MAIL_SYSTEM="postfix"
SYS_MAIL_SYSTEM_VERSION=$(postconf mail_version 2>/dev/null | grep -oP '\d+\.\d+\.\d+' | head -1 || echo "unknown")
print_success "Detected Postfix ${SYS_MAIL_SYSTEM_VERSION}"
return 0
fi
# Sendmail
if command_exists sendmail; then
SYS_MAIL_SYSTEM="sendmail"
SYS_MAIL_SYSTEM_VERSION=$(sendmail -d0.1 -O QueueDirectory=/tmp 2>&1 | head -1 | grep -oP '\d+\.\d+\.\d+' || echo "unknown")
print_success "Detected Sendmail ${SYS_MAIL_SYSTEM_VERSION}"
return 0
fi
SYS_MAIL_SYSTEM="none"
SYS_MAIL_SYSTEM_VERSION=""
print_warning "No mail system detected"
return 1
}
#############################################################################
# SYSTEM RESOURCES (Comprehensive - like user's example)
#############################################################################
@@ -564,10 +601,16 @@ initialize_system_detection() {
detect_php_versions
detect_cloudflare
detect_firewall
detect_mail_system
get_system_resources
# Mark as initialized
export SYS_DETECTION_COMPLETE="yes"
# Derive platform-specific log paths (requires detect_* functions to have run first)
if command -v derive_all_log_paths &>/dev/null; then
derive_all_log_paths
fi
}
# Export all functions for use in subshells and sourced scripts
@@ -578,6 +621,7 @@ export -f detect_database
export -f detect_php_versions
export -f detect_cloudflare
export -f detect_firewall
export -f detect_mail_system
export -f get_system_resources
export -f show_system_info
export -f initialize_system_detection