-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
apache-httpd: do not run anything as root #56304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need add something to release notes talking about this change. Both certbot & security.acme.certs generate root only readable certs by default, which will cause breakage. In the release notes you should explain what steps people need to take to ensure their apache servers won't break because of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Izorkin After some more review this will break a bunch of the apache submodules so they will need to be modified/updated for this as well. Quick example: https://github.com/NixOS/nixpkgs/blob/774fd3e6f2c06f5ee1531b5606f139b15be19b68/nixos/modules/services/web-servers/apache-httpd/limesurvey.nix#L189
774fd3e
to
9c411a5
Compare
@aanderse to create the database postgres require root privileges. I don't know how to get around it. |
@Izorkin That definitely is a common problem in many NixOS modules! MySQL is great because you can use ensureDatabases and ensureUsers for services. See https://discourse.nixos.org/t/postgresql-module-vs-mysql-module/2243/3 for my proposal to fix this problem. |
Also in the limesurvey module, the rule does not work systemd.tmpfiles.rules. How can I fix it?
Maybe in the Add option enableRootlessMode = false; ? |
@Izorkin I imagine you would have to do something like config.systemd.tmpfiles.rules instead of just systemd.tmpfiles.rules, but I haven't tested that. |
This option does not work. |
I see the problem. The way these submodules are called I don't believe they can modify the global config (anyone please correct me if I'm wrong). I can imagine there would be some hacky workarounds someone could write to allow subservices to modify the config, but that seems like the wrong path to go down. There has been discussion on the state of subservices in the past, but it is a complicated topic and never seems to end up with a solution. See #6960, #18977, and #22067. I'm of the opinion that several of these subservices (specifically the ones that use php) shouldn't exist as apache subservices, but as their own modules utilizing phpfpm. If limesurvey was moved to a module of its own and used phpfpm this problem wouldn't exist, and limesurvey could be served up over either apache, nginx, or any other web server which supports this. The remaining subservices which aren't using php look like they probably only require minimal changes (if any) to work without any root privileges which is probably a good idea anyways... Anyone who maintains their own private subservices outside of nixpkgs could have problems with this, but I think that risk is minimal and with documentation in the release notes that isn't a big concern. I think several things need to happen before this PR can go much further, but I'm interested in helping out so I might take a stab at converting a php subservice to its own module and seeing how that goes.
@Izorkin thoughts? |
3b98599
to
8fdc2f5
Compare
Updated to new variant. |
MediaWiki worked! |
02c5b70
to
6e4960c
Compare
Rebased PR |
Use of I'm working on a set of PRs and intend to include this functionality before the |
Motivation for this change
Disable running Apache-httpd from root
Please recheck config.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)