cschantz 3407514920 Restrict ImunifyAV to user-focused scans only
Issue: ImunifyAV's built-in exclusions prevent comprehensive scanning
When scanning full server ("/"), ImunifyAV only scanned 0.045% of files
in /usr/local (20 out of 44,135 files) and 0% of /opt (0 out of 7,989).

Problem Analysis:
ImunifyAV has 131 global ignore patterns that skip:
- Vendor directories (node_modules, composer, etc.)
- Cache directories (wp-content/cache, var/cache, etc.)
- Template compilation directories
- System library paths
- Development/build artifacts

These exclusions apply GLOBALLY, not just when scanning from "/".
Even when explicitly told to scan /usr/local or /opt, ImunifyAV
still applies all ignore patterns, resulting in near-zero coverage
of system directories.

Evidence from Test Scan:
  Directory     Actual Files    ImunifyAV Scanned    Coverage
  /usr/local    44,135          20                   0.045%
  /opt          7,989           0                    0%
  /var/www      1               0                    0%
  /var/lib      1               0                    0%
  /home         2,087           3,871                185% (good!)

ImunifyAV is designed for web hosting security (user content),
NOT comprehensive system malware scanning.

Solution:
Skip ImunifyAV entirely when scanning "/" (option 1: full server scan)
Use ImunifyAV ONLY for user-focused scans where it excels:
  - Option 2: All user accounts (/home or /var/www/vhosts)
  - Option 3: Specific user account
  - Option 4: Specific domain
  - Option 5: Custom path (usually user paths)

Benefits:
1. Faster scans - don't waste time on paths ImunifyAV ignores
2. Honest coverage - users know what's actually being scanned
3. ClamAV + Maldet provide TRUE comprehensive system coverage
4. ImunifyAV still used where it works best (user content)

Changes:
1. Added skip logic at start of ImunifyAV case (line 808)
   - Detects if SCAN_PATHS = ["/"]
   - Shows informative message explaining why it's skipped
   - Logs skip reason to session.log
   - Adds skip notice to summary report
   - Uses 'continue' to skip to next scanner

2. Removed path expansion logic (no longer needed)
   - Deleted 8-path expansion for "/"
   - Now uses SCAN_PATHS as-is for user-focused scans

3. Updated menu to show which scanners are used:
   - Option 1: "Scan entire server (ClamAV, Maldet, RKHunter)"
   - Options 2-5: "All scanners" (includes ImunifyAV)

Scanner Usage by Menu Option:
  1. Full server:      ClamAV ✓  Maldet ✓  RKHunter ✓  ImunifyAV ✗
  2. All users:        ClamAV ✓  Maldet ✓  RKHunter ✓  ImunifyAV ✓
  3. Specific user:    ClamAV ✓  Maldet ✓  RKHunter ✓  ImunifyAV ✓
  4. Specific domain:  ClamAV ✓  Maldet ✓  RKHunter ✓  ImunifyAV ✓
  5. Custom path:      ClamAV ✓  Maldet ✓  RKHunter ✓  ImunifyAV ✓

User Requirement:
"okay lets just make sure that imunify is included in users only scans.
And make sure in the malware scanner menu that Imunify can only be
used in user specific scans"

Status:  Implemented - ImunifyAV now only used for user scans
2025-12-22 22:33:57 -05:00
2025-11-03 18:14:51 -05:00

Linux Server Management Toolkit

Comprehensive multi-panel server management suite supporting cPanel, InterWorx, Plesk, and standalone Apache with modular architecture and intelligent security features.

📦 Directory Structure

