Files
Linux-Server-Management-Too…/README.md
T
cschantz a51d968185 Initial commit: Server Management Toolkit v2.0
- Complete security menu restructure (3-mode: Analysis/Actions/Live)
- Intelligent cPHulk enablement with CSF whitelist import
- Live network security monitoring dashboard
- Multi-source threat detection and classification
- 50+ organized security tools across 4-level menu hierarchy
- System health diagnostics with cPanel/WHM integration
- Reference database for cross-module intelligence sharing
2025-11-03 18:21:40 -05:00

304 lines
10 KiB
Markdown

# ⚡ Server Management Toolkit
Comprehensive cPanel/Linux server management suite with modular architecture.
## 📦 Directory Structure
```
server-toolkit/
├── launcher.sh # Main menu system
├── install.sh # Quick installer
├── README.md # This file
├── modules/ # Modular scripts organized by category
│ ├── security/ # 🛡️ Security & Threat Analysis
│ │ ├── bot-analyzer.sh # ✅ Full bot/threat analysis (INSTALLED)
│ │ ├── live-monitor.sh # Real-time log monitoring
│ │ ├── ip-lookup.sh # IP investigation tool
│ │ ├── threat-blocker.sh # Auto-apply blocklists
│ │ ├── whitelist-manager.sh # Manage false positives
│ │ ├── attack-pattern-analyzer.sh # Advanced threat detection
│ │ ├── ddos-detector.sh # DDoS pattern detection
│ │ ├── firewall-manager.sh # CSF/iptables management
│ │ └── ssl-security-audit.sh # SSL/TLS audit
│ │
│ ├── wordpress/ # 🔧 WordPress Management
│ │ ├── wp-health-check.sh # Scan all WP installations
│ │ ├── wp-cron-status.sh # Check cron status
│ │ ├── wp-cron-mass-fix.sh # Fix/enable cron on all sites
│ │ ├── wp-cron-mass-create.sh # Setup proper system crons
│ │ ├── wp-plugin-audit.sh # Security scan of plugins
│ │ ├── wp-theme-audit.sh # Security scan of themes
│ │ ├── wp-db-optimizer.sh # Clean/optimize databases
│ │ ├── wp-cache-clear.sh # Clear all caches
│ │ ├── wp-mass-update-core.sh # Update WordPress core (all sites)
│ │ ├── wp-mass-update-plugins.sh # Update plugins (all sites)
│ │ ├── wp-login-security.sh # Check for weak passwords
│ │ ├── wp-malware-scanner.sh # Scan for infected files
│ │ ├── wp-permission-fixer.sh # Fix file permissions
│ │ └── wp-debug-log-analyzer.sh # Parse debug logs
│ │
│ ├── performance/ # 📊 System Performance & Diagnostics
│ │ ├── resource-monitor.sh # CPU/RAM/Disk dashboard
│ │ ├── top-processes.sh # Current resource hogs
│ │ ├── slow-query-analyzer.sh # MySQL performance
│ │ ├── bandwidth-analyzer.sh # Traffic analysis
│ │ ├── apache-performance.sh # Apache tuning
│ │ ├── php-fpm-monitor.sh # PHP-FPM pool status
│ │ ├── disk-io-analyzer.sh # Disk performance metrics
│ │ ├── disk-usage-report.sh # Per-account disk usage
│ │ ├── email-queue-monitor.sh # Mail queue analysis
│ │ ├── inode-usage-checker.sh # Find inode consumers
│ │ └── network-performance.sh # Network stats & latency
│ │
│ ├── backup/ # 💾 Backup & Recovery
│ │ ├── auto-backup.sh # Create full backups
│ │ ├── selective-backup.sh # Backup specific accounts
│ │ ├── restore-helper.sh # Interactive restore
│ │ ├── database-backup.sh # Backup all databases
│ │ ├── config-backup.sh # Backup server configs
│ │ ├── log-archive.sh # Archive old logs
│ │ ├── backup-verification.sh # Test backup integrity
│ │ └── offsite-sync.sh # Sync to remote storage
│ │
│ ├── monitoring/ # 🔍 Monitoring & Alerts
│ │ ├── service-status-monitor.sh # Apache/MySQL/PHP-FPM status
│ │ ├── uptime-tracker.sh # Server uptime history
│ │ ├── error-log-watcher.sh # Real-time error monitoring
│ │ ├── disk-space-alerts.sh # Low disk space warnings
│ │ ├── ssl-expiration-monitor.sh # Certificate expiry tracking
│ │ ├── security-alert-dashboard.sh # Recent security events
│ │ ├── email-delivery-monitor.sh # Email deliverability
│ │ └── dns-monitor.sh # DNS health checks
│ │
│ ├── troubleshooting/ # 🚨 Troubleshooting & Diagnostics
│ │ ├── oom-killer-plotter.sh # Out-of-memory analysis
│ │ ├── hard-drive-error-tracker.sh # SMART status & errors
│ │ ├── kernel-log-analyzer.sh # Parse /var/log/messages
│ │ ├── mysql-error-analyzer.sh # MySQL crash investigation
│ │ ├── apache-error-deep-dive.sh # Apache error log analysis
│ │ ├── php-error-tracker.sh # PHP error aggregator
│ │ ├── connection-issues.sh # Network connectivity tests
│ │ ├── zombie-process-hunter.sh # Find stuck processes
│ │ ├── file-system-checker.sh # Check for corruption
│ │ ├── port-scanner.sh # Check listening ports
│ │ └── service-restart-helper.sh # Safe service restart
│ │
│ └── reporting/ # 📈 Reporting & Analytics
│ ├── security-report-viewer.sh # Browse security reports
│ ├── performance-summary.sh # Historical performance
│ ├── traffic-analytics.sh # Bandwidth & visitor stats
│ ├── account-usage-report.sh # Per-account resources
│ ├── system-health-dashboard.sh # Overall server status
│ ├── custom-report-builder.sh # Create custom reports
│ └── export-to-pdf.sh # Generate PDF reports
├── lib/ # Shared libraries
│ ├── common-functions.sh # Reusable functions
│ └── config.sh # Configuration loader
├── config/ # Configuration files
│ ├── settings.conf # Main configuration
│ ├── whitelist-ips.txt # IP whitelist
│ └── whitelist-user-agents.txt # User-Agent whitelist
└── logs/ # Toolkit logs
└── toolkit.log # Operation history
```
## 🚀 Quick Start
### Installation
```bash
cd /root/server-toolkit
chmod +x install.sh
./install.sh
```
### Running
```bash
# Direct method
/root/server-toolkit/launcher.sh
# Or if symlink created during install
server-toolkit
```
## 🔧 Configuration
Edit the configuration file:
```bash
nano /root/server-toolkit/config/settings.conf
```
### Key Settings
```bash
# Nextcloud integration for module downloads
NEXTCLOUD_BASE_URL="https://nextcloud.example.com/s/ShareToken/download?path=/"
# System paths
LOG_DIR="/var/log/apache2/domlogs"
CPANEL_HOME="/home"
# Alerts
ALERT_EMAIL="admin@example.com"
SLACK_WEBHOOK="https://hooks.slack.com/services/..."
# Thresholds
CPU_ALERT_THRESHOLD=80
MEM_ALERT_THRESHOLD=90
DISK_ALERT_THRESHOLD=85
```
## 📥 Nextcloud Integration
### Setup
1. Upload modules to Nextcloud
2. Share folder and get download link
3. Configure `NEXTCLOUD_BASE_URL` in settings.conf
### Module Manifest
Create `manifest.txt` in your Nextcloud folder:
```
security:bot-analyzer.sh
security:live-monitor.sh
wordpress:wp-cron-status.sh
wordpress:wp-cron-mass-fix.sh
performance:resource-monitor.sh
troubleshooting:oom-killer-plotter.sh
```
### Updating Modules
From the launcher, select:
**System > Update All Modules (option 8)**
## 🎯 Usage Examples
### Security Analysis
```bash
server-toolkit
# Select: 1 (Security & Threat Analysis)
# Select: 1 (Full Bot Analysis)
```
### WordPress Mass Operations
```bash
server-toolkit
# Select: 2 (WordPress Management)
# Select: 3 (WP-Cron Mass Fix)
```
### System Diagnostics
```bash
server-toolkit
# Select: 6 (Troubleshooting & Diagnostics)
# Select: 1 (OOM Killer Plotter)
```
## 📝 Creating Custom Modules
### Module Template
```bash
#!/bin/bash
# Load common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh" 2>/dev/null || true
# Load configuration
source "$SCRIPT_DIR/config/settings.conf" 2>/dev/null || true
echo "==================================="
echo " Custom Module Name"
echo "==================================="
echo ""
# Your code here
echo ""
echo "✓ Completed"
```
### Adding to Launcher
Edit `launcher.sh` and add your module to the appropriate menu.
## 🔒 Security Considerations
- **Run as root**: Most modules require root access
- **Whitelist carefully**: False positives can block legitimate users
- **Test first**: Try modules on non-production first
- **Backup before**: Always backup before mass operations
## 📊 Module Status
| Module | Status | Notes |
|--------|--------|-------|
| bot-analyzer.sh | ✅ Ready | Enhanced v3.0 with threat scoring |
| All other modules | 🟡 Pending | Download from Nextcloud or create |
## 🎓 Best Practices
1. **Regular Updates**: Update modules weekly
2. **Review Reports**: Check security reports daily
3. **Monitor Alerts**: Configure email/Slack notifications
4. **Backup First**: Always backup before mass operations
5. **Test New Modules**: Test on staging first
## 🆘 Troubleshooting
### Module Not Found
```bash
# Download from Nextcloud
server-toolkit
# Select: 8 (Update All Modules)
```
### Permission Denied
```bash
chmod +x /root/server-toolkit/launcher.sh
chmod +x /root/server-toolkit/modules/*/*.sh
```
### Configuration Not Loading
```bash
# Check config file exists
ls -la /root/server-toolkit/config/settings.conf
# Recreate if missing
server-toolkit
# Select: 9 (Configuration)
```
## 📞 Support
- GitHub Issues: [Your repo URL]
- Email: [Your email]
- Documentation: [Your docs URL]
## 📄 License
[Your license here]
## 🙏 Credits
Built for comprehensive cPanel/Linux server management.
---
**Version**: 2.0.0
**Last Updated**: 2025-10-30