How do I debug "SSL routines::wrong version number " #4503
Replies: 2 comments 9 replies
-
Start with a minimal reproduction example. I would suggest just a plain Docker container or with Docker Compose first to get that working well, then you can troubleshoot to the equivalent config in the helm chart. Generally you start with the bare minimum and slowly introduce any additional config until the problem appears, then you can better identify the cause. It can sometimes be a slow process, and while additional effort if you share your solution (especially if you contribute to docs), it can help others avoid that mistake (or resolve it faster). Basic DMS config
name: basic-dms
services:
dms:
image: ghcr.io/docker-mailserver/docker-mailserver:latest # :15.0
hostname: mail.example.test
environment:
# Minimize container startup time and reduce complexity:
ENABLE_AMAVIS: 0
ENABLE_OPENDKIM: 0
ENABLE_OPENDMARC: 0
ENABLE_POLICYD_SPF: 0
configs:
- source: dms-accounts
target: /tmp/docker-mailserver/postfix-accounts.cf
# NOTE:
# - `$$` is required to escape `$` from ENV interpolation (Docker Compose feature)
# - Both accounts have the same password: `secret`
configs:
dms-accounts:
content: |
jane.doe@example.test|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
john.doe@example.test|{SHA512-CRYPT}$$6$$sbgFRCmQ.KWS5ryb$$EsWrlYosiadgdUOxCBHY0DQ3qFbeudDhNMqHs6jZt.8gmxUwiLVy738knqkHD4zj4amkb296HFqQ3yDq4UXt8.
services:
dms:
environment:
SSL_TYPE: manual
SSL_KEY_PATH: /srv/tls/key.pem
SSL_CERT_PATH: /srv/tls/cert.pem
configs:
- source: tls-cert
target: /srv/tls/cert.pem
- source: tls-key
target: /srv/tls/key.pem
# Optional - Allows clients in the container to verify cert trust with the CA that signed it:
#- source: tls-ca-cert
# target: /usr/local/share/ca-certificates/ca-smallstep.crt
#- source: script-trust-private-ca
# target: /tmp/docker-mailserver/user-patches.sh
configs:
script-trust-private-ca:
content: |
#!/bin/bash
update-ca-certificates
# Example ECDSA cert files for testing locally:
tls-ca-cert:
content: |
-----BEGIN CERTIFICATE-----
MIIBfTCCASKgAwIBAgIRAMAZttlRlkcuSun0yV0z4RwwCgYIKoZIzj0EAwIwHDEa
MBgGA1UEAxMRU21hbGxzdGVwIFJvb3QgQ0EwHhcNMjEwMTAxMDAwMDAwWhcNMzEw
MTAxMDAwMDAwWjAcMRowGAYDVQQDExFTbWFsbHN0ZXAgUm9vdCBDQTBZMBMGByqG
SM49AgEGCCqGSM49AwEHA0IABJX2hCtoK3+bM5I3rmyApXLJ1gOcVhtoSSwM8XXR
SEl25Kkc0n6mINuMK8UrBkiBUgexf6CYayx3xVr9TmMkg4KjRTBDMA4GA1UdDwEB
/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMB0GA1UdDgQWBBQD8sBrApbyYyqU
y+/TlwGynx2V5jAKBggqhkjOPQQDAgNJADBGAiEAi8N2eOETI+6hY3+G+kzNMd3K
Sd3Ke8b++/nlwr5Fb/sCIQDYAjpKp/MpTDWICeHC2tcB5ptxoTdWkTBuG4rKcktA
0w==
-----END CERTIFICATE-----
tls-key:
content: |
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIOc6wqZmSDmT336K4O26dMk1RCVc0+cmnsO2eK4P5K5yoAoGCCqGSM49
AwEHoUQDQgAEFOWNgekKKvUZE89vJ7henUYxODYIvCiHitRc2ylwttjqt1KUY1cp
q3jof2fhURHfBUH3dHPXLHig5V9Jw5gqeg==
-----END EC PRIVATE KEY-----
tls-cert:
content: |
-----BEGIN CERTIFICATE-----
MIIB9DCCAZqgAwIBAgIQE53a/y2c//YXRsz2kLm6gDAKBggqhkjOPQQDAjAcMRow
GAYDVQQDExFTbWFsbHN0ZXAgUm9vdCBDQTAeFw0yMTAxMDEwMDAwMDBaFw0zMTAx
MDEwMDAwMDBaMBkxFzAVBgNVBAMTDlNtYWxsc3RlcCBMZWFmMFkwEwYHKoZIzj0C
AQYIKoZIzj0DAQcDQgAEFOWNgekKKvUZE89vJ7henUYxODYIvCiHitRc2ylwttjq
t1KUY1cpq3jof2fhURHfBUH3dHPXLHig5V9Jw5gqeqOBwDCBvTAOBgNVHQ8BAf8E
BAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBSz
w74g+O6dcBbwienD70D8A9ESmDAfBgNVHSMEGDAWgBQD8sBrApbyYyqUy+/TlwGy
nx2V5jBMBgNVHREERTBDghFtYWlsLmV4YW1wbGUudGVzdIIVbWFpbC5kZXN0aW5h
dGlvbi50ZXN0ghdzbXRwLnJlbGF5LXNlcnZpY2UudGVzdDAKBggqhkjOPQQDAgNI
ADBFAiEAoety5oClZtuBMkvlUIWRmWlyg1VIOZ544LSEbplsIhcCIHb6awMwNdXP
m/xHjFkuwH1+UjDDRW53Ih7KZoLrQ6Cp
-----END CERTIFICATE-----Test commandsExample swaks commands. You can remove the # Start DMS:
docker compose up -d --force-recreate
# Shell into the container to use swaks CLI:
docker compose exec -it dms bash
# Send test mail to port 25 via plain text (unencrypted):
swaks --server mail.example.test --port 25 --from jane.doe@example.test --to john.doe@example.test --silentThis time with TLS, we'll specify both YAML configs this time to merge the TLS config into the main # Start DMS again, now with TLS enabled:
docker compose --file compose.yaml --file with-tls.yaml up -d --force-recreate
docker compose exec -it dms bash
# Sending test mail to port 25 via STARTTLS (encrypted):
swaks --server mail.example.test --port 25 -tls --from jane.doe@example.test --to john.doe@example.test --silentThis example was a little simplified because we skipped DNS records and we also did it all within the same container and system. However that seems to be sufficient for the failure you were running into, so it might not need to be complicated beyond that. |
Beta Was this translation helpful? Give feedback.
-
|
You setup looks similar to mine. I would say make it work first without the proxy protocol. Once that works, then you know the host name and certificate line up. It has been quite a while since I looked at this, but port 465 needed special handling:
See: https://www.postfix.org/postconf.5.html And: Maybe HaProxy is doing something different than nginx (https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/) which is what I am using to forward ports to the k8 cluster? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have just set up the current version of docker-mailserver, using the Helm chart
docker-mailserver-4.2.1.Kubernetes versions are:
My cluster is managed by DigitalOcean and has one node at present.
The logs appeared normal until I used
setup email addto create the first account. Then I get an endless cycle of these log messages:setup email listgives me a list of accounts without any errors.When I use
swaksto a just-created user from a shell in the docker-mailserver pod:I get the error
Recipient address rejected: User unknown in virtual mailbox tableand the log containsdovecot: auth: passwd-file(skapi@new.hominidsoftware.com): unknown useramid all the stuff above.A second email using swaks is rejected with
554 5.7.1 Spam message rejectedand that also appears in the log amid all the stuff above.I didn't see anything that appears relevant in https://docker-mailserver.github.io/docker-mailserver/latest/faq/
How do i go about debugging this?
Beta Was this translation helpful? Give feedback.
All reactions