Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: make daemons run as non-root #41092

Open
4 of 9 tasks
peterhoeg opened this issue May 26, 2018 · 12 comments
Open
4 of 9 tasks

nixos: make daemons run as non-root #41092

peterhoeg opened this issue May 26, 2018 · 12 comments
Assignees
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@peterhoeg
Copy link
Member

peterhoeg commented May 26, 2018

Further to #41017, a number of daemons are currently running as root either through the entire life-time of the daemon or in order to do initialization at start and then dropping privs later. Instead we should use the infrastructure we have available to simply have the daemons run as unprivileged users right from the get-go:

@peterhoeg peterhoeg self-assigned this May 26, 2018
@xeji
Copy link
Contributor

xeji commented May 26, 2018

similar: libvirtd currently runs qemu as root, see #37281

@peterhoeg peterhoeg added this to the 18.09 milestone Jun 4, 2018
@markuskowa
Copy link
Member

I will take a look a munge. It is mainly used as authenticator for slurm. As an application in the category "security" it should maybe not run a root :/

@xeji
Copy link
Contributor

xeji commented Jun 9, 2018

@peterhoeg sorry, I didn't realize the merge would close this.

@peterhoeg
Copy link
Member Author

No problem. And thanks @markuskowa for sorting out munge.

@basvandijk
Copy link
Member

basvandijk commented Aug 3, 2018

I see all the graphite services define User = "graphite"; Group = "graphite"; so I'll check that off your list.

EDIT: although most services have a preStart which is running as root right? Unchecking again...

@peterhoeg
Copy link
Member Author

I'm not realistically going to have enough time for getting this fully sorted in time for 18.09 - if anybody wants to push this forward, please do!

@aanderse
Copy link
Member

aanderse commented Apr 7, 2019

Please add the httpd service to the list. Tracked in #56304.

@matthewbauer matthewbauer modified the milestones: 19.03, 19.09 May 27, 2019
@veprbl veprbl removed this from the 19.09 milestone May 31, 2021
@gstrauss
Copy link

FYI: lighttpd supports systemd socket activation if lighttpd.conf contains server.systemd-socket-activation = "enable" For typical usage of lighttpd, listening on a privileged port is the only root-level privilege that lighttpd needs at startup. Another option is to have the firewall redirect the privileged port to a high port on which lighttpd can listen without needed to start with root.

@peterhoeg
Copy link
Member Author

@gstrauss a fairly common pattern is to use capabilities in this case:

services.lighttpd.serviceConfig.AmbientCapabilities = mkIf (cfg.port < 1024) "cap_net_bind_service";

@gstrauss
Copy link

Nice. So are there any other questions/limitations about running lighttpd as non-root inside nixos? (I am lighttpd developer, and as you can see, clearly not a nixos expert)

@peterhoeg
Copy link
Member Author

peterhoeg commented Jun 15, 2021 via email

@FliegendeWurst
Copy link
Member

gitlab fix: bcfa59b

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

9 participants