server-toolkit/
├── launcher.sh                          # Main menu system
├── README.md                            # This file
│
├── modules/                             # Modular scripts organized by category
│   │
│   ├── diagnostics/                     # 🔍 System Diagnostics
│   │   ├── system-health-check.sh      # Comprehensive health analysis
│   │   └── loadwatch-analyzer.sh       # Historical system health analysis
│   │
│   ├── security/                        # 🛡️ Security & Monitoring
│   │   ├── bot-analyzer.sh             # Full bot/threat analysis
│   │   ├── live-attack-monitor.sh      # Real-time attack monitoring dashboard
│   │   ├── ssh-attack-monitor.sh       # SSH brute force detection
│   │   ├── web-traffic-monitor.sh      # Web traffic monitoring
│   │   ├── firewall-activity-monitor.sh # CSF/iptables monitoring
│   │   ├── enable-cphulk.sh            # cPHulk enablement with CSF whitelist import
│   │   ├── ip-reputation-manager.sh    # Centralized IP reputation tracking
│   │   └── tail-*.sh                   # Various log monitoring scripts
│   │
│   ├── backup/                          # 💾 Backup & Recovery
│   │   ├── acronis-*.sh                # Acronis Cyber Protect (9 management scripts)
│   │   └── mysql-restore-to-sql.sh     # MySQL/MariaDB database restore & dump tool
│   │
│   ├── website/                         # 🌐 Website Diagnostics
│   │   ├── website-error-analyzer.sh   # Comprehensive error analysis
│   │   ├── 500-error-tracker.sh        # Fast 500 error tracking
│   │   └── wordpress/                  # WordPress tools
│   │
│   ├── performance/                     # 📊 Performance Analysis
│   │   ├── hardware-health-check.sh    # Hardware diagnostics
│   │   ├── mysql-query-analyzer.sh     # MySQL performance analysis
│   │   ├── network-bandwidth-analyzer.sh # Network analysis
│   │   ├── php-optimizer.sh            # PHP Configuration Optimizer (NEW!)
│   │   └── (other performance modules)
│   │
│   └── maintenance/                     # 🧹 System Maintenance
│       └── cleanup-toolkit-data.sh     # Clean temporary toolkit data
│
├── lib/                                 # Shared libraries
│   ├── common-functions.sh             # Reusable functions
│   ├── system-detect.sh                # System type detection
│   ├── user-manager.sh                 # User account management
│   ├── mysql-analyzer.sh               # MySQL utilities
│   ├── reference-db.sh                 # Cross-module intelligence sharing
│   ├── php-detector.sh                 # PHP configuration detection (NEW!)
│   ├── php-analyzer.sh                 # PHP performance analysis engine (NEW!)
│   └── php-config-manager.sh           # PHP config backup/restore/modification (NEW!)
│
├── config/                              # Configuration files
│   ├── settings.conf                   # Main configuration
│   ├── whitelist-ips.txt               # IP whitelist
│   └── whitelist-user-agents.txt       # User-Agent whitelist
│
└── tools/                               # Utility scripts
    ├── diagnostic-report.sh            # Generate system reports
    └── test-*.sh                       # Testing utilities

🚀 Quick Start

Installation & Running

One command - automatic cleanup:

curl -sL https://git.mull.lol/cschantz/Linux-Server-Management-Toolkit/archive/main.tar.gz | tar xz && source linux-server-management-toolkit/run.sh

When exiting (option 0), answer "yes" and cleanup happens automatically - no extra steps.

Or if already downloaded:

source /root/linux-server-management-toolkit/run.sh

Key Features

🛡️ Security & Monitoring

  • Bot & Traffic Analyzer: Full bot/threat analysis with pattern detection
  • Live Attack Monitor: Real-time SOC dashboard with threat classification
  • Specialized Monitors: SSH attacks, web traffic, firewall activity
  • IP Reputation Manager: Centralized cross-module IP intelligence with query/tracking
  • Malware Scanner: ImunifyAV, ClamAV, and Maldet integration
  • cPHulk Integration: Auto-imports CSF whitelists from all sources
  • Log Viewers: Live tail for Apache access/error, mail, and security logs
  • Optimized Status Checks: Uses cached domain status (no redundant HTTP requests)

💾 Backup & Recovery

  • Acronis Cyber Protect: Complete agent management (install, update, configure, monitor, troubleshoot)
  • MySQL Database Restore Tool: Advanced recovery from file-based backups with intelligent Force Recovery
    • Multi-control panel support (cPanel, InterWorx, Plesk, standalone)
    • Smart detection for selective restore scenarios
    • Safe single-database extraction from full backups
    • Clean SQL export for production import

