A powerful, open-source web hosting control panel built with Python & Flask. Manage domains, databases, FTP accounts, email, SSL certificates and server resources — all from a clean, modern web UI.
- Features
- Requirements
- Quick Install
- Manual Install
- Configuration
- Running the Panel
- Security
- Project Structure
- Troubleshooting
- Contributing
- License
| Feature | Description |
|---|---|
| 👤 User Management | Create, update, suspend, and delete hosting users with package-based resource limits |
| 📦 Hosting Packages | Define per-user limits: domains, FTP accounts, mail accounts, databases, storage |
| 🌐 Domain Management | Add domains, auto-configure Nginx vhosts, suspend/unsuspend, optional auto-create FTP & mail |
| 🔒 SSL Certificates | Let's Encrypt integration — auto-issue on domain add, bulk renewal |
| 🗄️ MySQL Databases | Create/delete databases and users, update passwords, per-user isolation |
| 📁 FTP Accounts | Create FTP users via vsFTPd, change passwords, delete accounts |
| 📧 Email Accounts | Virtual mailboxes via Postfix + Dovecot, Roundcube webmail link |
| 🌿 Subdomains | Create and delete subdomains with automatic Nginx vhost configuration |
| ⏰ Cron Jobs | Schedule and manage cron jobs per user |
| 📊 Server Monitoring | Real-time CPU, RAM, load average, disk usage, uptime |
| 🔑 Admin & User Portals | Fully separate dashboards — admins manage users, users manage their own resources |
| 🛡️ Security Hardened | CSRF protection, rate limiting, secure password hashing, Content Security Policy, audit logs |
| 🔄 AJAX Dynamic UI | Domain dropdowns filter dynamically by selected user without page reload |
| Component | Version |
|---|---|
| OS | Ubuntu 22.04 LTS (recommended) or 20.04 LTS |
| Python | 3.12+ |
| MySQL | 8.0+ |
| Nginx | 1.18+ |
| vsFTPd | Any recent version |
| Postfix + Dovecot | Any recent version |
| Root Access | Required for installation |
⚠️ VPS or dedicated server required. Shared hosting will not work. Minimum 1 GB RAM recommended.
The automated installer handles everything — no manual configuration needed.
git clone https://github.com/mayazhanif/SASPanel.git /home/SASPanel
cd /home/SASPanelsudo bash install.shThe script will ask you two questions only:
- Your panel domain (e.g.
panel.yourdomain.com) — must already point to the server IP via DNS - Your admin email address (used for Let's Encrypt SSL notifications)
Everything else is fully automated:
[INFO] Server public IP: 1.2.3.4
Domain: panel.yourdomain.com
Email: admin@yourdomain.com
══ Generating secure credentials ══
[OK] All credentials generated.
══ Saving credentials to /root/saspanel_credentials.txt ══
[OK] Credentials saved (chmod 600)
══ Installing Nginx ... MySQL ... Postfix ... Dovecot ... vsFTPd ══
...
══ Installation Complete! 🎉 ══
Panel URL: http://1.2.3.4:5000
phpMyAdmin: http://1.2.3.4/phpmyadmin
Roundcube: http://1.2.3.4/roundcube
⚠ All credentials saved to: /root/saspanel_credentials.txt
shred -u /root/saspanel_credentials.txt
# Read and save to your password manager
cat /root/saspanel_credentials.txt
# Securely delete the file
shred -u /root/saspanel_credentials.txtNavigate to http://YOUR_SERVER_IP:5000 and log in with your admin credentials.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y \
python3 python3-pip python3-venv \
mysql-server nginx certbot python3-certbot-nginx \
php-common php-cli php-fpm php-mysql php-mbstring php-zip php-gd \
postfix postfix-mysql dovecot-core dovecot-imapd dovecot-pop3d \
dovecot-lmtpd dovecot-mysql vsftpd acl curl wget gitgit clone https://github.com/mayazhanif/SASPanel.git /home/SASPanel
cd /home/SASPanelpython3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install gunicornsudo mysql -u rootALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_STRONG_PASSWORD';
CREATE DATABASE saspanel CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE mail CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES;
EXIT;mysql -u root -p saspanel < scripts/database.sql
mysql -u root -p mail < scripts/mail.sqlcp .env.example .env
nano .env
chmod 600 .envcp Database/sample.config.ini Database/config.ini
nano Database/config.ini
chmod 600 Database/config.inisource venv/bin/activate
python3 -c "
from werkzeug.security import generate_password_hash
import mysql.connector, configparser
cfg = configparser.ConfigParser()
cfg.read('Database/config.ini')
db = mysql.connector.connect(
host=cfg['config']['host'], user=cfg['config']['user'],
password=cfg['config']['password'], database=cfg['config']['database']
)
cur = db.cursor()
cur.execute(
'INSERT INTO administrator (Admin_Name, Admin_Email, Admin_Password) VALUES (%s,%s,%s)',
('Admin', 'admin@yourdomain.com', generate_password_hash('YOUR_ADMIN_PASSWORD'))
)
db.commit()
print('Admin created.')
"sudo cp scripts/saspanel.service /etc/systemd/system/saspanel.service
sudo systemctl daemon-reload
sudo systemctl enable saspanel
sudo systemctl start saspanelserver {
listen 80;
server_name panel.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}sudo certbot --nginx -d panel.yourdomain.com| Variable | Description | Default |
|---|---|---|
SECRET_KEY |
Flask session signing key — required, no default | — |
FLASK_ENV |
production or development |
production |
FLASK_DEBUG |
0 = off, 1 = on (never enable in production) |
0 |
SERVER_NAME |
Trusted panel hostname — prevents Host header injection in password reset links | — |
MAIL_SERVER |
SMTP server hostname | localhost |
MAIL_PORT |
SMTP port | 587 |
MAIL_USERNAME |
SMTP login username | — |
MAIL_PASSWORD |
SMTP login password | — |
MAIL_USE_TLS |
true / false |
true |
LOGIN_RATE_LIMIT |
Max login attempts before 429 | 10 per minute |
SESSION_COOKIE_SECURE |
true = HTTPS-only cookies |
false |
cp .env.example .env
chmod 600 .env[config]
host = localhost
user = root
password = YOUR_STRONG_DB_PASSWORD
database = saspanel
[mail]
server = localhost
email = support@yourdomain.com
password = YOUR_MAIL_PASSWORD🔒 Always run
chmod 600 Database/config.iniafter editing.
sudo systemctl start saspanel
sudo systemctl stop saspanel
sudo systemctl restart saspanel
sudo systemctl status saspanel
# Live logs
tail -f /home/SASPanel/logs/error.log
tail -f /home/SASPanel/logs/audit.logcd /home/SASPanel
source venv/bin/activate
gunicorn --workers 4 --bind 0.0.0.0:5000 --timeout 120 app:appcd /home/SASPanel
source venv/bin/activate
export FLASK_DEBUG=1
python3 app.py
⚠️ Never useFLASK_DEBUG=1in production — it exposes an interactive debugger.
| Protection | Implementation |
|---|---|
| CSRF Protection | Flask-WTF CSRFProtect on every POST form and AJAX request |
| Rate Limiting | Flask-Limiter — configurable per-IP login throttle (default: 10/min) |
| Password Hashing | PBKDF2-SHA256 via Werkzeug; legacy MD5 passwords auto-upgraded on next login |
| Secret Key Enforcement | App refuses to start if SECRET_KEY is missing or set to a default value |
| Security Headers | X-Frame-Options, X-Content-Type-Options, strict Content-Security-Policy, Referrer-Policy |
| CSP Nonces | Inline scripts require nonce="{{ csp_nonce }}" — enforced on every page |
| Session Security | HttpOnly, SameSite=Lax, optional Secure flag |
| SQL Injection | 100% parameterized queries — no string concatenation |
| OS Command Injection | All shell calls use subprocess.run(list) with strict regex input validation |
| IDOR Protection | Every resource fetch scoped to the logged-in admin/user's own records |
| Audit Logging | Security events logged to logs/audit.log |
| Installer Lockout | /installer returns 403 once the database is configured |
| Input Validation | Usernames, domains, DB names validated via strict regex whitelist |
- Delete
/root/saspanel_credentials.txtafter saving passwords -
chmod 600 Database/config.ini && chmod 600 .env - Put Nginx in front of port 5000 and issue SSL
- Set
SESSION_COOKIE_SECURE=trueonce HTTPS is active - Set
SERVER_NAMEto your panel domain
See SECURITY.md for vulnerability reporting.
SASPanel/
├── app.py # Flask application factory, CSP middleware, blueprint registration
├── functions.py # Core helpers: FTP, mail, vhost, SSL, DB, password utils
├── install.sh # Automated one-command installer
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
│
├── routes/
│ ├── __init__.py # Flask Blueprint definition
│ ├── admin_routes.py # All admin panel routes
│ ├── user_routes.py # All user panel routes
│ ├── login_routes.py # Authentication (login, logout, password reset)
│ ├── ajax_routes.py # AJAX endpoints: server stats, domain-by-user lookup
│ ├── custom_pages.py # Installer, misc pages
│ └── security.py # Auth helpers, audit log, input sanitizers
│
├── Database/
│ ├── DbConfig.py # MySQL connection manager (auto-reconnect)
│ ├── config.ini # DB + mail credentials (chmod 600, gitignored)
│ └── sample.config.ini # Template for config.ini
│
├── apps/
│ ├── static/
│ │ ├── css/saspanel.css # Custom sp-* design system (dark theme, CSS variables)
│ │ └── js/ # csrf-inject.js, panel utilities
│ └── templates/
│ ├── layout/ # adminheader.html, adminfooter.html, footer.html
│ ├── adminFiles/ # Admin templates: Domains, FTP, Mail, Databases, SubDomains, CronJobs
│ ├── userFiles/ # User templates (same sections, user-scoped)
│ ├── authentication/ # Login, password reset
│ ├── installer/ # First-run web installer
│ └── error_pages/ # 403, 404, 429, 500
│
├── scripts/
│ ├── database.sql # SASPanel MySQL schema
│ ├── mail.sql # Virtual mail (Postfix/Dovecot) MySQL schema
│ ├── add_vhost.sh # Add Nginx virtual host for a domain
│ ├── ssl_certificate_generate.sh # Issue Let's Encrypt certificate
│ ├── add_cron_job.sh # Add a user cron job
│ └── saspanel.service # systemd service unit file
│
└── logs/ # Runtime logs (gitignored)
├── error.log
├── access.log
├── service.log
└── audit.log # Security event audit trail
python3 -c "import secrets; print(secrets.token_hex(32))"
echo "SECRET_KEY=PASTE_RESULT_HERE" >> /home/SASPanel/.env
sudo systemctl restart saspanelsudo systemctl status mysql
mysql -u root -p -e "SHOW DATABASES;"
cat /home/SASPanel/Database/config.iniThe installer locks itself once the database is connected. Navigate to /login instead.
sudo systemctl status saspanel
curl http://localhost:5000Domains load via AJAX from /ajax/domains_by_user. Check:
- The selected user has at least one non-deleted domain
- Open browser DevTools → Console — error messages are now shown inline
tail -f /home/SASPanel/logs/error.logfor server-side errors
Already fixed — pull the latest code and restart.
tail -f /home/SASPanel/logs/error.log
sudo systemctl status vsftpd # FTP
sudo systemctl status postfix dovecot # Mailpython3 -c "from werkzeug.security import generate_password_hash; print(generate_password_hash('NEW_PASSWORD'))"
mysql -u root -p saspanel -e "UPDATE administrator SET Admin_Password='HASH' WHERE Admin_Email='admin@yourdomain.com';"tail -f /home/SASPanel/logs/error.log # Application errors
tail -f /home/SASPanel/logs/audit.log # Security events
cat /var/log/saspanel_install.log # Installer output- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit:
git commit -m 'feat: describe your change' - Push:
git push origin feature/my-feature - Open a Pull Request
Code style notes:
- All templates must use the
sp-*CSS design system (apps/static/css/saspanel.css) — no Bootstrap classes - All
<script>tags must includenonce="{{ csp_nonce }}" - All DB queries must use parameterized
%splaceholders - All shell commands must go through
functions.pyhelpers with_validate()checks
This project is licensed under the GPL-3.0 License — see the LICENSE file for details.