From: Willy Tarreau Date: Wed, 9 Sep 2026 07:28:34 +0000 (+0200) Subject: MAJOR: startup: use chroot auto by default when available X-Git-Tag: v3.5-dev7~48 X-Git-Url: https://git.kaiwu.me/$%7BGITURL%7D$%7Bcid%7D?a=commitdiff_plain;h=79082c7c2b7a721587fdc08347a4cb17dfe37fd6;p=haproxy.git MAJOR: startup: use chroot auto by default when available 3.4 implemented "chroot auto", "chroot /", unprivileged chroot and a warning for super-user when chroot is not used. We were not doing it for unprivileged users because this would have caused confusion with configs triggering warnings only on certain OSes or environments. Now's time to switch to automatic chroot attempt on startup whenever deemed possible. For this, we reuse the previous rules to decide to emit a warning when a chroot is possible but not done, and instead of complaining that no chroot is done, we just attempt it before emitting the warning only in case of failure. This is marked major because it may break some old rare configs that were emitting the warning in 3.4 due to the lack of chroot, when the user expected to access for example a UNIX socket at run time, or using an external check. The fix remains easy (and is explained in the warning), just use "chroot /". The change aims at increasing the default security level for users by default (i.e. with the least config settings), but it's not critical, so feedback will determine if we keep it as-is, if we adjust it, or if we revert it. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 8e3bc2dba..a08724842 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -2130,12 +2130,13 @@ chroot { | auto } The resulting jail has no name in the filesystem and is empty and read-only, removing the need to prepare a dedicated jail directory. - When starting with superuser privileges, a warning will be displayed if no - chroot is used, in order to encourage users to always use the mechanism. If - for any reason there is a compelling reason not to use chroot (e.g. access to - a server via a UNIX socket with an unconvenient path), it remains possible to - silence the warning by adding an explicit "chroot /", which has the benefit - of being visible in a configuration. + When starting with sufficient privileges, haproxy will automatically apply + "chroot auto" if no "chroot" directive is used, i.e. it will isolate itself + in a chroot jail, and will emit a warning if it fails to do so. If there is + a compelling reason not to use chroot (e.g. access to a server via a UNIX + socket outside of the jail), it remains possible to silence the warning by + adding an explicit "chroot /", which has the benefit of being visible in a + configuration. close-spread-time