Skip to content

prometheus/exporters: fix DynamicUser regression #51545

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

Merged
merged 2 commits into from
Dec 5, 2018

Conversation

delroth
Copy link
Contributor

@delroth delroth commented Dec 5, 2018

Motivation for this change

fbb7e0c inverted logic related to DynamicUser. Instead of setting User/Group when DynamicUser is disabled, it is only set when DynamicUser is enabled. This causes DynamicUser exporters to run as nobody/nobody, and other exporters to run as root.

prometheus/exporters/tor happens to not work with DynamicUser as is because of a CPython bug, so a prerequisite commit works around the issue by defining a dummy $HOME.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@delroth delroth requested a review from infinisil as a code owner December 5, 2018 03:29
@delroth
Copy link
Contributor Author

delroth commented Dec 5, 2018

@WilliButz FYI

@delroth
Copy link
Contributor Author

delroth commented Dec 5, 2018

Also note that the regression was cherry-picked onto release-18.09 in 7277b1d. The fix probably should be applied there as well since it's a security/defense in depth regression and violates the behavior described by the module documentation.

@GrahamcOfBorg GrahamcOfBorg added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 5, 2018
@delroth delroth force-pushed the prometheus-exporters-dynamicuser branch 2 times, most recently from ffc6334 to 964a3e8 Compare December 5, 2018 09:53

Verified

This commit was signed with the committer’s verified signature.
costrouc Christopher Ostrouchov

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Instead of setting User/Group only when DynamicUser is disabled, the
previous version of the code set it only when it was enabled. This
caused services with DynamicUser enabled to actually run as nobody, and
services without DynamicUser enabled to run as root.

Regression from fbb7e0c.
@delroth delroth force-pushed the prometheus-exporters-dynamicuser branch from 964a3e8 to 10041e7 Compare December 5, 2018 09:59
@globin globin self-assigned this Dec 5, 2018
@WilliButz
Copy link
Member

@delroth Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants