MINOR: startup: only worker gets capabilities from bin

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.
This commit is contained in:
Valentine Krasnobaeva 2024-07-04 17:19:18 +02:00 committed by Willy Tarreau
parent fe04c2ad37
commit cb0f1f42e1

View 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