BUG/MINOR: mworker/ssl: close openssl FDs unconditionally
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 15 Oct 2019 12:04:08 +0000 (14:04 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 17 Oct 2019 09:36:22 +0000 (11:36 +0200)
commit5fdb5b36e1e0bef9b8a79c3550bd7a8751bac396
tree93b31085a230ac844a75402ef9b55cba26ac06e2
parentccc61d87ae1b4c3d385daecfa9f760530055e4ad
BUG/MINOR: mworker/ssl: close openssl FDs unconditionally

Patch 56996da ("BUG/MINOR: mworker/ssl: close OpenSSL FDs on reload")
fixes a issue where the /dev/random FD was leaked by OpenSSL upon a
reload in master worker mode. Indeed the FD was not flagged with
CLOEXEC.

The fix was checking if ssl_used_frontend or ssl_used_backend were set
to close the FD. This is wrong, indeed the lua init code creates an SSL
server without increasing the backend value, so the deinit is never
done when you don't use SSL in your configuration.

To reproduce the problem you just need to build haproxy with openssl and
lua with an openssl which does not use the getrandom() syscall.  No
openssl nor lua configuration are required for haproxy.

This patch must be backported as far as 1.8.

Fix issue #314.
src/haproxy.c