This document describes the newly added features to the VPS Manager.
The VPS Manager has been enhanced with five major feature sets:
- Multi-Domain SSL Wildcards - Wildcard certificate support
- Firewall Management (UFW) - Complete firewall control
- Security Hardening - Automated security scanning and hardening
- Logging & Alerting - Comprehensive monitoring and notifications
- Docker Integration - Seamless Docker container management
- Support for wildcard SSL certificates (
*.example.com) - DNS-01 challenge support for wildcard certificates
- Configurable DNS plugins (Cloudflare, Route53, etc.)
- Automatic subdomain management
- Certificate sharing across multiple subdomains
# Edit VPS Manager config
nano ~/manager/config.jsonAdd DNS plugin configuration:
{
"dns_plugin": "dns-cloudflare",
"certbot_email": "admin@example.com"
}# For Cloudflare
sudo apt install python3-certbot-dns-cloudflare
# Create credentials file
sudo nano /etc/letsencrypt/cloudflare.iniAdd your Cloudflare API credentials:
dns_cloudflare_email = your-email@example.com
dns_cloudflare_api_key = your-api-keysudo chmod 600 /etc/letsencrypt/cloudflare.iniWhen adding a domain, use the wildcard format:
- Domain:
*.example.com - The system will automatically use DNS-01 challenge
- Enhanced
Domainclass withwildcardattribute - Modified
generate_ssl_certificate()to support DNS challenges - Automatic detection of wildcard domains
- Fallback to manual DNS challenge if plugin not configured
- Complete UFW firewall management from the UI
- View firewall status and rules
- Enable/disable firewall
- Allow/deny/limit ports
- IP-based access control
- Quick setup for web servers
- Rate limiting for brute-force protection
- Main Menu → "Firewall Management"
Automatically configures:
- SSH (port 22) with rate limiting
- HTTP (port 80)
- HTTPS (port 443)
Firewall Management → Allow Port
Enter port number: 3000
Protocol: tcp
Comment: Node.js App
Firewall Management → Limit Port
Enter port: 22
Protocol: tcp
Firewall Management → Allow from IP
Enter IP: 203.0.113.10
Firewall Management → List All Rules
Classes:
FirewallRule- Represents a UFW ruleFirewallManager- Manages all firewall operations
Key Methods:
enable()/disable()- Control firewall stateallow_port()/deny_port()/limit_port()- Port managementallow_from_ip()/deny_from_ip()- IP-based ruleslist_rules()- Get all configured rulesquick_setup_web_server()- One-click web server setup
- Comprehensive security scanning
- SSL certificate expiration monitoring
- NGINX security headers validation
- SSH configuration audit
- System update checking
- Open port scanning
- Firewall status verification
- Security score calculation (0-100)
- Automated security header application
- Detailed security reports
- Main Menu → "Security Scanner"
- Select "Run Security Scan"
- Wait for scan to complete
- View issues by severity
Security Scanner → View Security Score
Score interpretation:
- 90-100: Excellent security posture
- 70-89: Good, minor improvements needed
- 50-69: Fair, several issues to address
- 0-49: Poor, immediate action required
Security Scanner → Apply Security Headers (Domain)
Select domain → Confirm
Automatically adds:
X-Frame-Options: SAMEORIGINX-Content-Type-Options: nosniffX-XSS-Protection: 1; mode=blockReferrer-Policy: strict-origin-when-cross-originStrict-Transport-Security: max-age=31536000
Security Scanner → Export Security Report
Report saved to: ~/manager/security_report_YYYYMMDD_HHMMSS.txt
-
SSL Certificate Expiration
- Checks all domain certificates
- Alerts for certificates expiring within 30 days
- Critical alerts for expired certificates
-
NGINX Security Headers
- Validates presence of security headers
- Checks each domain configuration
- Recommends missing headers
-
SSH Configuration
- Checks for root login enabled
- Validates password authentication settings
- Detects empty password permissions
-
System Updates
- Scans for available updates
- Highlights security updates
- Recommends update commands
-
Open Ports
- Lists all listening ports
- Identifies unexpected open ports
- Compares against expected services
-
Firewall Status
- Checks if UFW is installed
- Verifies firewall is enabled
- Recommends firewall activation
Classes:
SecurityIssue- Represents a security findingSecurityScanner- Performs security scansSecurityHardening- Applies security fixes
Severity Levels:
CRITICAL- Immediate action requiredHIGH- Address soonMEDIUM- Should be fixedLOW- Minor improvementINFO- Informational
- Comprehensive alert management
- Multiple notification channels (Email, Slack, Discord, Webhooks, Commands)
- SSL expiration monitoring
- NGINX status monitoring
- Disk space monitoring
- Customizable alert rules
- Alert acknowledgment system
- Automated monitoring checks
- Main Menu → "Alerts & Monitoring"
- Select "View Active Alerts"
- Navigate with ←/→ arrows
- Press 'A' to acknowledge
Alerts & Monitoring → Run All Checks Now
Checks performed:
- SSL certificate expiration
- NGINX service status
- Disk space usage
- Edit configuration file:
nano ~/manager/alert_config.json- Configure channels:
Email Notifications:
{
"email": {
"enabled": true,
"smtp_host": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "your-email@gmail.com",
"smtp_password": "your-app-password",
"from_email": "vps-manager@yourdomain.com",
"to_emails": ["admin@yourdomain.com"],
"use_tls": true
}
}Slack Webhook:
{
"webhook": {
"enabled": true,
"type": "slack",
"webhook_url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
}
}Discord Webhook:
{
"webhook": {
"enabled": true,
"type": "discord",
"webhook_url": "https://discord.com/api/webhooks/YOUR/WEBHOOK/URL"
}
}Custom Command:
{
"command": {
"enabled": true,
"command": "echo '{title}: {message}' | wall"
}
}Alerts & Monitoring → Test Notification
Sends a test alert through all configured channels.
SSL_EXPIRING- Certificate expiring soonSSL_EXPIRED- Certificate has expiredNGINX_DOWN- NGINX service not runningBACKEND_DOWN- Backend service unreachableSECURITY_ISSUE- Security scan found issuesDISK_SPACE- Low disk spaceHIGH_TRAFFIC- Unusual traffic detectedSYSTEM_UPDATE- Updates available
CRITICAL- Immediate attention requiredWARNING- Should be addressedINFO- Informational only
Classes:
Alert- Represents an alertAlertManager- Manages alertsNotificationChannel- Base class for notificationsEmailNotification- Email notificationsWebhookNotification- Slack/Discord/Generic webhooksCommandNotification- Execute commands
Key Methods:
create_alert()- Create and send alertacknowledge_alert()- Mark alert as seenrun_all_checks()- Execute monitoring checksclear_old_alerts()- Clean up old alerts
Set up cron job for automated monitoring:
# Edit crontab
crontab -e
# Add line to check every hour
0 * * * * /usr/bin/python3 -c "from vps_manager.core import VPSManager; m = VPSManager(); m.alerts.run_all_checks()"- Automatic Docker container discovery
- One-click NGINX configuration for containers
- Container management (start/stop/restart)
- Container logs viewing
- Port mapping detection
- IP address detection for containers
- Suggested configurations based on container labels
- Docker Compose service discovery
Main Menu → Docker Integration → List Running Containers
Shows:
- Container name
- Image
- Status
- Exposed ports
Automatically sets up NGINX reverse proxy for a container:
Docker Integration → Auto-Configure Container
1. Select container
2. Enter domain name (e.g., app.example.com)
3. Choose SSL (Y/n)
4. Configuration created automatically
The system will:
- Detect container IP address
- Detect exposed port
- Create NGINX configuration
- Generate SSL certificate (if requested)
- Enable the site
Scans all running containers with web ports and suggests configurations:
Docker Integration → Scan & Suggest Configs
Shows:
- Container name and image
- Detected ports
- Suggested domain names
- Configuration status
Docker Integration → Container Details
Select container
Displays:
- Container ID
- Image
- Status
- Port mappings
- IP address
Docker Integration → Container Logs
Select container
Features:
- Real-time log viewing
- Scrollable output
- Refresh capability (press 'R')
- Last 100 lines displayed
Add labels to your Docker containers for automatic detection:
# docker-compose.yml
version: '3'
services:
web:
image: nginx:latest
labels:
- "vps.domain=myapp.example.com"
- "traefik.port=80"
ports:
- "3000:80"The VPS Manager will:
- Detect the
vps.domainlabel - Suggest the domain in configuration
- Auto-detect the port from labels or port mappings
Classes:
DockerContainer- Represents a containerDockerManager- Manages Docker operations
Key Methods:
list_containers()- Get all containersauto_configure_container()- Setup NGINX for containerscan_and_suggest_configs()- Scan and suggest configsget_container_ip()- Get container IPget_container_logs()- Fetch logsstart_container()/stop_container()/restart_container()- Container control
Scenario: You have a Node.js app running in Docker
- Run your app in Docker:
docker run -d --name myapp -p 3000:3000 node-app:latest- Configure NGINX via VPS Manager:
Main Menu → Docker Integration → Auto-Configure Container
- Select: myapp
- Domain: api.example.com
- SSL: Yes
- Done! Your app is now accessible at
https://api.example.com
-
~/manager/alert_config.json- Notification channel configuration
- Email, Slack, Discord, Command settings
-
~/manager/alerts.json- Stored alerts and acknowledgments
- Alert history
-
~/manager/security_report_*.txt- Exported security scan reports
- Timestamped for tracking
The domains.json now includes:
{
"name": "example.com",
"port": 3000,
"ssl": true,
"custom_config": null,
"wildcard": false,
"backend_ip": "172.17.0.2",
"created_at": "2025-12-11T10:30:00",
"updated_at": "2025-12-11T10:30:00"
}New fields:
wildcard- Whether this is a wildcard certificate domainbackend_ip- Custom backend IP (for Docker containers)
- Run security scans weekly
- Enable firewall before exposing server to internet
- Use rate limiting on SSH (port 22)
- Apply security headers to all domains
- Monitor SSL certificate expiration
- Start with deny-all incoming policy
- Only allow necessary ports
- Use rate limiting for SSH
- Document rules with comments
- Regular audit of firewall rules
- Configure at least one notification channel
- Set up automated monitoring checks
- Acknowledge alerts promptly
- Clear old alerts monthly
- Test notifications after setup
- Use container labels for automatic detection
- Monitor container logs regularly
- Keep containers updated
- Use specific tags instead of
:latest - Document container port mappings
Problem: Can't access server after enabling firewall
Solution:
# From server console (not SSH)
sudo ufw allow 22
sudo ufw reloadProblem: Web server ports blocked
Solution:
sudo ufw allow 80
sudo ufw allow 443
sudo ufw reloadProblem: False positives in scan
Solution:
- Review the recommendation
- If expected, acknowledge and document
- Configure exceptions if needed
Problem: Email notifications not working
Solution:
- Check SMTP credentials in
alert_config.json - For Gmail, use App Password, not account password
- Test with: Alerts → Test Notification
Problem: Too many alerts
Solution:
- Acknowledge resolved alerts
- Clear old alerts: Alerts → Clear Old Alerts
- Adjust monitoring thresholds in code
Problem: Can't detect Docker containers
Solution:
# Check Docker is running
sudo systemctl status docker
# Check permissions
sudo usermod -aG docker $USER
newgrp dockerProblem: Auto-configure fails
Solution:
- Ensure container is running
- Check container exposes ports
- Manually specify port if detection fails
- Verify domain DNS points to server
from vps_manager.core import VPSManager
manager = VPSManager()
issues = manager.security.scan_all()
print(f"Found {len(issues)} issues")from vps_manager.core import VPSManager
manager = VPSManager()
is_active, status = manager.firewall.get_status()
print(f"Firewall: {status}")from vps_manager.core import VPSManager
from vps_manager.alerts import AlertType, AlertLevel
manager = VPSManager()
manager.alerts.create_alert(
AlertType.SECURITY_ISSUE,
AlertLevel.WARNING,
"Test Alert",
"This is a test alert",
{"key": "value"}
)from vps_manager.core import VPSManager
manager = VPSManager()
success, containers = manager.docker.list_containers()
for container in containers:
print(f"{container.name}: {container.status}")manager = VPSManager()
# Access feature managers
manager.firewall # FirewallManager instance
manager.security # SecurityScanner instance
manager.alerts # AlertManager instance
manager.docker # DockerManager instancefirewall = manager.firewall
# Status
firewall.is_installed() # -> (bool, str)
firewall.get_status() # -> (bool, str, bool)
# Control
firewall.enable() # -> (bool, str)
firewall.disable() # -> (bool, str)
firewall.reload() # -> (bool, str)
# Rules
firewall.allow_port(8080, "tcp") # -> (bool, str)
firewall.deny_port(8080, "tcp") # -> (bool, str)
firewall.limit_port(22, "tcp") # -> (bool, str)
firewall.delete_rule(rule_number) # -> (bool, str)
# IP Management
firewall.allow_from_ip("1.2.3.4") # -> (bool, str)
firewall.deny_from_ip("1.2.3.4") # -> (bool, str)
# Quick Setup
firewall.quick_setup_web_server() # -> (bool, str)security = manager.security
# Scanning
issues = security.scan_all() # -> List[SecurityIssue]
security.scan_ssl_certificates() # Scan SSL certs
security.scan_nginx_security_headers() # Check headers
security.scan_ssh_configuration() # Audit SSH
# Analysis
score = security.get_security_score() # -> int (0-100)
grouped = security.get_issues_by_severity() # -> Dict
report = security.generate_report() # -> stralerts = manager.alerts
# Creating Alerts
alert = alerts.create_alert(
alert_type, # AlertType enum
level, # AlertLevel enum
title, # str
message, # str
details # Dict (optional)
)
# Managing Alerts
alerts.acknowledge_alert(alert)
alerts.get_unacknowledged_alerts() # -> List[Alert]
alerts.get_alerts_by_level(level) # -> List[Alert]
alerts.clear_old_alerts(days=30)
# Monitoring
alerts.check_ssl_expiration()
alerts.check_nginx_status()
alerts.check_disk_space()
alerts.run_all_checks()docker = manager.docker
# Container Discovery
is_installed, msg = docker.is_installed()
success, containers = docker.list_containers()
container = docker.get_container_by_name("myapp")
# Container Info
ip = docker.get_container_ip("myapp")
port = docker.get_container_port("myapp")
success, info = docker.inspect_container("myapp")
# Auto Configuration
success, msg = docker.auto_configure_container(
container_name,
domain,
ssl=True
)
# Suggestions
suggestions = docker.scan_and_suggest_configs()
# Container Control
docker.start_container("myapp")
docker.stop_container("myapp")
docker.restart_container("myapp")
# Logs
success, logs = docker.get_container_logs("myapp", lines=100)- Full scan takes 10-30 seconds
- Safe to run hourly
- Minimal system impact
- Checks complete in 5-10 seconds
- Recommend running every 15-60 minutes
- Consider cron job for automation
- Container listing is instant
- No performance impact on containers
- NGINX proxying adds <1ms latency
Potential additions in future versions:
-
Firewall Management
- Geographic IP blocking
- Automatic threat detection
- Integration with fail2ban
-
Security Hardening
- CVE database integration
- Automated patching
- Compliance checking (PCI-DSS, HIPAA)
-
Alerting
- Machine learning anomaly detection
- Custom alert rules via UI
- Alert suppression windows
-
Docker Integration
- Kubernetes support
- Docker Swarm integration
- Container health checks
- Automatic scaling recommendations
- GitHub Issues: github.com/k6w/vps-manager
- Include: VPS Manager version, OS version, error messages, steps to reproduce
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
git clone https://github.com/k6w/vps-manager.git
cd vps-manager
pip install -e .[dev]New Features:
- Multi-domain SSL wildcard support
- Complete UFW firewall management
- Security scanning and hardening
- Comprehensive alerting system
- Docker container integration
Improvements:
- Enhanced Domain class with wildcard and backend_ip support
- Lazy-loaded feature modules for better performance
- Improved error handling across all modules
- Better UI organization with new menu items
Bug Fixes:
- Various stability improvements
- Better error messages
MIT License - See LICENSE file for details
- UFW (Uncomplicated Firewall) - Canonical Ltd.
- Let's Encrypt / Certbot - Internet Security Research Group
- Docker Inc. - Container platform
- NGINX - Open source web server
Made with ❤️ for VPS administrators who value comprehensive management tools.