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

Try harder to get existing user ID #180

Merged
merged 7 commits into from
Oct 21, 2024
Merged

Try harder to get existing user ID #180

merged 7 commits into from
Oct 21, 2024

Conversation

Itxaka
Copy link
Collaborator

@Itxaka Itxaka commented Oct 17, 2024

No description provided.

Copy link
Collaborator

@jimmykarily jimmykarily left a comment

Choose a reason for hiding this comment

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

So no more explicit uid right? We should update the documentation to explain how it works.

pkg/plugins/user.go Outdated Show resolved Hide resolved
Co-authored-by: Dimitris Karakasilis <[email protected]>
@Itxaka
Copy link
Collaborator Author

Itxaka commented Oct 18, 2024

So no more explicit uid right? We should update the documentation to explain how it works.

yes indeed, uid/guid via the User plugin is not supported anymore as it can cause issues. There is alternatives like using the Entitites plugin directly or using the Commands and call useradd

EDIT: Actually the User plugin docs in yip already does not mention the UID/GUID field....

Signed-off-by: Itxaka <[email protected]>
@Itxaka Itxaka marked this pull request as ready for review October 18, 2024 07:55
pkg/schema/schema.go Outdated Show resolved Hide resolved
@mudler
Copy link
Owner

mudler commented Oct 21, 2024

Cross referencing: kairos-io/kairos#2949

uid := -1

// If UID is specified just put it there. No matter whats in the system or the collisions. Good luck.
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤣

uid, err = list.GenerateUIDInRange(entities.HumanIDMin, entities.HumanIDMax)
if err != nil {
return errors.Wrap(err, "no available uid")
// Try to see if the user was created previously with a given UID by checking for an existing home dir
Copy link
Collaborator

Choose a reason for hiding this comment

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

won't this be problematic since you can define a user like:

stages:
   default:
     - name: "Setup users"
       users: 
          bastion: 
            passwd: "strongpassword"
            homedir: "/home/foo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

everything is problematic in here, thats what happens when you give users too much choice. They dont know whats better for them.

We are just trying harder to get it if its there, unfortunately we cannot cover all angles. What happens if during one boot the user has the default dir and the next one he modified to now set the homedir specifically in the config? All their files are gone? On a different dir? What if he also changes the uid? Now they are gone and also he cant access them anymore?

Too many different paths and scenarios due to the broad config spectrum of the user.

@Itxaka Itxaka merged commit 5338e89 into master Oct 21, 2024
3 checks passed
@Itxaka Itxaka deleted the get_user_id branch October 21, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants