Skip to content

All-in-one S/QMail server with: s/qmail, dkim, spam filter, imap/pop3, web admin

License

Notifications You must be signed in to change notification settings

semhoun/sqmail_all-in-one

Repository files navigation

SQMail All-In-One

License OpenIssues Version Docker Size Docker Pull

All-in-one S/QMail server with

  • s/qmail
  • spam filter
  • dovecot (imap/pop)
  • web admin
  • Roundcube
  • Fetchmail

Usage

Docker

docker run \
  --name sqmail-aio \
  --publish 80:80 \
  --publish 88:88 \
  --publish 25:25 \
  --publish 465:465 \
  --publish 587:587 \
  --publish 110:110 \
  --publish 995:995 \
  --publish 143:143 \
  --publish 993:993 \
  --volume /opt/mail_data/qcontrol:/var/qmail/control \
  --volume /opt/mail_data/ssl:/ssl \
  --volume /opt/mail_data/domains:/var/vpopmail/domains \
  --volume /opt/mail_data/vpopmail_etc:/var/vpopmail/etc \
  --volume /opt/mail_data/log:/log \
  --volume /opt/mail_data/spamassassin:/var/spamassassin \
  --volume /opt/mail_data/qusers:/var/qmail/users \
  --volume /opt/mail_data/queue:/var/qmail/queue \
  --volume /opt/mail_data/qalias:/var/qmail/alias \
  --volume /opt/mail_data/domainkeys:/var/qmail/ssl/domainkeys
  semhoun/sqmail_all-in-one

Docker Compose

version: '3.8'

services:
  sqmail-aio:
    image: semhoun/sqmail_all-in-one
    volumes:
      - ./data/qcontrol:/var/qmail/control
      - ./data/ssl:/ssl
      - ./data/domains:/var/vpopmail/domains
      - ./data/vpopmail_etc:/var/vpopmail/etc
      - ./data/log:/log
      - ./data/spamassassin:/var/spamassassin
      - ./data/qusers:/var/qmail/users
      - ./data/queue:/var/qmail/queue
      - ./data/qalias:/var/qmail/alias
      - ./data/domainkeys:/var/qmail/ssl/domainkeys
    ports:
      - 80:80
      - 88:88
      - 443:443
      - 25:25
      - 465:465
      - 587:587
      - 110:110
      - 995:995
      - 143:143
      - 993:993

Initialization

Docker

docker run \
  --rm -it \
  --env SKIP_INIT_ENV=1 \
  --volume /opt/mail_data/qcontrol:/var/qmail/control \
  --volume /opt/mail_data/ssl:/ssl \
  --volume /opt/mail_data/domains:/var/vpopmail/domains \
  --volume /opt/mail_data/vpopmail_etc:/var/vpopmail/etc \
  --volume /opt/mail_data/spamassassin:/var/spamassassin \
  --volume /opt/mail_data/qusers:/var/qmail/users \
  --volume /opt/mail_data/queue:/var/qmail/queue \
  --volume /opt/mail_data/qalias:/var/qmail/alias \
  --volume /opt/mail_data/domainkeys:/var/qmail/ssl/domainkeys
  semhoun/sqmail_all-in-one /opt/bin/init.sh
  
docker run \
  --rm -it \
  --env SKIP_INIT_ENV=1 \
  --volume ./mail_data/ssl:/ssl \
  --publish 80:80 \
  semhoun/sqmail_all-in-one /opt/bin/init-certs.sh

Docker Compose

docker compose run -e SKIP_INIT_ENV=1 --rm sqmail-aio /opt/bin/init.sh
docker compose run -e SKIP_INIT_ENV=1 --rm sqmail-aio /opt/bin/init-certs.sh

Docker configuration

Environment

  • SKIP_INIT_ENV - Skip all initialization of docker_entrypoint (like directory, spamassassin, clamav)
  • DEV_MODE - Currently remove some clamav databases

Volumes

  • /ssl - SSL Certificates
  • /var/qmail/control- QMail config files
  • /var/vpopmail/domains - Domains (mail) data
  • /var/vpopmail/etc- vpopmail config files
  • /log - Log directoy
  • /var/spamassassin- SpamAssassin
  • /var/qmail/tmp- QMail temporary directory (best if tmpfs)
  • /var/qmail/users - QMail user file
  • /var/qmail/queue - QMail queue
  • /var/qmail/alias - QMail alias (for local users)
  • /var/qmail/ssl/domainkeys - Domain DKIM private and public keys

Ports

  • 80 - Webmail (roundcube) and SSL Acme certs
  • 88 - HTTP admin (https not provided)
  • 443 - SSL Webmail (roundcube)
  • 25 - SMTP
  • 465 - SMTPs
  • 587 - Submission
  • 110 - POP3
  • 995 - POP3s
  • 143 - IMAP
  • 993 - IMAPs

Useful File Locations

  • /ssl/acme - Letsencrypt SSL data (remove to renew certs installation)
  • /ssl - SSL Certificates
    • /ssl/http.key - Webmail Key
    • /ssl/http.crt - Webmail Certificate
    • /ssl/imap.key - IMAP Key
    • /ssl/imap.crt - IMAP Certificate
    • /ssl/pop.key - POP3 Key
    • /ssl/pop.crt - POP3 Certificate
    • /ssl/smtp.key - SMTP Key
    • /ssl/smtp.crt - SMTP Certificate
  • /opt/bin/init.sh - Initialisation script
  • /opt/bin/init_certs.sh - Certs initialisation script
  • /opt/bin/init_dmarc.sh - Create local dmarc user, and init web interface
    • usage /opt/bin/init_dmarc.sh <email> <password>
  • /opt/bin/lighttpd_admin.sh - Add an user allowed to acces the admin web interface
    • usage /opt/bin/lighttpd_admin.sh <user> <password>
    • Administator user for vqadmin must be admin
  • /opt/bin/mkdkimkey.sh - DKIM key creation
  • /var/qmail/control/dkimdomains - DKIM domains
  • Sending domains other than the default domain and with they own key must be added in this file
  • For more information see https://www.fehcom.de/sqmail/man/qmail-dksign.html
  • /opt/bin/tester.sh - Check is IMAP POP SMTP Clamav and SpamAssasin was working
    • usage tester.sh <test mail recipient> -doit

Built With

Testing

Manual SMTP

You can test the SMTP part with Swaks A simpe test mail could be done with this:

swaks --to <to mail> --from <from email> --server <qmail aio host name>

Auto

You can check IMAP POP SMTP Clamav and SpamAssasin configuration inside the docker with tester.sh script. A valid mail account must used (a temporay is also created for testing). Docker must be running during the tests.

Docker

docker exec -it sqmail-aio /opt/bin/tester.sh <receipient email> -doit

Docker compose

docker compose exec sqmail-aio /opt/bin/tester.sh <receipient email> -doit

Find Me

Authors

  • Nathanaël Semhoun - Docker creation - semhoun

License

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

Acknowledgments

This docker use sources and patches from