element-hq / element-hq/synapse

Obscure exceptions when TLS cert on SMTP server is untrusted

Open
#9,566 2 comments 0 reactions 0 assignees View on GitHub
S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#9566](https://github.com/matrix-org/synapse/issues/9566).

---

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 https://github.com/matrix-org/synapse/issues/8046)

```
2021-03-09 10:16:38,776 - synapse.push.emailpusher - 147 - ERROR - emailpush.process-15454 - Exception processing notifs
Capture point (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/synapse/src/synapse/app/homeserver.py", line 507, in
main()
File "/home/synapse/src/synapse/app/homeserver.py", line 503, in main
run(hs)
File "/home/synapse/src/synapse/app/homeserver.py", line 494, in run
logger=logger,
File "/home/synapse/src/synapse/app/_base.py", line 135, in start_reactor
run()
File "/home/synapse/src/synapse/app/_base.py", line 119, in run
run_command()
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/base.py", line 1423, in run
self.mainLoop()
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/base.py", line 1433, in mainLoop
reactorBaseSelf.runUntilCurrent()
File "/home/synapse/src/synapse/metrics/__init__.py", line 548, in f
ret = func(*args, **kwargs)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/base.py", line 999, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/tcp.py", line 507, in connectionLost
self.connector.connectionLost(reason)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/base.py", line 1312, in connectionLost
self.factory.clientConnectionLost(self, reason)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/mail/smtp.py", line 1935, in clientConnectionLost
self._processConnectionError(connector, err)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/mail/smtp.py", line 1952, in _processConnectionError
self.result.errback(err.value)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/defer.py", line 517, in errback
self._startRunCallbacks(fail)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/defer.py", line 580, in _startRunCallbacks
self._runCallbacks()
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/defer.py", line 662, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/defer.py", line 1511, in gotResult
current_context.run(_inlineCallbacks, r, g, status)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/internet/defer.py", line 1443, in _inlineCallbacks
result = current_context.run(result.throwExceptionIntoGenerator, g)
File "/home/synapse/env/lib/python3.7/site-packages/twisted/python/failure.py", line 500, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
Traceback (most recent call last):
File "/home/synapse/src/synapse/push/emailpusher.py", line 145, in _process
await self._unsafe_process()
File "/home/synapse/src/synapse/push/emailpusher.py", line 195, in _unsafe_process
await self.send_notification(unprocessed, reason)
File "/home/synapse/src/synapse/push/emailpusher.py", line 312, in send_notification
self.app_id, self.user_id, self.email, push_actions, reason
File "/home/synapse/src/synapse/push/mailer.py", line 308, in send_notification_mail
await self.send_email(email_address, summary_text, template_vars)
File "/home/synapse/src/synapse/push/mailer.py", line 360, in send_email
requireTransportSecurity=self.hs.config.require_transport_security,
twisted.internet.error.ConnectionAborted: Connection was aborted locally using ITCPTransport.abortConnection.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.