Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Dounin
August 19, 2021 09:48AM
Hello!

On Thu, Aug 19, 2021 at 11:23:05AM +1000, Robert Mueller wrote:

> > Since reuseport uses hash of the source address to balance
> > incoming connections between sockets, the client can choose a
> > source port to use so the hash will direct the connection to a
> > particular socket, that is, to a particular worker process.
>
> But if a client is choosing the same source-ip:source-port, it's
> not a real client or OS TCP stack, it's some system using raw
> packets designed for attacking another system, and in that case
> there's many other attack options available. I'm not convinced
> this is a large real-world concern for most users of nginx.

It is trivial to select arbitrary source port using normal TCP
stack. Even if it wasn't, nothing can stop attackers from using
special tools.

I'm not saying this is large concern, yet this is a concern one
should be aware of.

> IMHO I would still really like to see this patch applied
> because:
>
> 1. The patch is relatively small and matches the http and stream
> modules
> 2. It makes the mail module consistent with the http and stream
> modules which both support reuseport on their listen arguments
> 3. The current situation is clearly really bad, and other users
> have reported that they're seeing the same issue. Your
> suggestion is to recompile nginx with a particular option
> disabled, but this isn't required for stream or http handlers,
> just adding reuseport is an acceptable option to fix those
> handlers, and I think it should be something mail handlers can
> do as well.

The reuseport is implemented in nginx to mitigate lock contention
issues on multiprocessor configurations in case of very high
accept rates. It is not available in mail because high accept
rates are not expected to be the case in mail protocols.

While reuseport can be misused as a balancing solution, this is not
something I can recommend, given various reuseport limitations and
issues. Notably, reuseport requires a lot of additional sockets,
which is known to be a problem in some configurations, does not
prevent use of the same address in other processes, which requires
great care when managing running server, and opens a DoS vector to
overload a particular worker process, as outlined above.

In the particular case you and others are reporting a better
solution would be to address the issue which causes bad balancing.
For now it looks like removing EPOLLEXCLUSIVE should fix things,
making misuse of reuseport unnecessary in all modules. Testing on
real servers affected by the issue is appreciated.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Mail: add the "reuseport" option of the "listen" directive

Robert Mueller 699 August 16, 2021 11:36PM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Konovalov 164 August 17, 2021 09:50AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Robert Mueller 161 August 17, 2021 09:16PM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

MKl 144 August 18, 2021 03:22AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Konovalov 183 August 18, 2021 05:20AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Dounin 151 August 18, 2021 10:00AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Robert Mueller 249 August 18, 2021 10:30AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Dounin 149 August 18, 2021 01:06PM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Robert Mueller 198 August 18, 2021 09:24PM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Maxim Dounin 232 August 19, 2021 09:48AM

Re: [PATCH] Mail: add the "reuseport" option of the "listen" directive

Honza Prachaƙ 191 August 18, 2021 02:48AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready