[rootless] [quadlet] [selinux] #23222
Replies: 11 comments 11 replies
-
I don't see why you need any of these. This should all work with standard SELinux policy in container-selinux. You should not need |
Beta Was this translation helpful? Give feedback.
-
Before this (udica and process file), selinux reported the same issue. I'm doing some tries and test how to fix it and I have seen in audit log (cockpit): But after reboot, everything is back to the same issue reporting state. |
Beta Was this translation helpful? Give feedback.
-
I removed the modules created by udica and it is still the same. ls -laZ
ps -efZ | grep valkey
|
Beta Was this translation helpful? Give feedback.
-
I thought, the level (s0:c168,c597) is only for mls. I have default fedora type - targeted. if the level is taken for targeted too, does it have to do with UserNS=keep-id:uid=1000,gid=1000 ? And if you mean the domain labels, articles on google said, it should be like this. that container_t has access to container_file_t. I haven't changed these labels manually. |
Beta Was this translation helpful? Give feedback.
-
Yes, it is in home directory, see the quadlet file above:
you probably meant $HOME/valkey I tried restorecon of $HOME/valkey, run container again and thenrebooted (to check new rows in audit log, which is always missing after restart of service) and issue is still the same. |
Beta Was this translation helpful? Give feedback.
-
Hmm, that is strange, i tried it again, just for check the level for process and file, for posting it here"
after restart
and after reboot:
It seems to be stable now. I don't know how, but I will try to apply it the same way to other containers and will see. |
Beta Was this translation helpful? Give feedback.
-
Ok, so test is this: restorecon -R -F /home/* && reboot
restorecon -R -F /home/immich/valkey && reboot
restorecon -R -F /home/immich/valkey && restart service
restorecon -R -F /home/* && restart all services
then reboot
now when I know a little bit, that labeled should be only directories which is as volume into container, strange looking home, all files have the same label, even some of them have nothing to do with container. Directories library, postgres, valkey and cache are volumes to 4 different containers.
And once more restorecon -R -F /home/immich/valkey && restart service
and then reboot - level labels were changed, but files are still compatible with process
Result: I'm sure, how now make containers working. But I'm not sure how to change home directory. I think everything shouldn't be labeled as container_file_t. I would expect user_home_t. But if I use restorecon in home directory, it will change it to next restart and then it will make containers bad. Also, is this expected behavior? For me it seems pretty unstable. I cannot restart services by reboot, during the change context of selinux. |
Beta Was this translation helpful? Give feedback.
-
After restorecon -R -F /home/immich/
restart services
reboot
It seems level was relabeled after reboot, but other labels are still the same. Maybe it have to be relabeled every run of the container. At least home is ok. hmm, I just remembered one thing. I really some homes put as volumes into container. Not for usual processes, but for backup. So, I have backup container which is doing this. I have it on timer, but because it is quadlet file, it cannot be disabled from running at startup. So, it can sometimes mix the labels, just when machine is rebooted. What should I do with it? I put there volumes as home directories, because I didn't want to put there a lot of directories to quadlet. It runs as user process under root. I'm not sure if it needs relabeling or I should use :z in every container i have. |
Beta Was this translation helpful? Give feedback.
-
It seems to be working now, thanks. :-)
|
Beta Was this translation helpful? Give feedback.
-
I have found probably what you mean:
Which are probably two files my-cockpitws.pp and my-cockpitws.te in /root
So, the rule will be:
? And then build it with:
and that's all? |
Beta Was this translation helpful? Give feedback.
-
It seems to be ok, Thanks a lot for help :-) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have issue with permissions with selinux on podman containers.
For now I have selinux in permissive mode and I can see in cockpit selinux messages like:
I used rules generated by udica from podman inspect. Here is cil file:
And quadlet file:
I'm beginning with selinux. I checked, processes are running with valkey.process, files in directory (mounted via volume) in host and in container seems to have correct permission, which is in cil file.
But selinux still reports these errors in all containers and I don't know why.
Can you help me?
Beta Was this translation helpful? Give feedback.
All reactions