-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Obscure exceptions when TLS cert on SMTP server is untrusted #9566
Comments
I suppose try fixing the cert and see if the issue persists? Edit: Ah, this is for local testing. That is a bit trickier. |
my complaint is not the fact that there's an error, so much as the fact that the error is unnecessarily verbose and yet tells me nothing about what the problem is. |
We could |
right. Isn't there a way to tell if TLS was the problem? If not, that might be a thing we should fix in Twisted. |
I have a very similar, if not the same problem:
I would suggest adding an option mail:
skip_verify: true to accept self-signed certificates. As a workaround I tried adding the certificate of my mailserver to the Docker image using FROM matrixdotorg/synapse:v1.29.0
RUN mkdir -p /usr/local/share/ca-certificates \
&& echo quit | \
openssl s_client -connect mail.example.com:587 -starttls smtp | \
openssl x509 -outform PEM -out /usr/local/share/ca-certificates/mail.example.com.crt \
&& update-ca-certificates which makes OpenSSL accept the certificate, but Twisted doesn't seem to use OpenSSL's trust store. |
I'd really like to keep this issue focussing on the incomprehensible exception, rather than feature-creeping it into disabling TLS or whatever. |
I have a data point to add to this issue, and depending on whether this fixes the original issue or not might be a separate one… Anyway. We debugged a problem leading to similar issues as presented above in our setup, and have found out that twisted insists on the certificate presented by the mail-server on STARTTLS being issued to the hostname twisted/synapse uses to connect to said mail server. This change stems from twisted/twisted#1225, the new
This might also be interesting for the configuration documentation, as the default |
Can confirm that this breaks the default configuration. The only way to stop this from happening right now seems to either be to put in the effort of generating a valid TLS certificate for localhost using your own CA, or changing the mail server config to disallow STARTTLS on the loopback interface completely. For postfix, you can do it by editing
|
I've raised https://twistedmatrix.com/trac/ticket/10210 to track this on the Twisted side. |
for the record: as of #10546, you can disable TLS for the SMTP connection. |
I think this is happening because my SMTP server is presenting a self-signed cert (and I can't stop synapse trying to STARTTLS, per #8046)
The text was updated successfully, but these errors were encountered: