top | item 40388495

(no title)

ainar-g | 1 year ago

Privilege separation[1], most likely. If your system needs to do three things, it could either just do all of them using a single executable requiring all three permissions (thus also theoretically allowing an attacker to use it to do all three things as well) or split your system into three executables, each only having the permission to do one thing (thus reducing the amount of potential damage).

[1]: https://en.wikipedia.org/wiki/Privilege_separation

discuss

order

ape4|1 year ago

Yes, the main daemon needs to run as root so it can become any user. Once you're logged in you just run as a regular user.

crest|1 year ago

Yes and no. At least one process needs to run as root to be able to become any (other) user. It doesn't have to be the one accepting incoming connections, or the one handling user authentication and authorisation. OpenBSD already contains several examples of this e.g. OpenBGPd limits the attack surface by putting the BGP session handling (and protocol parsing) in one process running with reduced privs (dedicated user and group, chroot(), pledge()/unveil()). To communicate with the other processes the parent creates unix socket pairs to be inherited. The children also re-exec after fork() so they're re-randomised and can't be abused as oracles for the memory layout of other processes.

Brian_K_White|1 year ago

The last sentence in the article seems like a clue.