-
Notifications
You must be signed in to change notification settings - Fork 1.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
Host users take ownership of existing home directories #47107
Conversation
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.
Do we have to recursively chown the whole home directory tree rather than make just the directory owned, readable(?) and accessible by the user? What if there's something in there that's owned by root and is not supposed to be read by the user?
If we do this we should definitely at least check and see if the uid that owns the directory isn't a user that already exists in the system.
lib/srv/usermgmt_linux.go
Outdated
// filepath.WalkDir is documented to walk the paths in lexical order, iterating | ||
// in the reverse order ensures that files are always Lchowned before their parent directory |
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 is this necessary? Collecting a slice of unbounded size of paths doesn't feel great.
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.
It probably isn't 🤔 This was copied from the existing function that used to be in utils, but I don't see any reason to keep this behavior
I think it depends on the expected behavior here. As far as I understand, the primary usage would be in moving users over to teleport that were previously managed some other way. Which would benefit from taking ownership of everything since it's meant to be effectively the same user. @rosstimothy do you think it would be acceptable to only take ownership of the directory and not the contents? Validating the UIDs are "safe" to overwrite is a great idea 👍 |
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
179162b
to
de9c464
Compare
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
e0a1f57
to
884db9a
Compare
8e30806
to
b214b0c
Compare
b214b0c
to
53c3e8e
Compare
Hello team 👋
These are just the first aspects I could think of, but the exploitability of automated
Just to conclude, even on Linux itself, if the $HOME exists, they just inform the user without doing anything tricky |
Closing in favor of #47524 |
This PR updates
CreateHomeDirectory
such that it takes ownership of existing home directories and their contents. I originally thought we were alreadychown
ing the directory contents and we were just omitting the directory itself. However, I realized while implementing that this only happened for the files copied from skel so we'll need to figure out if this is something we want to move forward with or notchangelog: Allows host user creation to take ownership of existing home directories on behalf of the newly created user.