]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: init: always warn when running as root without being asked to
authorWilly Tarreau <w@1wt.eu>
Thu, 4 Sep 2025 07:22:38 +0000 (09:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Sep 2025 06:51:07 +0000 (08:51 +0200)
commita6986e1cd65a0e3a77105235c24dd73bae2c5899
treec89ec431240c76260ac3ec7709a7fce485273c1e
parentc97ced3f938271c9d648594d6c4bfcd194c36a7d
MEDIUM: init: always warn when running as root without being asked to

Like many exposed network deamons, haproxy does normally not need to run
as root and strongly recommends against this, unless strictly necessary.
On some operating systems, capabilities even totally alleviate this need.

Lately, maybe due to a raise of containerization or automated config
generation or a bit of both, we've observed a resurgence of this bad
practice, possibly due to the fact that users are just not aware of the
conditions they're using their daemon.

Let's add a warning at boot when starting as root without having requested
it using "uid" or "user". And take this opportunity for warning the user
about the existence of capabilities when supported, and encouraging the
use of a chroot.

This is achieved by leaving global.uid set to -1 by default, allowing us
to detect if it was explicitly set or not.
src/cfgparse-global.c
src/haproxy.c
src/linuxcap.c