Skip to content

kirpicheff/mailserver

Repository files navigation

Kirpich MailServer

Build Status Platform License

Comprehensive, lightweight, and high-performance mail server based on Alpine Linux 3.19. Designed for speed, security, and ease of management.

🚀 Key Features

  • Full Stack: Postfix, Dovecot, MariaDB, Rspamd, and Nginx.
  • Webmail Options: Built-in Roundcube and SnappyMail.
  • ActiveSync: Z-Push support for mobile synchronization.
  • Security: Integrated Fail2ban, OpenDKIM, and Rspamd for spam filtering.
  • Admin Panel: Custom MailAdmin UI for easy domain and mailbox management.
  • Performance: Optimized TCP stack and lightweight Alpine footprint.
  • Auto-SSL: Built-in Let's Encrypt support via Certbot.

📸 Screenshots

![Dashboard](screenshots/dashboard.png)
<!-- slide -->
![Mail Domains](screenshots/domains.png)
<!-- slide -->
![Mailboxes](screenshots/mailboxes.png)
<!-- slide -->
![Admin Tools](screenshots/tools.png)
<!-- slide -->
![Audit Log](screenshots/audit.png)

🛠 Quick Start

Important

This repository does not include the mailadmin binary. You must download the latest release from the MailAdmin repository and place it in rootfs/opt/mailadmin/mailadmin before building the Docker image.

To run the mail server, use the following command:

docker run -d \
    --name mailserver \
    --restart unless-stopped \
    -v /opt/mailserver/data:/data \
    -v /opt/mailserver/certs:/etc/letsencrypt \
    -e MARIADB_USER=postfix \
    -e MARIADB_PASS=password \
    -e SETUP_PASSWORD=admin \
    -e MAIN_DOMAIN=example.com \
    -e MAIL_SERVER=mail.example.com \
    -p 25:25 -p 80:80 -p 443:443 -p 465:465 -p 587:587 -p 993:993 -p 4190:4190 -p 9999:9999 \

    kirpich/mailserver

🔓 Ports

Port Protocol Service Description
25 TCP SMTP Mail transfer between servers
80/443 TCP HTTP/S Webmail and Admin UI
465 TCP SMTPS Secure SMTP (Submission)
587 TCP STARTTLS SMTP Submission
993 TCP IMAPS Secure IMAP access
4190 TCP SIEVE Remote Sieve management
9999 TCP ADMIN MailAdmin custom panel

🌐 DNS Requirements

For your mail server to work correctly and not end up in spam, you MUST configure these records in your DNS:

  • MX Record: example.com. IN MX 10 mail.example.com.
  • A Record: mail.example.com. IN A <Your-IP>
  • SPF (TXT): v=spf1 mx a -all
  • DKIM (TXT): Get the public key from the Admin UI or /data/dkim/mail.txt and add it as a TXT record for mail._domainkey.
  • DMARC (TXT): _dmarc IN TXT "v=DMARC1; p=none; rua=mailto:admin@example.com"

⚙️ Environment Variables

Variable Description Default
MAIN_DOMAIN Your primary mail domain example.com
MAIL_SERVER FQDN of the mail server mail.example.com
MARIADB_USER Database user for mail services postfix
MARIADB_PASS Database password password
SETUP_PASSWORD Password for the MailAdmin panel admin
MESSAGE_SIZE Max email size (bytes) 52428800
UPLOAD_SIZE PHP Upload Max Filesize 25M

📁 Persistence

All important data is stored in the /data volume (map this to a persistent path on your host):

  • /data/mail: Mailboxes (vmail storage)
  • /data/mysql: MariaDB databases and system tables
  • /data/cert: Let's Encrypt certificates
  • /data/dkim: OpenDKIM keys and configs
  • /data/rspamd: Spam filtering rules, Bayes databases, and maps
  • /data/fail2ban: Security logs and sqlite database

🔄 Updates

To update to the latest version, run:

docker pull kirpich/mailserver
docker stop mailserver
docker rm mailserver
# Re-run your start command or script

Note

If you are using the source repository, you can use the included update.sh (for regular updates) or upgrade.sh (for database migrations) helper scripts.

🛡 Security

Warning

Never commit real passwords, domains, or IP addresses to this repository. All sensitive data should be passed via environment variables or handled outside of version control.

If you have accidentally committed sensitive data, please follow these steps:

  1. Change all compromised passwords and keys immediately.
  2. Use tools like git filter-repo or BFG Repo-Cleaner to remove sensitive data from your git history.
  3. Update your local and remote repositories.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Comprehensive, lightweight, and high-performance mail server based on Alpine Linux 3.19. Designed for speed, security, and ease of management.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors