]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: startup: only worker gets capabilities from bin
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 4 Jul 2024 15:19:18 +0000 (17:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
Due to moving the master-worker fork in init(), we need to protect
prepare_caps_from_permitted_set() call, which is executed after init(). This
call makes sense only for worker, daemon and for foreground mono process modes.

prepare_caps_from_permitted_set() allows to read Linux capabilities from
haproxy binary and to move some of them in process Effective set, if 'setcap'
keyword lists needed capabilities in the global section.

src/haproxy.c

index 296769def0b9f55eb9a9d523ddfb522f9cfad2b0..411562e396f4a9740935c92248c5884f34c5cada 100644 (file)
@@ -3412,7 +3412,8 @@ int main(int argc, char **argv)
         * is started and run under the same non-root user, this allows
         * binding to privileged ports.
         */
-       prepare_caps_from_permitted_set(geteuid(), global.uid, argv[0]);
+       if (!(global.mode & MODE_MWORKER))
+           prepare_caps_from_permitted_set(geteuid(), global.uid, argv[0]);
 #endif
 
        /* Try to get the listeners FD from the previous process using