# MissionControl-Mail
**Repository Path**: yujintong/MissionControl-Mail
## Basic Information
- **Project Name**: MissionControl-Mail
- **Description**: The first open-source control panel that unifies Postfix, Dovecot and Rspamd into a modern REST API + web interface โ deploy in 10 minutes,
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-10-09
- **Last Updated**: 2026-10-09
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ๐ MissionControl
> **The first open-source control panel that unifies Postfix, Dovecot and Rspamd into a modern REST API + web interface โ deploy in 10 minutes, zero bloat.**
---




### ๐ฅ Single stack. Single command deploy. Zero lock-in.
---
## โจ The Problem
Running a mail server has always been **expensive, complex, and fragile**:
| Solution | Problem |
|---------|----------|
| **cPanel / Plesk** | Expensive ($20+/mo), proprietary, bloated |
| **ISPConfig** | Legacy PHP, dated UX, technical debt |
| **Mailcow / Mailu** | Docker-dependent, extra complexity, container overhead |
| **PostfixAdmin** | Admin web only โ no API, no monitoring, no anti-spam |
| **DIY scripts** | Fragile shell scripts, no API, no UI, painful maintenance |
**MissionControl was born from a simple insight:**
1. The Unix mail stack (Postfix + Dovecot + Rspamd) is **battle-tested, decades-proven, and incredibly efficient** โ tens of thousands of emails/min with < 256MB RAM.
2. What's missing is **a modern management layer**: REST API, SPA dashboard, auto health repair, and reproducible deployment.
---
## ๐ฏ What Makes MissionControl Different
### ๐ฌ Technical Innovation
| Feature | MissionControl | Mailcow | ISPConfig | cPanel |
|---|---|---|---|---|
| **Native REST API** (FastAPI) | โ
First-class | โ PHP wrapper | โ Legacy PHP | โ Proprietary |
| **Auto self-healing** | โ
Detects & restarts failed services | โ | โ | โ |
| **Rspamd anti-spam** (state-of-the-art) | โ
Native + adjustable scores | โ
| โ SpamAssassin | โ SpamAssassin |
| **DKIM / DMARC / SPF wizard** | โ
Per-domain auto setup | โ
Partial | โ Manual | โ
|
| **Real-time system metrics** | โ
CPU, RAM, Disk, Network via API | โ | โ | โ
|
| **Cloudflare DNS integration** | โ
Auto wizard | โ | โ | โ
(paid) |
| **Full audit logging** | โ
Every action logged | โ | โ | โ
|
| **Single-command deploy** | โ
`sudo bash deploy.sh` | โ Docker Compose | โ Manual | โ Installer |
| **Disk footprint** | ~150MB + data | ~2GB (Docker images) | ~500MB | ~2GB+ |
| **No Docker required** | โ
Bare-metal performance | โ Mandatory | N/A | N/A |
| **Zero lock-in** | โ
Plain configs, easy migration | โ Docker-dependent | โ
| โ |
### ๐ Performance
A MissionControl server with **2GB RAM and 2 vCPUs** handles:
- **50+ domains**
- **500+ mailboxes**
- **10,000+ emails/hour** with full Rspamd filtering
- API latency < 50ms (p95)
- Downtime < 30s on service failures (auto-repair)
---
## ๐๏ธ Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Internet โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
:25/SMTP :80/443
โ โ
โโโโโโโผโโโโโโโ โโโโโโโผโโโโโโโโโโโ
โ Postfix โ โ Apache โ
โ MTA โ โ Proxy + SPA โ
โ + milter โ โ โ
โโโโฌโโโโฌโโโโโโ โโโโฌโโโฌโโโโโโโโโโโโ
โ โ โ โ
:11332โ โ :8000โ โ
โ โ โ โ
โโโโโโโผโโโโดโโโโโโ โโโโโโผโโโผโโโโโโโโโโโโ
โ Rspamd โ โ FastAPI (Python) โ
โ Anti-spam โ โ REST API :8000 โ
โ DKIM signing โ โ + Auto-repair โ
โ Rate limit โ โ + Metrics โ
โโโโโโโโโโโโโโโโโ โโโโโโฌโโโฌโโโโโโโโโโโโ
โ โ
โโโโโโผโโโผโโโโโ
โ MariaDB โ
โ + Redis โ
โโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Dovecot IMAP/POP3 โ
โ LMTP delivery โ Maildir โ
โ SASL auth for Postfix โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### ๐ Inbound Mail Flow
```
Remote MTA โ :25 (Postfix) โ Rspamd milter (SPF/DKIM/DMARC/greylist)
โ LMTP Dovecot โ Maildir (/var/vmail/domain/user/)
```
### ๐ Outbound Mail Flow
```
MUA โ :587 STARTTLS (Postfix) โ SASL Dovecot โ MySQL โ Rspamd DKIM signing
โ DNS MX lookup โ Destination MTA
```
---
## โก Single-Command Deploy
```bash
git clone projects-mc-yournet
cd projects-mc-yournet
sudo bash deploy.sh
```
The script **prompts only for domain and IP** โ everything else is auto-generated:
```
๐ Passwords: openssl rand (DB, JWT, admin)
๐ง Hashes: bcrypt (admin, mailboxes)
๐ SSL cert: Self-signed (10 years)
๐๏ธ Database: MariaDB + 16 tables
๐ฆ Packages: Postfix, Dovecot, Rspamd, Apache, Redis
โ๏ธ Configs: Applied + placeholders substituted
๐งช Health check: Automatic post-deploy verification
```
Output:
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MissionControl โ Deploy completed successfully!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Web UI: http://YOUR_SERVER_IP
API Docs: http://YOUR_SERVER_IP/docs
Admin: admin
Password: adminK8sL2pX9zQ (randomly generated)
SMTP: YOUR_SERVER_IP:25
SMTPS: YOUR_SERVER_IP:465
Submission: YOUR_SERVER_IP:587 (STARTTLS)
IMAP: YOUR_SERVER_IP:143
IMAPS: YOUR_SERVER_IP:993
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## ๐งช Built-in Test Suite
```bash
bash tests/run-all-tests.sh
```
| Test | What it verifies |
|------|-----------------|
| `01-test-smtp.sh` | Ports 25/465/587, STARTTLS, EHLO, send via API |
| `02-test-imap.sh` | Ports 143/993, STARTTLS, login, LIST/SELECT/FETCH |
| `03-test-api.sh` | 20+ endpoints (health, auth, domains, mailboxes, metrics) |
| `04-test-webmail.sh` | Roundcube (if installed) |
| `05-test-dns.sh` | MX, SPF, DKIM, DMARC, PTR, delivery via swaks |
---
## ๐ก๏ธ Security
- โ
**Zero .env files in repository** โ all secrets generated during install
- โ
**Random admin password** (15+ alphanumeric characters)
- โ
**JWT secret** generated with `openssl rand -hex 32`
- โ
**bcrypt hashing** for all passwords (factor 10)
- โ
**Server .env files** protected with `chmod 600`
- โ
**UFW firewall** auto-configured (minimal port exposure)
- โ
**SQL injection protected** (SQLAlchemy ORM + parameterized queries)
- โ
**Configurable CORS** origins
- โ
**Rate limiting** via Rspamd
---
## ๐ฆ Components
| Component | Version | Role |
|-----------|---------|------|
| **FastAPI** (Python 3.11+) | 0.110+ | Async REST API with auto-generated Swagger docs |
| **React SPA** | 18+ | Modern web dashboard (pre-compiled) |
| **Postfix** | 3.7+ | MTA โ SMTP, virtual domains, SASL auth |
| **Dovecot** | 2.3+ | IMAP/POP3, LMTP delivery, SASL auth provider |
| **Rspamd** | 3.7+ | Anti-spam, DKIM signing, rate limiting, greylisting |
| **MariaDB** | 10.11+ | Primary storage (users, domains, mailboxes) |
| **Redis** | 7+ | Cache, sessions, Rspamd history |
| **Apache** | 2.4+ | Reverse proxy + static file server |
| **systemd** | 252+ | Service supervision, auto-restart |
---
## ๐ Complete REST API
| Resource | Endpoint | Description |
|----------|----------|-------------|
| **Auth** | `POST /api/v1/auth/login` | JWT authentication |
| **Health** | `GET /api/v1/health/check` | Full server health status |
| **Domains** | `CRUD /api/v1/domains/` | Domain management |
| **Mailboxes** | `CRUD /api/v1/mailboxes/` | Mailbox CRUD + quota |
| **Aliases** | `CRUD /api/v1/aliases` | Email forwarding |
| **Spam** | `GET /api/v1/spam/stats` | Rspamd statistics |
| **Metrics** | `GET /api/v1/metrics/system` | CPU, RAM, Disk, Network |
| **DNS** | `POST /api/v1/dns/wizard` | DNS records wizard |
| **Audit** | `GET /api/v1/audit/logs` | Full audit trail |
| **Swagger** | `GET /docs` | Interactive API documentation |
---
## ๐ง Production Checklist
```bash
# Let's Encrypt SSL
certbot --apache -d mail.yourdomain.com
# Point Postfix and Dovecot to LE certs
postconf -e "smtpd_tls_cert_file=/etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem"
postconf -e "smtpd_tls_key_file=/etc/letsencrypt/live/mail.yourdomain.com/privkey.pem"
ln -sf /etc/letsencrypt/live/mail.yourdomain.com/privkey.pem /etc/dovecot/private/dovecot.key
ln -sf /etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem /etc/dovecot/private/dovecot.pem
# Configure DNS records
# MX โ mail.yourdomain.com (priority 10)
# SPF โ "v=spf1 mx ~all"
# DKIM โ via MissionControl admin panel
# DMARC โ "v=DMARC1; p=quarantine"
# Restrict API CORS to your domain
sed -i 's/CORS_ORIGINS=\["\*"\]/CORS_ORIGINS=\["https:\/\/mail.yourdomain.com"\]/' \
/opt/missioncontrol/backend/.env
```
---
## ๐ Repository Structure
```
projects-mc-yournet/
โโโ deploy.sh โ The only command you need
โโโ configs/ โ Anonymized configs (Postfix, Dovecot, Rspamd, Apache)
โโโ backend/ โ Python API (57 files)
โ โโโ app/api/ โ 19 REST endpoints
โ โโโ app/models/ โ 16 SQLAlchemy tables
โ โโโ app/services/ โ Business logic
โโโ frontend/ โ Compiled React SPA
โโโ sql/ โ Schema + seed + reset
โโโ tests/ โ Test suite
โโโ README.md โ This file
```
---
## ๐ก Roadmap
- [x] Full REST API + SPA dashboard
- [x] Single-command deploy (no Docker)
- [x] Auto service repair (self-healing)
- [x] Real-time system metrics
- [x] Rspamd anti-spam + DKIM/DMARC/SPF
- [x] Cloudflare DNS wizard
- [x] Complete audit logging
- [x] Built-in test suite
- [ ] CI/CD pipeline
- [ ] Ansible playbook / Terraform module
- [ ] Integrated Roundcube webmail
- [ ] Mobile app (React Native)
- [ ] Prometheus metrics exporter
---
## ๐ค Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines on:
- Reporting bugs & feature requests
- Submitting pull requests
- Development setup
- Coding standards
- Testing
---
## ๐ License
Apache 2.0 โ See [LICENSE](LICENSE) for full text.
---
**MissionControl โ Because managing email shouldn't be the hardest part of your day.**
Built with โค๏ธ by Josรฉ Rinaldi (joserinaldi-l) โ for sysadmins who deserve better tools.