aiosmtpd icon indicating copy to clipboard operation
aiosmtpd copied to clipboard

No way to limit concurrent inbound SMTP connections?!?

Open davidmcnabnz opened this issue 4 years ago • 2 comments
trafficstars

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

davidmcnabnz avatar Sep 05 '21 04:09 davidmcnabnz

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 🤣

waynew avatar Sep 05 '21 14:09 waynew

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.

pepoluan avatar Oct 19 '21 05:10 pepoluan