How do I configure mailman to use a unix socket for lmtp connections? Setting
[mta]
incoming: mailman.mta.null.NullMTA
lmtp_host: /path/to/socket
does not work. Mailman still tries to create a TCP socket.
On 10/20/19 3:55 PM, Hristo Venev via Mailman-users wrote:
How do I configure mailman to use a unix socket for lmtp connections? Setting
[mta] incoming: mailman.mta.null.NullMTA lmtp_host: /path/to/socket
does not work. Mailman still tries to create a TCP socket.
You can't do this. Mail Delivery is to Mailman's lmtp runner which uses the LMTP class in aiosmtpd <https://aiosmtpd.readthedocs.io/en/latest/> to create an LMTP server which listens for tcp connection on lmtp_host:lmtp_port.
You would have to modify mailman/runners/lmtp.py to listen on a unix socket. The docs imply the aiosmtpd.controller.Controller class has a make_socket() method which "allows subclasses to customize the creation of the socket before binding" which I suppose could be used to create a unix socket, but mailman/runners/lmtp.py currently doesn't make use of that.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mark Sapiro writes:
You would have to modify mailman/runners/lmtp.py to listen on a unix socket. The docs imply the aiosmtpd.controller.Controller class has a make_socket() method which "allows subclasses to customize the creation of the socket before binding" which I suppose could be used to create a unix socket, but mailman/runners/lmtp.py currently doesn't make use of that.
If someone is thinking about doing this, I suggest comparing the asyncio event loop's create_server method with create_unix_server, which will probably give ueful hints about implementation.
BTW, I object to the smtpd package's lmtp_host=UNIX_SOCKET_PATH style of configuration. There should be a separate parameter for this.
Steve
Hristo Venev via Mailman-users writes:
How do I configure mailman to use a unix socket for lmtp connections?
I don't think it's currently possible. Using a Unix socket is undocumented in Mailman. Mailman's LMTP server is based on aiosmtpd, which as far as I can tell from its documentation does not support Unix sockets.
Setting
[mta] incoming: mailman.mta.null.NullMTA lmtp_host: /path/to/socket
That's the smtpd package's style of configuration, but I don't think it works with aiosmtpd.
The underlying asyncio package does support Unix sockets, so it's *probably* not too hard to add this feature *in principle*. However, if aiosmtpd doesn't support it, somebody (preferably not us) will have to fork and go through the feature submission process, and maintain it separately for quite some time since we support fairly old Python versions. And async code is fundamentally hairy, if we have to get into any details (*probably* not, but speaking for myself I'm not going to dig into something without a reserve of time on "probably").
Also, I don't think we have any experts in this code at this time, and I'm not going to have enough time to work on it for a month, at least, and more likely around the new year. Maybe somebody else does, but I know some of our developers will be out of touch for a while. You could try the aiosmtpd package maintainer, or the upstream Python channels (python-list@python.org).
Steve
participants (3)
-
Hristo Venev
-
Mark Sapiro
-
Stephen J. Turnbull