selinux.Chcon should check legal rather then just label.Relabel#181
Merged
rhatdan merged 1 commit intoopencontainers:mainfrom Sep 26, 2022
Merged
selinux.Chcon should check legal rather then just label.Relabel#181rhatdan merged 1 commit intoopencontainers:mainfrom
rhatdan merged 1 commit intoopencontainers:mainfrom
Conversation
Since label.Relabel ends up calling into selinux.chcon, we should do the check for invalid directories under chcon. This will allow the selinux.Chcon function to also be verified. Signed-off-by: Daniel J Walsh <[email protected]>
Collaborator
Author
thaJeztah
reviewed
Sep 26, 2022
Comment on lines
+1114
to
+1122
| if home := os.Getenv("HOME"); home != "" { | ||
| exclude_paths[home] = true | ||
| } | ||
|
|
||
| if sudoUser := os.Getenv("SUDO_USER"); sudoUser != "" { | ||
| if usr, err := user.Lookup(sudoUser); err == nil { | ||
| exclude_paths[usr.HomeDir] = true | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Will this part bring back the issue you ran into that you were trying to solve in #180?
But some users put homedirectories under /usr, and I see no reason to block them from relabeling.
Collaborator
Author
There was a problem hiding this comment.
No the #180 was blocking /usr/*
Now we are just blocking /usr or $HOME not $HOME/*
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since label.Relabel ends up calling into selinux.chcon, we should do the check for invalid directories under chcon. This will allow the selinux.Chcon function to also be verified.
Signed-off-by: Daniel J Walsh [email protected]