aiosmtpd
aiosmtpd copied to clipboard
No way to limit concurrent inbound SMTP connections?!?
Hi there,
I have a use-case where I need to set a limit to the number of concurrent inbound SMTP connections. The behaviour I need is that if any additional connections come in, they get closed instantly.
Are you able to advise the best way to accomplish this within aiosmtpd?
Cheers David
I think this might be best achieved with a proxy? It's possible that you could do it with the underlying sockets, but I'm not sure. It's definitely a backwards requirement from what everyone else needs 🤣
I think it is implementable using iptables iff on Linux.
The main issue implementing connection limit in SMTP class is that the aio mechanism already instantiate the whole SMTP class and all its baggage before dropping. So, the limiting should be done in aio instead. Not sure how to do that, though.
That's why I agree with @waynew there, it should be implemented externally.