Certificate renewal runbook
Certificate handling is the most important recurring operational concern in this architecture.
There are two certificate layers:
Web HTTPS:
Traefik serves its own certificate.
Mail protocols:
Traefik ACME data
→ certificate dumper
→ shared volume
→ Stalwart
Traefik renews the Let’s Encrypt certificate.
The certificate dumper updates:
/data/certs/cert.pem
/data/certs/key.pem
Stalwart must then reload those files.
Monthly certificate check
Check SMTP:
openssl s_client \
-connect mail.example.com:465 \
-servername mail.example.com \
</dev/null 2>/dev/null |
openssl x509 -noout -subject -issuer -dates
Check IMAP:
openssl s_client \
-connect mail.example.com:993 \
-servername mail.example.com \
</dev/null 2>/dev/null |
openssl x509 -noout -subject -issuer -dates
Set a reminder at least 30 days before expiration.
Renewal procedure
When Traefik renews the certificate:
Inspect the certificate-dumper logs.
Confirm
cert.pemhas a new expiration date.Open Stalwart administration.
Run Reload TLS certificates.
Retest ports 465 and 993 externally.
If Stalwart still serves the old certificate, restart only the Stalwart container.
Check the extracted certificate inside the container
CONTAINER=$(docker ps \
--filter name=stalwart-mail \
--format '{{.Names}}' |
head -1)
docker exec "$CONTAINER" \
openssl x509 \
-in /data/certs/cert.pem \
-noout \
-subject \
-issuer \
-dates
Check certificate-dumper logs
DUMPER=$(docker ps \
--filter name=stalwart-cert-dumper \
--format '{{.Names}}' |
head -1)
docker logs --since 1h "$DUMPER"
Certificate failure recovery
If secure IMAP or SMTP begins failing:
Confirm
mail.example.comstill resolves correctly.Confirm Dokploy’s web certificate is valid.
Confirm the ACME file exists.
Confirm the dumper produced
cert.pemandkey.pem.Confirm the Stalwart certificate paths are correct.
Reload TLS certificates.
Restart Stalwart if necessary.
Verify ports 465 and 993 again.
Security checklist
Use separate accounts:
Administrator account:
Used only for administration
Mailbox account:
Used by mail, calendar, and contact clients
Recommended security settings:
Administrator 2FA enabled
Strong unique mailbox password
App password for clients when using 2FA
No open SMTP relay
Permissive CORS disabled
HSTS enabled
Port 8080 not published publicly
Unused mail ports not published
Production image pinned to a tested release
Offsite backups enabled
Public ports should normally be limited to:
25
465
587
993
Ports 80 and 443 remain managed by Dokploy.
Comments