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
Podman 4.0.0+ fails to SELinux-relabel symlinks in volumes when using the ":Z" option, resulting in "permission denied" errors (Regression, bisected) #13727
Comments
@rhatdan PTAL |
This is what the fix in opencontainers/selinux is all about, calling lsetfilecon versus setfilecon. |
Thanks, I didn't realize a fix was already available on the dependency. I tested applying #13689 and it does indeed fix the issue. |
4.0.2 + #13689 works as far as I tested, but 4.0.3 + #13689 fails to run
My guess is that containers/buildah#3630 started using EDIT: Indeed I removed the call to |
A friendly reminder that this issue had no activity for 30 days. |
Should be fixed in podman 4.1 |
@rhatdan I'm having problems with both
Not sure if this is the same issue/root cause, or a different one? Please let me know if you'd like me to file a new one. Thanks! |
@ncdc Looks like a different issue to me, the operation should not fail on 4.1.0 and for you it doesn't fail on Also, Mac doesn't support SELinux at all, does it? So you may be able to drop the |
Yes, the :Z and :z will not work on networked mounted volumes, which are used on a MAC. We are working on virtiofsd support for SELinux which could also work on a MAC, but this does not exists yet. |
I seem to have a similar issue on Podman 3.4.4 (which is the default on Ubuntu 22.04) but according to the issue description this shouldn't happen on 3.4.4. PS: Or is there at least a possibility to properly install and maintain a current stable Podman version on Ubuntu 22.04? |
@alexanderadam Looks like a different issue, the one reported here was only on Podman 4.x.x and was related to SELinux, which Ubuntu doesn't use by default. Your issue looks more like a users/permissions issue. You're probably not going to get much help in this GitHub tracker unless you can reproduce it on the latest version. No idea how it can be installed on Ubuntu 22.04 though. FWIW I tried to run your image from the Ubuntu 22.04.1 Server LiveCD shell and it appears to get pretty far without the error you mention:
So your issue may be related to how you're running podman or which permissions you have in your volume mounts if you have any, so try to include those in your reports. |
Is this a BUG REPORT or FEATURE REQUEST?
/kind bug
Description
When mounting a volume containing symlinks using Podman 4.0.0+ in a SELinux-enabled system (e.g. a clean Fedora 36 Workstation beta install), specifying the
:Z
flag in order to relabel the files in the volume, the symlink is not relabeled (but regular files are), resulting in "permission denied" errors.Running the same commands in a similar system, but using Podman 3.4.4 (e.g. a clean Fedora 35 Workstation install), the problem does not reproduce.
Steps to reproduce the issue
Install Podman 4.0.0+ in a SELinux-enabled system, e.g. a clean Fedora 36 Workstation beta install.
Open a terminal and set up some test files:
Describe the results you received:
I received a permission denied error when trying to access the "link" symlink but not for the "file" regular file.
Describe the results you expected:
I expected the "link" symlink to be accessible inside the container just like the "file" regular file.
Additional information you deem important (e.g. issue happens only occasionally):
The regular file is relabeled while the symlink is not relabeled:
Running with
--security-opt label=disable
resolves the issue, confirming it's related to SELinux:strace shows that
setxattr
is being used over the symlink (note thatsetxattr
does follow symlinks):Compare the output above with Fedora 35 + Podman 3.4.4. The problem does not reproduce and
lsetxattr
is being used over the symlink:This change in behavior is caused by commit f564c9a (upstream opencontainers/selinux@1b18907), reverting it fixes the issue.
Note how the commit renames the original
setFileLabel
->lSetFileLabel
, and introduces a newsetFileLabel
function that does follows symlinks.Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Reproduced on both local QEMU-KVM virtual machines and bare metal, running Fedora 35/36 Beta.
The text was updated successfully, but these errors were encountered: