Repository navigation
Option to drop root privileges after bind #216
Replies: 5 comments
|
Hi Andrzej, the worker processes can run under another user: The master process (the one that accepts and forwards connections) will need to keep root privileges to handle a SIGHUP-triggered restart. The Cheers, Marc |
Thanks, I'll check that out
Understandable, just one question: what is the benefit of a SIGHUP restart versus SIGTERM+starting tac_plus-ng again?
Another option (as a local customization, not part of the distribution) would be to add |
|
Hi, SIGHUP will tell the daemon to restart, but SIGTERM tells it to terminate. The latter will not happen instantly but with a slight delay (1s max, used to be more like 10 or 30s in earlier versions, IIRC), so restarting manually without any delay after sending the signal might be unstable on systems not supporting SO_REUSEPORT (I don't thinks that's an issue for current Linux versions). I've actually considered to add some privilege-dropping code some time ago but decided against it. The worker processes may fork MAVIS modules, and there's a fair chance that these require root privileges (PAM support, e.g.). Thanks for the systemd config hint, that sounds useful. Cheers, Marc |
Wouldn't this be already a problem with the configuration you posted above (root master process and non-root workers)? |
|
Hi, I've no idea that systemctl does exactly. And yes, running the worker processes as non-root may (e.g.: LDAP) ore may not (e.g.: PAM) work. Cheers, Marc |
Uh oh!
There was an error while loading. Please reload this page.
Hello Marc,
I am currently running a PoC of tac_plus-ng with LDAP backend, and it works very well, really grateful for your work. One thing I tried is running tac_plus-ng as a regular system user, which work perfectly, but requires manual setting of the relevant capability on tac_plus-ng (setcap 'cap_net_bind_service=+ep' /usr/local/sbin/tac_plus-ng) to bind to port 49. This has to be done after every "make install", so it's a bit brittle (will break installation if someone forgets to issue "setcap" after an upgrade).
Since it looks like root is not otherwise needed, would it be possible to add a configuration option to drop root privileges and use a specified user after bind? I know OpenVPN uses the same mechanism, other daemons too, and it would go a long way to satisfy the principle of least privilege.
Best regards,
Andrzej
All reactions