postal icon indicating copy to clipboard operation
postal copied to clipboard

ERROR: An error occurred while attempting to establish an SSL or TLS connection in Postal smtp

Open winsta opened this issue 5 years ago • 12 comments

can't connect postal SMTP via tls Its shows an error. Connected to smtp://mydomain:25/?starttls=always << 220 mydomain ESMTP Postal/SVYGBU

EHLO [172.31.10.74] << 250-My capabilities are << 250-STARTTLS << 250 AUTH CRAM-MD5 PLAIN LOGIN STARTTLS << 220 Ready to start TLS ERROR: An error occurred while attempting to establish an SSL or TLS connection. This usually means that the SSL certificate presented by the server is not trusted by the system for one or more of the following reasons:

  1. The server is using a self-signed certificate which cannot be verified.
  2. The local system is missing a Root or Intermediate certificate needed to verify the server's certificate.
  3. A Certificate Authority CRL server for one or more of the certificates in the chain is temporarily unavailable.
  4. The certificate presented by the server is expired or invalid. It is also possible that the set of SSL/TLS protocols supported by the client and server do not match. See https://github.com/jstedfast/MailKit/blob/master/FAQ.md#SslHandshakeException for possible solutions.

See SMTP server configuration in postal.yml smtp_server: tls_enabled: true tls_certificate_path: /etc/letsencrypt/live/domain/fullchain.pem tls_private_key_path: /etc/letsencrypt/live/domain/privkey.pem

@willpower232

winsta avatar Jul 20 '21 07:07 winsta

If you have recently changed the config file, you will need to restart Postal to apply the changes.

Have you changed the ciphers or anything under those lines of config?

Can the postal user definitely access those certificate files you have mentioned?

willpower232 avatar Jul 20 '21 15:07 willpower232

tls working fine but when i test smtp then show me this error

Error: OpenSSL::SSL::SSLError (hostname "myhost.com" does not match the server certificate)

winsta avatar Jul 21 '21 10:07 winsta

run the command

openssl s_client -connect myhost.com:25 -starttls smtp

and paste the output

rccess avatar Jul 21 '21 10:07 rccess

CONNECTED(00000005) depth=0 C = GB, O = Default, OU = Default, CN = default verify error:num=18:self signed certificate verify return:1 depth=0 C = GB, O = Default, OU = Default, CN = default verify return:1

Certificate chain 0 s:C = GB, O = Default, OU = Default, CN = default i:C = GB, O = Default, OU = Default, CN = default

Server certificate -----BEGIN CERTIFICATE----- MIIC/zCCAeegAwIBAgIBADANBgkqhkiG9w0BAQsFADBDMQswCQYDVQQGEwJHQjEQ MA4GA1UECgwHRGVmYXVsdDEQMA4GA1UECwwHRGVmYXVsdDEQMA4GA1UEAwwHZGVm YXVsdDAeFw0yMTA3MjEwNDA3MzJaFw0zMTA3MTkwNDA3MzJaMEMxCzAJBgNVBAYT AkdCMRAwDgYDVQQKDAdEZWZhdWx0MRAwDgYDVQQLDAdEZWZhdWx0MRAwDgYDVQQD DAdkZWZhdWx0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+xXUO1o A31g0RVmxXWh3G/Q/Ur9Vg6J8xarrOR9iMr5NwlGqfgoUqJVCnCPVCjZykJbRRHQ KJFv0vvjqHt7qPNWEY6t9wK60YoY+3MV4Fib17ku3xbs1K5obSwCq+INYkQs8YdA Sndjn5DmFctq/66i8l8QSmh3SBG2QSTFv8+XTV+p40MdPy7OzbCwoizuJIsbx5+2 i+BwdmAplZLOkojHv/HeVihI43onPpKHuUBhNuJWMYs8imQnYd6g9qPXWUWUoujo 5ogmuhiLfKSysaNbHS7LZgpZocOK7DHAV4Ng2n4swiXAt1CCBAwmYhS4lQyME8e9 Ia40+EjM9pjk5wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBT9AhURKhsNRUyRJcQ OaU6v+YfCEOSJx8kBK9ojKAfUe4jL+tSTxPxidObnYfg8m7dbajM9PzJniJAvtOb GQAXH3a9VoRGSAtCl/Bsz28KHIvwRsBPJXQcD765LPHBPl0z9uOpEzrGYOm9IzLz OQTwGNdWHwiSP/D+0MQG89vvJTtWyS0cRIZt1AxPXQBNWSKasSUxo1iYOqibRybm ptlHVMW/yMH0KA+vcIjytYfkLze07mzSSXPeKDniheLenqwKXD4LjvzstouQeekm 14SWCpn24FJoJa095AWeRLk0ypAfjInok2mHUGJP8SJQEUau22+56Uv9qn2dX1Xs NWr1 -----END CERTIFICATE----- subject=C = GB, O = Default, OU = Default, CN = default

issuer=C = GB, O = Default, OU = Default, CN = default


No client certificate CA names sent Peer signing digest: SHA256 Peer signature type: RSA Server Temp Key: DH, 1024 bits

SSL handshake has read 1791 bytes and written 553 bytes Verification error: self signed certificate

New, TLSv1.2, Cipher is DHE-RSA-AES256-GCM-SHA384 Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : DHE-RSA-AES256-GCM-SHA384 Session-ID: 4395A31B347D85C4661FBF0AA6F786FBD9380104E66E8B061E7FD4276D9D5880 Session-ID-ctx: Master-Key: 375C37BDCD2ADC25442DF56078FEA4A9FEA0963EF59DA627D59C1EA17C330015 34AF34368F645C4B17D5B5391D8FFB57 PSK identity: None PSK identity hint: None SRP username: None TLS session ticket lifetime hint: 300 (seconds) TLS session ticket: 0000 - 45 35 cc 7d 82 47 ef 3b-91 58 84 43 5c 5b 7e 87 E5.}.G.;.X.C[~. 0010 - 5f f5 15 b6 18 3d 53 5b-a0 62 69 a6 1f 6c f5 eb _....=S[.bi..l.. 0020 - 74 99 c7 1a 08 71 d6 2a-0c a4 e9 82 ef 0c 64 27 t....q.*......d' 0030 - 0b f4 ee 06 b0 2f a4 23-f0 e8 b4 58 6e 63 d4 be ...../.#...Xnc.. 0040 - be cb 72 bf f9 dd 27 72-b1 7a 86 69 73 61 e7 2d ..r...'r.z.isa.- 0050 - 92 77 97 49 92 85 f0 97-3c 65 d0 28 c1 dd b6 6e .w.I....<e.(...n 0060 - 63 4b d3 97 76 ca f5 7e-72 3e 55 a2 65 86 d6 d7 cK..v..~r>U.e... 0070 - 72 04 d4 d2 7f 4d dc 89-70 e9 f2 60 a4 2f 49 75 r....M..p.../Iu 0080 - 98 ee d3 52 aa 79 4b c0-7d 99 47 ec 34 8e a2 19 ...R.yK.}.G.4... 0090 - ac fb 53 4e 3b b9 6d c9-09 f4 ed 13 1f e9 fd 36 ..SN;.m........6 00a0 - 46 9f 94 fd 98 76 1b b3-d5 9a b4 2b 5c d5 5b 68 F....v.....+\.[h 00b0 - d2 60 d4 cf 32 80 4c c2-83 b3 dc 36 96 d5 56 f7 ...2.L....6..V.

Start Time: 1626864436
Timeout   : 7200 (sec)
Verify return code: 18 (self signed certificate)
Extended master secret: no

250 AUTH CRAM-MD5 PLAIN LOGIN

winsta avatar Jul 21 '21 10:07 winsta

try to send on 587 for tls

rccess avatar Jul 21 '21 11:07 rccess

140663099892160:error:0200206F:system library:connect:Connection refused:../crypto/bio/b_sock2.c:110: 140663099892160:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111: connect:errno=111

i get this.

winsta avatar Jul 21 '21 11:07 winsta

try this

smtp_server: port: 587 tls_enabled: true tls_certificate_path: /etc/letsencrypt/live/domain/fullchain.pem tls_private_key_path: /etc/letsencrypt/live/domain/privkey.pem

rccess avatar Jul 21 '21 11:07 rccess

postal not working if i put port 587

winsta avatar Jul 21 '21 11:07 winsta

check the logs and paste screenshot here of error

rccess avatar Jul 21 '21 11:07 rccess

Screenshot (77)

winsta avatar Jul 21 '21 12:07 winsta

please do send the screenshot of postal.yml

Note: Please do hide private information in Screenshot or code

rccess avatar Jul 22 '21 06:07 rccess

Can the postal user definitely access those certificate files you have mentioned?

willpower232 avatar Jul 22 '21 20:07 willpower232