Go to file
Stoiko Ivanov c82d1707ed accept-phase: fix conn_count "leak"
When handling new connections in 'accept_connections' the number of
active connections (conn_count) got increased before the callback, which
would eventually decrease it got registered in AnyEvent::Handle->new.

Any error/die before registering the callback would skip the
decrement, and leave the process in an endless loop upon exiting in
wait_end_loop.

This can happen e.g. when the call to getpeername fails, or if the
connection is denied by the ALLOW_FROM/DENY_FROM settings in
'/etc/default/pveproxy' (which is also a simple reproducer for that).

Additionally it can cause a denial of service, by attempting to
connect from a denied ip until the connection count exeeds the maximum
connections of all child-processes.

This patch addresses the issue by incrementing the connection count
before attempting to create the handle, and decrementing it again, if
handle creation fails.

A warning is logged if 'conn_count' turns negative when decrementing
during cleanup on error/eof. In case creating a new handle during
initial accept_connection fails, a warning is logged as well, but
'conn_count' is not decremented.

Reported via our community-forum:
https://forum.proxmox.com/threads/pveproxy-eats-available-ram.79617/

Co-Authored-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-12-10 20:23:38 +01:00
debian bump version to 3.0-6 2020-07-02 09:44:16 +02:00
examples add a more complex demo 2017-01-21 16:08:36 +01:00
PVE/APIServer accept-phase: fix conn_count "leak" 2020-12-10 20:23:38 +01:00
.gitignore fixup no newline at end of .gitignore 2018-05-25 16:42:05 +02:00
Makefile re-use Debians jQuery and Bootstrap packages 2019-05-22 08:10:58 +02:00