Score:1

sendmail: server shows failures due to bad client certificate

id flag

My sendmail server (FreeBSD, compiled against OpenSSL) is refusing to negotiate TLS with one particular set of clients.

Log messages look like this:

sm-mta[92474]: STARTTLS=server, error: accept failed=-1, reason=sslv3 alert bad certificate, SSL_error=1, errno=0, retry=-1, relay=xx.example.com [XX.XX.XX.XX]

Other than these failures, which originate with a well-known ISP's mail infrastructure, everything is working great; the certificate on the server itself is up-to-date and valid.

Two questions, an answer to either one would be helpful:

  1. How can I diagnose this? In particular, can I get a copy of the bad certificate from within the sendmail environment?
  2. Can I update my sendmail config to either tell clients not to provide a certificate, or to tell sendmail to accept a bogus client certificate?

Thanks!

EDIT: I found the issue here, which was that my server's certificate didn't match my server's DANE TLSA record. Looking at a Wireshark decode of the transaction showed that the ISP (Comcast) was receiving my valid certificate but rejecting it anyway, and it turned out that the TLSA record was not synchronized. It looks like Comcast might be one of the few email senders on the Internet that refuses to send after a DANE verification failure.

Score:1
br flag

You could use OpenSSL to query the remote server. For example, to see the certificate on one of Google's mail server:

echo quit | openssl s_client -connect aspmx.l.google.com:25 -starttls smtp

should show something similar to:

CONNECTED(00000003)
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = mx.google.com
verify return:1
---
Certificate chain
 0 s:CN = mx.google.com
   i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
 1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
   i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
 2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
   i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIG9DCCBdygAwIBAgIQdfcJTB0GgVsKbOXnm+OJmTANBgkqhkiG9w0BAQsFADBG
MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp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X8RE6
j/SC42wunfCeR6xywhlpDg70mwjLP6QslX/JHfsR6pg+MLyTgmrTincbWeStauvN
G2JZkth9MeorZoTmyx+vooeKQgIV8PKRs5Llc+lSjA4b9wlJNHA9hMd5mBRZL291
oMYlrLxMli8=
-----END CERTIFICATE-----
subject=CN = mx.google.com

issuer=C = US, O = Google Trust Services LLC, CN = GTS CA 1C3

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: ECDSA
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 5201 bytes and written 423 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 256 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
250 SMTPUTF8
DONE

You can add -showcerts to get all the certificates in the chain.

Jack Brennen avatar
id flag
This doesn't work with these client IP addresses; they appear to be only used to send mail, and they don't listen on either port 25 or port 587. I could use s_server and wait for a connection to happen, but I'm trying the suggestion of the other answer, which is to capture the session and hopefully display the certificate in Wireshark.
Score:1
cn flag

My generic way to approach certificate validation issue is:

  1. Take a netowrk capture with tcpdump or similar
  2. Open the capture in Wireshark and right click on the SSL/TLS ALERT packet and chose Follow -> TCP stream
  3. Check the X509 certificate:
    • Dates (is the current date between issued date and expiration date?)
    • Subject ( the hostname used by the client is the same as the CN= field?)
    • Subject Alternative Name (similar to Subject)
    • Constraints
    • Intermediate certificates (are all intermediate certificates presented after the host certificate? are they valid?)

Usually is a missing intermediate certificate that gives this type of issue (some clients do not validate the certificate of your server).

Jack Brennen avatar
id flag
Trying this now; just waiting for another delivery attempt to happen.
Jack Brennen avatar
id flag
This was helpful for showing that the ISP was rejecting my certificate. A little bit more thought led me to try some things, and bringing the DANE TLSA record up-to-date solved the issue.
cn flag
Thank you for sharing this. You should add your solution as an answer so we can vote it.
Score:0
id flag

It turned out that capturing and analyzing the TLS negotiation in Wireshark was the key here, and it led me to discover that the ISP (Comcast) was rejecting my domain certificate, despite the fact that almost every other sender on the Internet was accepting it.

Further investigation found that the TLSA record for the mail server in question was out-of-date, and that Comcast was rejecting the certificate due to a TLSA mismatch.

Unfortunately, the error mechanisms available in TLS negotiation do not provide a way for the sender to tell the receiver why the certificate was rejected. Maybe TLS 1.4 can define a specific alert for DANE certificate mismatch.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.