-
Notifications
You must be signed in to change notification settings - Fork 64
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
recursive Relabel() skips symlinks #172
Comments
rrayst
added a commit
to rrayst/selinux
that referenced
this issue
Mar 17, 2022
Signed-off-by: Tobias Polley <[email protected]>
Fixed by #173 . |
This was referenced Apr 25, 2022
v1.23.6-rc1+k3s1 fails to fully come up when installing via RPM with selinux enabled
k3s-io/k3s#5493
Closed
cmurphy
pushed a commit
to cmurphy/k3s-containerd
that referenced
this issue
Apr 25, 2022
Fixes symlink relabeling issue in opencontainers/selinux#172 Signed-off-by: Brad Davidson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
As described in the comment,
Relabel()
should recursively change the SELinux label on a path and all entries beneath that path.selinux/go-selinux/label/label_linux.go
Line 106 in c9f6104
Currently, it skips symlinks (and instead relabels their targets).
Explanation
1b18907 changed the semantics of
setFileLabel()
from not-dereferencing to dereferencing symlinks before applying the label change. (It also introduced the non-dereferencinglSetFileLabel()
: ThesetFileLabel
/lSetFileLabel
semantics became the same as the one of the kernel syscallssetxattr
/lsetxattr
.)Relabel()
mentioned above calls (Relabel
->Chcon
->chcon
->)rchcon
to get the job done.rchcon
recursively callssetFileLabel
on the path as well as on each item below.selinux/go-selinux/rchcon.go
Lines 13 to 15 in c9f6104
Solution
This should be changed to
lSetFileLabel()
.Result
When running Kubernetes (kubelet) 1.23.4 on top of containerD 1.6.0 on a SELinux-enabled system, this causes ConfigMaps to be unusuable by normal Pods:
(In contrast to the directories and normal files, the symlinks have not been relabeled and are therefore not readable by any process running inside of the container.)
The text was updated successfully, but these errors were encountered: