docker-mailserver: question: How to configure Traefik for port 465? (Postfix smtpd throws TLS library error)
š Preliminary Checks
- I tried searching for an existing issue and followed the debugging docs advice, but still need assistance.
š What Happened?
Hello, after having carefully followed every step reported in #3063 I still do not manage in any way running implicit TLS SMTP meanwhile implicit imap works, wondering how to interpret these logs I get
š Reproduction Steps
Use DMS behind Traefik reverse proxy
š DMS Version
v12.1.0
š» Operating System and Architecture
Linux server 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
āļø Container configuration files
Dovecot config override:
haproxy_trusted_networks = 172.25.0.2, 32
haproxy_timeout = 3 secs
service imap-login {
inet_listener imaps {
haproxy = yes
ssl = yes
port = 10993
}
}
postfix-master.cf:
submission/inet/smtpd_upstream_proxy_protocol=haproxy
submissions/inet/smtpd_upstream_proxy_protocol=haproxy
postfix-main.cf
postscreen_upstream_proxy_protocol = haproxy
compose.yaml:
services:
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:latest
restart: always
container_name: mailserver
hostname: mail.domain.com
env_file: mailserver.env
volumes:
- ${DOCKER_VOLUMES_FOLDER}/dms/mail-data/:/var/mail/
- ${DOCKER_VOLUMES_FOLDER}/dms/mail-state/:/var/mail-state/
- ${DOCKER_VOLUMES_FOLDER}/dms/mail-logs/:/var/log/mail/
- ${DOCKER_VOLUMES_FOLDER}/dms/config/:/tmp/docker-mailserver/
- /etc/localtime:/etc/localtime:ro
- ${DOCKER_VOLUMES_FOLDER}/traefik/acme.json:/etc/letsencrypt/acme.json:ro
cap_add:
- NET_ADMIN
stop_grace_period: 1m
environment:
- SSL_TYPE=letsencrypt
- SSL_DOMAIN=domain.com # using wildcard cert
healthcheck:
test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
timeout: 3s
retries: 0
labels:
- "traefik.enable=true"
- "traefik.tcp.routers.smtp.rule=HostSNI(`*`)"
- "traefik.tcp.routers.smtp.entrypoints=smtp"
- "traefik.tcp.routers.smtp.service=smtp"
- "traefik.tcp.services.smtp.loadbalancer.server.port=25"
- "traefik.tcp.services.smtp.loadbalancer.proxyProtocol.version=1"
- "traefik.tcp.routers.smtp-ssl.rule=HostSNI(`*`)"
- "traefik.tcp.routers.smtp-ssl.tls=false"
- "traefik.tcp.routers.smtp-ssl.entrypoints=smtp-ssl"
- "traefik.tcp.routers.smtp-ssl.service=smtp-ssl"
- "traefik.tcp.services.smtp-ssl.loadbalancer.server.port=465"
- "traefik.tcp.services.smtp-ssl.loadbalancer.proxyProtocol.version=1"
- "traefik.tcp.routers.imap-ssl.rule=HostSNI(`*`)"
- "traefik.tcp.routers.imap-ssl.entrypoints=imap-ssl"
- "traefik.tcp.routers.imap-ssl.service=imap-ssl"
- "traefik.tcp.services.imap-ssl.loadbalancer.server.port=10993"
- "traefik.tcp.services.imap-ssl.loadbalancer.proxyProtocol.version=2"
- "traefik.tcp.routers.sieve.rule=HostSNI(`*`)"
- "traefik.tcp.routers.sieve.entrypoints=sieve"
- "traefik.tcp.routers.sieve.service=sieve"
- "traefik.tcp.services.sieve.loadbalancer.server.port=4190"
networks:
proxy:
ipv4_address: 172.25.0.12
š Relevant log output
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:27:27 mail postfix/smtps/smtpd[415654]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:27:28 mail postfix/smtps/smtpd[415654]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
Sep 23 12:42:20 mail postfix/smtps/smtpd[417225]: connect from traefik.proxy[172.25.0.2]
Sep 23 12:42:20 mail postfix/smtps/smtpd[417225]: SSL_accept error from traefik.proxy[172.25.0.2]: -1
Sep 23 12:42:20 mail postfix/smtps/smtpd[417225]: warning: TLS library problem: error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
Sep 23 12:42:20 mail postfix/smtps/smtpd[417225]: lost connection after CONNECT from traefik.proxy[172.25.0.2]
Sep 23 12:42:20 mail postfix/smtps/smtpd[417225]: disconnect from traefik.proxy[172.25.0.2] commands=0/0
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 24 (14 by maintainers)
Hello, thank you for the helpā¦
compose.yml
traefik.yml
I commented out the mailserver.env and deleted the imap config file
When including
-servernameflag I also get āVerification: OKā (same output)Looking the docker logs of the container:
However when connecting from an external client (no vpn), or a client from the server itself (with wireguard vpn & split dns) the same error logs happen:
Trying with Thunderbird returns: āThunderbird failed to find the settings for your accountā
I thank you again for the very detailed answer, if you have no time please I will just keep trying by myself.
@polarathene I have use VSCode, itās seems to be the default behavior https://stackoverflow.com/questions/50162952/vs-code-end-of-file-new-line-not-persisting. Thank for the fix, it probably will prevent some headaches š
What did you want to highlight?? Itās right there on the page you linked:
If you switch to a version prior to v13, such as v12.1 you have the old config:
While on the v13 release page I linked, under the āBreaking Changesā section (which you should always check when upgrading major versions of DMS) we also highlight this change:
If you know that you have a custom
postfix-master.cfconfig related tosmtps, then youād know to adjust for that too (or at least check the docs page related to that change you added).@polarathene Iām using latest tag for docker images, maybe I did some tries to make it work back in a past with older version and this smtps to submission change isnāt an easy one to spot as part of examples section in documentation (https://docker-mailserver.github.io/docker-mailserver/latest/examples/tutorials/mailserver-behind-proxy/) Maybe it worth to highlight this part in documentation?
Can confirm after @cypx change in config 465 started to work for me with traefik and config from examples
I just run into the same issue with version 13.1.0 & 13.2.0.
To fix the problem I need to add
smtps/inet/smtpd_upstream_proxy_protocol=haproxyline to the postfix-main.cf file:Also itās seems the container must be delete to update the configuration when the line is added or removed (so itās easy to mislead) .
Hello, as said since the first comment your help and time was very appreciated. I always managed to have DMS working with nginx-proxy, had to switch to traefik and now Iām in the same situation as the author of the issue you linked: thunderbird not working (auto discover failing) and have been trying to make this work for three weeks now, I think many misunderstandings could have been avoided with a better documentation, if I will ever manage I can cover this providing a working traefik config even because Iām on an ideal environment I guess: vps, open ports with ufw, having only 3 containers running and nothing fancy; plus traefik gained popularity so other duplicate (useless) issues like mine may be even more in the close future (quite curious that the issue you linked has been opened few days after mine). I even checked with a ticket if my hosting was blocking some ports since I read somewhere that it may happen (mostly with 25 but asked anyway).
At the time of my last comment I knew that passthrough makes sense only when tls is enabled too but, just for safety, I did try all the permutations with no success before commenting
traefik never terminated with tls on the dms endpoints, indeed we already have, for each endpoint
- "traefik.tcp.routers.smtp-ssl.tls=false"and, just for safety I also enabled- "traefik.tcp.routers.smtp-ssl.tls.passthrough=true"but still same error