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

treewide: Switch to system users #71055

Merged
merged 1 commit into from Nov 1, 2019
Merged

treewide: Switch to system users #71055

merged 1 commit into from Nov 1, 2019

Conversation

dasJ
Copy link
Member

@dasJ dasJ commented Oct 12, 2019

Could somebody with Borg permission run the tests?

Motivation for this change

It's annoying to have users (actual people) with fixed UIDs and services clashing for UIDs.

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 nix-review --run "nix-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@dasJ dasJ mentioned this pull request Oct 12, 2019
10 tasks
@infinisil
Copy link
Member

Nice, I planned to do this as part of NixOS/rfcs#52. This should be backwards compatible as I check recently. Currently there is a limit of 100 dynamic system users, but #65698 will increase this, so this shouldn't be a problem.

@dasJ
Copy link
Member Author

dasJ commented Oct 12, 2019

@infinisil Yes, it seems like switch-to-configuration prints a warning but doesn't change UIDs of existing users. Also, as this only modifys 47 users, I doubt this PR will be the cause of UID exhaustion ;)

@dasJ
Copy link
Member Author

dasJ commented Oct 12, 2019

Okay, I stand corrected. 100 is probably not enough. Looks like #65698 should be merged first

@infinisil
Copy link
Member

Well the system uid range isn't only for nixpkgs. People could define lots of services outside of nixpkgs. And 100 services being enabled over the lifetime of a system doesn't seem far fetched. So I'd like the PR for increasing this limit be merged first. Should be quick after the RFC is accepted, which will be in less than a week.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@asymmetric asymmetric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share how you applied the change treewide?

Also, is treewide the correct prefix, as opposed to e.g. *?

@dasJ
Copy link
Member Author

dasJ commented Oct 19, 2019

@asymmetric Unfortunately, the command is not in my shell history anymore. I was able to reproduce it, so this one is pretty similar: grep -R users.users nixos/modules -l | xargs grep -L isSystemUser | xargs grep -L 'uid *=' | xargs -o -n 1 vim
It still requires a lot of manual work in vim, but that takes less than 10 minutes.

Idk about the PR prefix, maybe someone with more experience can help me out here

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFC is accepted, this change looks good, I'll merge 🎀

@infinisil infinisil merged commit dd0a47e into NixOS:master Nov 1, 2019
@JohnAZoidberg
Copy link
Member

So the new policy would be: Every service should use either isSystemUser or DynamicUser?
Is this documented in the manual? I couldn't see it at a glance (quick grep).

@infinisil
Copy link
Member

I mentioned in the RFC that something like this should be added to the manual, haven't done that yet

@dasJ dasJ deleted the treewide-sysuser branch November 3, 2019 22:39
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jan 1, 2020
treewide: Switch to system users
(cherry picked from commit dd0a47e)
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jan 19, 2020
treewide: Switch to system users
(cherry picked from commit dd0a47e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants