-
Notifications
You must be signed in to change notification settings - Fork 20
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
Various fixes to allow uid to be in a correct range #159
Conversation
otherwise the user always appears as if it doesn't exist Signed-off-by: Dimitris Karakasilis <[email protected]>
otherwise we may end up with id 65535 (the "nobody" user) Part of: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
* Generate a user id in the range of human users otherwise we may end up with id 65535 (the "nobody" user) Part of: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]> * Update pkg/entities/user.go Signed-off-by: Dimitris Karakasilis <[email protected]> * Move magic number to constants Signed-off-by: Dimitris Karakasilis <[email protected]> --------- Signed-off-by: Dimitris Karakasilis <[email protected]>
0199e94
to
f95d64b
Compare
if u.PrimaryGroup != "" { | ||
gr, err := osuser.LookupGroup(u.PrimaryGroup) | ||
if err != nil { | ||
return errors.Wrap(err, "could not resolve primary group of user") | ||
} | ||
gid, _ = strconv.Atoi(gr.Gid) | ||
primaryGroup = u.PrimaryGroup | ||
} else { |
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.
not need anymore. That's what the updateGroup.Apply
will do if the gid is -1
.
|
||
uid := 1000 | ||
// reload the group to get the generated 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.
This wouldn't be needed if the ParseGroup had a pointer receiver. I don't want to change that here though to avoid breaking other things. We can consider changing it in the future to avoid this second parsing of groups.
and let them automatically set the uid and gid inside the "human" users range. Relevant: - mauromorales/xpasswd#3 - mudler/entities#15 Signed-off-by: Dimitris Karakasilis <[email protected]>
@@ -205,11 +210,11 @@ func User(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error | |||
for _, k := range users { | |||
r := s.Users[k] | |||
r.Name = k | |||
if !s.Users[k].Exists() { |
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.
Exists()
was never true
because the Name
on the s.Users[k]
wasn't set. It's set on r
above though.
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.
nice catch
to properly set kairos uid and gid in the range of human users Relevant: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
to properly set kairos uid and gid in the range of human users Relevant: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
to properly set kairos uid and gid in the range of human users Relevant: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
to get the yip fix for the user id an gid Relevant: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
to get the yip fix for the user id an gid Relevant: mudler/yip#159 Signed-off-by: Dimitris Karakasilis <[email protected]>
* Use variable that has "Name" assigned otherwise the user always appears as if it doesn't exist Signed-off-by: Dimitris Karakasilis <[email protected]> * Bump entities and xpasswd and let them automatically set the uid and gid inside the "human" users range. Relevant: - mauromorales/xpasswd#3 - mudler/entities#15 Signed-off-by: Dimitris Karakasilis <[email protected]> --------- Signed-off-by: Dimitris Karakasilis <[email protected]> (cherry picked from commit d76f75c)
* Use variable that has "Name" assigned otherwise the user always appears as if it doesn't exist Signed-off-by: Dimitris Karakasilis <[email protected]> * Bump entities and xpasswd and let them automatically set the uid and gid inside the "human" users range. Relevant: - mauromorales/xpasswd#3 - mudler/entities#15 Signed-off-by: Dimitris Karakasilis <[email protected]> --------- Signed-off-by: Dimitris Karakasilis <[email protected]> (cherry picked from commit d76f75c)
https://systemd.io/UIDS-GIDS/#special-distribution-uid-ranges
Relevant: mauromorales/xpasswd#3