🌐 Website Diagnostics

  • Error Analysis: Comprehensive website error detection and troubleshooting
  • 500 Error Tracking: Detailed analysis of application errors
  • Log Integration: Apache, PHP-FPM, cPanel error log analysis
  • Smart Recommendations: Context-aware suggestions for fixing issues

🔍 Performance & Diagnostics

  • System Health Check: Comprehensive hardware, services, and security posture analysis
  • Loadwatch Analyzer: Historical system health analysis (1h/6h/24h/7d/30d time ranges)
  • MySQL Query Analyzer: Slow query detection and optimization recommendations
  • Network & Bandwidth Analyzer: Traffic analysis and top consumers
  • Hardware Health Check: SMART, memory, CPU sensors
  • PHP Configuration Optimizer: Per-domain PHP-FPM tuning with auto-backup and zero downtime
  • Multi-Panel Support: cPanel, InterWorx, Plesk, standalone Apache

📊 Session Intelligence

  • Reference Database: Cross-module data sharing (.sysref)
  • No Historical Tracking: Session-based intelligence only
  • "Download, Run, Fix, Delete": Designed for one-time troubleshooting

🎯 Usage Examples

Quick System Health Check

bash launcher.sh
# Select: 1) System Health Check

Security Analysis & Monitoring

bash launcher.sh
# Select: 2) Security & Monitoring
# Options:
#   - Bot & Traffic Analyzer (full scan or 1-hour quick scan)
#   - Live Attack Monitor (unified threat intelligence)
#   - SSH/Web/Firewall attack monitors
#   - IP Reputation Manager
#   - Malware Scanner
#   - Enable cPHulk Protection

Website Diagnostics

bash launcher.sh
# Select: 3) Website Diagnostics
# Options:
#   - Website Error Analyzer (comprehensive error detection)
#   - Fast 500 Error Tracker (500 errors only)
#   - WordPress Tools (WP-Cron manager)

Performance Analysis

bash launcher.sh
# Select: 4) Performance Analysis
# Options:
#   - MySQL Query Analyzer (slow query detection)
#   - Network & Bandwidth Analyzer
#   - Hardware Health Check
#   - PHP Configuration Optimizer (per-domain tuning)
#   - Loadwatch Health Analyzer (1h/6h/24h/7d/30d analysis)

Backup & Recovery

bash launcher.sh
# Select: 5) Backup & Recovery
# Options:
#   - Acronis Management (complete backup interface)
#   - MySQL File Restore (convert DB files to SQL)

🔧 Configuration

Edit the configuration file:

nano /root/server-toolkit/config/settings.conf

🔒 Security Considerations

  • Run as root: Most modules require root access
  • Credentials stored safely: Git credentials in ~/.git-credentials (outside project)
  • No sensitive data in repo: .gitignore excludes keys, tokens, credentials
  • Test first: Try on non-production environments first

📊 Recent Updates (v2.1)

December 2025 Highlights

  • Launcher Cleanup: Removed 90+ phantom menu items, reduced from 1,576 to 574 lines (64% reduction)
  • Performance: Cached domain status checks save ~5 minutes on 50-domain servers
  • MySQL Restore Tool: Advanced database recovery with intelligent Force Recovery detection
  • Multi-Panel: Full support for cPanel, InterWorx, Plesk, standalone Apache

Current Feature Set

  • 41 Working Modules: Security (14), Website (3), Performance (5), Backup (11), Diagnostics (8)
  • Reference Database: 1-hour cached status for cross-module intelligence
  • Zero Hardcoded Paths: Automatic control panel detection and path abstraction

🙏 Credits

Built for comprehensive cPanel/Linux server management with a focus on security and intelligent automation.


Version: 2.1.0 Repository: https://git.mull.lol/cschantz/Linux-Server-Management-Toolkit

S
Description
No description provided
Readme MIT 18 MiB
Languages
Shell 100%