By default the mailserver uses a shared data-tls volume with internally generated certificates. To use external certificates (e.g. Let’s Encrypt), mount certificate and key files into the MTA and MDA containers.
- MDA (Dovecot):
/etc/dovecot/tls/tls.crt,/etc/dovecot/tls/tls.key - MTA (Postfix):
/etc/postfix/tls/tls.crt,/etc/postfix/tls/tls.key
In deploy/compose/mda.yaml, replace the data-tls volume with file mounts:
volumes:
- data-mail:/srv/vmail
- /path/to/certificate.crt:/etc/dovecot/tls/tls.crt:ro
- /path/to/private.key:/etc/dovecot/tls/tls.key:roIn deploy/compose/mta.yaml, replace the data-tls volume with file mounts:
volumes:
- /path/to/certificate.crt:/etc/postfix/tls/tls.crt:ro
- /path/to/private.key:/etc/postfix/tls/tls.key:roIf you no longer need internal certificate generation, remove the SSL service from your compose stack so it does not overwrite or conflict with your certificates.
bin/production.sh up -d mta mdaIf certificates are in /etc/letsencrypt/live/yourdomain.com/:
# mda
- /etc/letsencrypt/live/yourdomain.com/fullchain.pem:/etc/dovecot/tls/tls.crt:ro
- /etc/letsencrypt/live/yourdomain.com/privkey.pem:/etc/dovecot/tls/tls.key:ro
# mta
- /etc/letsencrypt/live/yourdomain.com/fullchain.pem:/etc/postfix/tls/tls.crt:ro
- /etc/letsencrypt/live/yourdomain.com/privkey.pem:/etc/postfix/tls/tls.key:roUse fullchain.pem so the chain is complete.
- Format: PEM (
.crt,.pem,.key). - Permissions: Certificate and key readable by the container user; key with restricted permissions (e.g. 600).
If TLS errors appear, check paths and permissions and review MTA/MDA logs: bin/production.sh logs mta, bin/production.sh logs mda.