Reputation: 41
I am using python3, aiosmtpd to capture emails from a dvr on a private lan and strip the attachments. I've written a handler for aiosmtp and some test python to send an email with attachment, plain, no encryption and it works. When the dvr sends email it yields connection lost.
I tried debugging using:
python3 -m aiosmtpd -d -n -l 192.168.66.1:11125
Adding "--no-requiretls" doesnt seem to change result.
This is result:
2021-06-07 21:29:30 - Available AUTH mechanisms: LOGIN(builtin) PLAIN(builtin)
Available AUTH mechanisms: LOGIN(builtin) PLAIN(builtin)
2021-06-07 21:29:30 - Peer: ('192.168.66.99', 47054)
Peer: ('192.168.66.99', 47054)
2021-06-07 21:29:30 - ('192.168.66.99', 47054) handling connection
('192.168.66.99', 47054) handling connection
2021-06-07 21:29:30 - ('192.168.66.99', 47054) >> b'EHLO 192.168.66.1'
('192.168.66.99', 47054) >> b'EHLO 192.168.66.1'
2021-06-07 21:29:31 - ('192.168.66.99', 47054) >> b'AUTH LOGIN'
('192.168.66.99', 47054) >> b'AUTH LOGIN'
2021-06-07 21:29:31 - ('192.168.66.99', 47054) connection lost
('192.168.66.99', 47054) connection lost
2021-06-07 21:29:31 - ('192.168.66.99', 47054) Connection lost during _handle_client()
('192.168.66.99', 47054) Connection lost during _handle_client()
smtp.py, part of aiosmtpd 1.4.2 installed by pip3:
def __init__(
...
auth_require_tls=True,...)
...
self._auth_require_tls = auth_require_tls
async def smtp_AUTH(self, arg: str) -> None:
...
elif self._auth_require_tls and not self._tls_protocol:
return await self.push("538 5.7.11 Encryption required for requested authentication mechanism")
So the above default if AUTH received will fail because init, if not set by user code leaves _auth_require_tls as True. As the AUTH is plain in this case the protocol won't be tls.
A bit more debug and I found that the client is not responding to challenge.
INFO:mail.log:('192.168.66.99', 47054) << challenge: b'334 VXNlciBOYW1lAA=='
Not sure what to try now. Any suggestions?
Upvotes: 4
Views: 431