-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Don't default to nogroup for the primary group of users. #133166
Conversation
7aca6ed
to
18f7d56
Compare
nixos/modules/misc/ids.nix
Outdated
@@ -486,19 +486,19 @@ in | |||
mopidy = 130; | |||
docker = 131; | |||
gdm = 132; | |||
#dhcpcd = 133; # unused | |||
dhcpd = 133; |
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.
I guess changing the name here was intentional?
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.
The user with the same uid is dhcpd, so I think the c in the comment was a typo.
nixos/modules/misc/ids.nix
Outdated
@@ -402,14 +402,14 @@ in | |||
fourstore = 42; | |||
fourstorehttp = 43; | |||
virtuoso = 44; | |||
#rtkit = 45; # unused | |||
rtkit = 45; |
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.
Why are these being revived?
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.
because currently, user rtkit
has a static uid and group nogroup
. The static uid is there so that files created by this daemon have a constant numerical owner, so the group rtkit
I create in this PR must also have a static gid.
It might be the case that neither the user nor the group need a static id at all, but I think this is out of scope of the PR.
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.
I'm pretty sure we can let all of these just be allocated dynamically, which we should do according to https://github.com/NixOS/rfcs/blob/master/rfcs/0052-dynamic-ids.md. You can do that by just not setting a gid
in the group definition.
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.
My point is merely that a static uid is required iff a static gid is required. So I'm not the one to make the decision to remove the static uid. The maintainers of each module should.
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.
I don't think a a static uids and gids are linked together? Or where do you see that? Is there an error if you don't assign a static gid?
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.
we fix uids because filesystems retain ownership by uid, not user name (as attested by the header of ids.nix, which mentions services with many files). This rationale applies equally to group ownership.
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.
does that look reasonable to you, @infinisil?
That last commit seems to be fixups that can be squashed. |
I'm facing a similar problem with #126289. |
as far as I understand, root group for setuid and root user for setgid should be best. These should not be written at all anyway, and they only work because they are world readable/executable. |
this is unsafe, as many distinct services may be running as the same nogroup group.
a122553
to
fcd321e
Compare
I fixed the merge conflict |
nixos/modules/security/rtkit.nix
Outdated
description = "RealtimeKit daemon"; | ||
}; | ||
users.groups.rtkit.gid = config.ids.gids.rtkit; |
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.
Re #133166 (comment), you can change this to
users.groups.rtkit.gid = config.ids.gids.rtkit; | |
users.groups.rtkit = {}; |
Which will work just as well as the current version of this PR, but without requiring a static gid (so the rtkit
entry in ids.nix
can be deleted). This is exactly what NixOS/rfcs#52 is about, to not use static uid/gid's, which this PR goes against in its current state.
But also like, this PR breaks file ownership either way: Previously the files were owned by nogroup
, but now the service will be run by gid rtkit
(whether it be dynamically allocated or statically).
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.
ok but then I should also remove the static uid
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.
Some more info: We discussed this on matrix. @symphorien made a good argument that whether we choose static or dynamic ids, it should be the same for uid and gid, because any reason to use either static or dynamic can equally be applied to both uid's and gid's.
I suggested to then make them both dynamic, in order to go towards the RFC's direction
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.
done.
I think all reviews were addressed. I would like to merge next week unless someone speaks up. |
0af9234
to
27f0f89
Compare
@GrahamcOfBorg test gnome |
Looking good! |
System not building with vsftpd enabled
After add:
|
Add a group after the removal of the nogroup default in NixOS#133166.
The group was actually there but I didn't add it by mistake. This fixes the evaluation after for NixOS#133166.
This fixes the evaluation after for NixOS#133166.
This fixes the evaluation after for NixOS#133166.
This fixes the evaluation after for NixOS#133166.
Motivation for this change
This is unsafe. #130649 shows that most objections raised are about the UX for modules that need adaption so I added a better error message. I also fixed a lot of modules in nixpkgs. Now no nixos test fails to evaluate because of this change.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)