# โšก 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 # System health from loadwatch monitoring logs โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ security/ # ๐Ÿ›ก๏ธ Security & Threat Analysis โ”‚ โ”‚ โ”œโ”€โ”€ 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-backup-manager.sh # Main backup management menu (Acronis Cyber Protect) โ”‚ โ”‚ โ”œโ”€โ”€ acronis-install.sh # Install Acronis agent โ”‚ โ”‚ โ”œโ”€โ”€ acronis-update.sh # Update Acronis agent โ”‚ โ”‚ โ”œโ”€โ”€ acronis-uninstall.sh # Uninstall Acronis agent โ”‚ โ”‚ โ”œโ”€โ”€ acronis-register.sh # Register agent with cloud โ”‚ โ”‚ โ”œโ”€โ”€ acronis-configure.sh # Configure agent settings โ”‚ โ”‚ โ”œโ”€โ”€ acronis-agent-status.sh # Comprehensive agent status check โ”‚ โ”‚ โ”œโ”€โ”€ acronis-trigger-backup.sh # Trigger manual backups with optimizations โ”‚ โ”‚ โ”œโ”€โ”€ acronis-backup-status.sh # Check backup job status โ”‚ โ”‚ โ”œโ”€โ”€ acronis-list-backups.sh # List all backups โ”‚ โ”‚ โ”œโ”€โ”€ acronis-plan-manager.sh # Manage protection plans โ”‚ โ”‚ โ”œโ”€โ”€ acronis-schedule-viewer.sh # View backup schedules โ”‚ โ”‚ โ”œโ”€โ”€ acronis-restore.sh # Restore from backup โ”‚ โ”‚ โ”œโ”€โ”€ acronis-logs.sh # View Acronis logs โ”‚ โ”‚ โ”œโ”€โ”€ acronis-troubleshoot.sh # Troubleshoot common issues โ”‚ โ”‚ โ””โ”€โ”€ mysql-restore-to-sql.sh # Advanced MySQL/MariaDB database restore & dump tool โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ website/ # ๐ŸŒ Website Diagnostics & Troubleshooting โ”‚ โ”‚ โ”œโ”€โ”€ website-error-analyzer.sh # Comprehensive website error analysis โ”‚ โ”‚ โ””โ”€โ”€ 500-error-tracker.sh # Track and analyze 500 errors โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ diagnostics/ # ๐Ÿ” System Diagnostics & Log Analysis โ”‚ โ”‚ โ”œโ”€โ”€ system-health-check.sh # Comprehensive health analysis โ”‚ โ”‚ โ””โ”€โ”€ loadwatch-analyzer.sh # System health monitoring from loadwatch logs โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ 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:** ```bash 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: ```bash 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 Integration - **Complete Agent Management**: Install, update, uninstall, register - **Comprehensive Status Monitoring**: Agent health, registration, cloud connectivity - **Manual Backup Triggering**: CLI-managed plans with performance optimizations - **Backup Type Selection**: Full, Incremental, Differential backups - **Plan Management**: View, enable/disable, delete protection plans - **Restore Operations**: Full restore capabilities from backups - **Troubleshooting Tools**: Log viewing and automated diagnostics #### MySQL/MariaDB Database Restore Tool (NEW!) - **Advanced Database Recovery**: Restore individual databases from file-based backups (Acronis, raw file backups) - **Multi-Control Panel Support**: Automatic path detection for cPanel, InterWorx, Plesk, standalone - **Intelligent Force Recovery**: Smart detection for missing tablespace files from other databases - **Safe Selective Restore**: Restore single database from full backup without data loss - **Guided Recovery Process**: Step-by-step wizard with automatic error detection - **Safety Features**: Disk space validation, critical directory protection, recovery level warnings - **Clean SQL Export**: Dumps restored database to clean SQL file for import into production ### ๐ŸŒ 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 ### ๐Ÿ” System Diagnostics & Performance Monitoring - **Comprehensive Health Checks**: Hardware, services, security posture - **Loadwatch Health Analyzer**: Historical system health analysis from monitoring logs - Time-range analysis: 1h, 6h, 24h, 7d, 30d - Memory pressure detection and swap usage trending - CPU saturation analysis (idle, iowait, steal time) - Process issue detection (zombies, high CPU/MEM consumers) - MySQL performance monitoring - Actionable recommendations based on findings - **PHP Configuration Optimizer** (NEW!): Per-domain PHP optimization - Analyzes PHP-FPM pool configurations across all domains - Detects max_children issues from 7-day error log history - OPcache hit rate analysis and tuning recommendations - Memory limit optimization based on actual usage - Auto-backup before changes with rollback capability - Graceful PHP-FPM reload for zero downtime - Supports cPanel, InterWorx, Plesk, standalone Apache - **Smart Recommendations**: Context-aware suggestions based on findings - **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 bash launcher.sh # Select: 1) System Health Check ``` ### Security Analysis & Monitoring ```bash 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 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 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 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: ```bash 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 - Major Cleanup & Optimization #### Launcher Streamlined (NEW!) - โœ… Removed 90+ phantom menu items pointing to non-existent scripts - โœ… Reduced from 1,576 lines to 574 lines (64% reduction) - โœ… Cleaned up 7-level nested menus to 3 levels maximum - โœ… Every menu item now points to a real, working script - โœ… Faster navigation and no more "module not found" errors - โœ… Main menu: 6 categories, 41 total working options #### Performance Optimizations - โœ… Bot analyzer now uses cached domain status (eliminates redundant HTTP checks) - โœ… Saves ~5 minutes on 50-domain servers (no more curl requests per check) - โœ… All modules use centralized reference database for domain status - โœ… 1-hour cache prevents wasteful re-checking #### MySQL/MariaDB Database Restore Tool - โœ… Advanced database recovery from file-based backups - โœ… Multi-control panel support (cPanel, InterWorx, Plesk, standalone) - โœ… Intelligent Force Recovery with smart detection - โœ… Safe selective restore (single DB from full backup, zero data loss) - โœ… InterWorx path fix (/chroot/home instead of /home symlink) - โœ… SQL output saved to restore directory parent (not control panel dirs) - โœ… Safety features: disk space validation, directory protection, recovery warnings #### Documentation Updates - โœ… Main README updated with streamlined menu structure - โœ… New modules/backup/README.md (comprehensive backup tools documentation) - โœ… Updated usage examples to match new launcher - โœ… All recent features documented ### Multi-Control Panel Support - โœ… Full cPanel support (primary platform - production ready) - โœ… InterWorx support (validated on real servers - production ready) - โœ… Plesk support (validated on real servers - production ready) - โœ… Standalone Apache support (basic functionality) - โœ… 41 modules refactored for multi-panel architecture - โœ… All critical paths verified on production systems ### Core Features Implemented **Security & Monitoring (14 tools)** - Bot & Traffic Analyzer (full + quick scan) - Live Attack Monitor + 3 specialized monitors - IP Reputation Manager - Malware Scanner - 4x Log tail viewers - cPHulk enablement - CT_LIMIT optimization **Website Diagnostics (3 tools)** - Website Error Analyzer - Fast 500 Error Tracker - WordPress Tools (WP-Cron manager) **Performance Analysis (5 tools)** - MySQL Query Analyzer - Network & Bandwidth Analyzer - Hardware Health Check - PHP Configuration Optimizer - Loadwatch Health Analyzer **Backup & Recovery (11 tools)** - Complete Acronis Cyber Protect integration (9 scripts) - MySQL/MariaDB database restore - Cleanup toolkit data ### System Infrastructure - โœ… Reference database for cross-module intelligence (.sysref with 1-hour cache) - โœ… Automatic control panel detection (system-detect.sh) - โœ… Multi-panel user/domain management (user-manager.sh) - โœ… Cached domain status checks (eliminates redundant HTTP requests) - โœ… Zero hardcoded paths - all detection-based ## ๐Ÿ™ 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