Automatically create and label /opt/cni and /etc/cni/net.d directories#531
Automatically create and label /opt/cni and /etc/cni/net.d directories#531rdoxenham wants to merge 1 commit into
Conversation
This commit automatically creates the /opt/cni and /etc/cni/net.d directories ahead of the RKE2 installer running. This ensures that the correct SELinux labels are applied as per rke2-selinux for these directories, and ensures that CNIs such as Cilium can copy in the required binaries without SELinux AVC errors. The default behaviour of SELinux inherits the underlying /opt and /etc labels when sub-directories are created, thus not allowing the installation to complete successfully.
atanasdinov
left a comment
There was a problem hiding this comment.
Thanks! I guess we could accept this as a short term fix for this particular instance, but the underlying issue seems to be with either how policies are loaded or how the relabelling works.
Actually, I think this is exactly how SELinux is supposed to work, check out #529 (comment) |
|
But all of this should already be covered by the postrpm script, no?
|
That's a very good point. However, these directories aren't even created on the base image: It looks like this only ever gets executed if SELinux is enabled in the build host: And recent changes in rke2-selinux (rancher/rke2-selinux@7a0b8ee) only do this if |
|
I think this script should be fixed to use I'll take a look |
This commit automatically creates the
/opt/cniand/etc/cni/net.ddirectories ahead of the RKE2 installer running. This ensures that the correct SELinux labels are applied as perrke2-selinux(https://github.com/rancher/rke2-selinux/blob/master/policy/slemicro/rke2.fc#L15-L16) for these directories, and ensures that CNIs such as Cilium can copy in the required binaries without SELinux AVC errors. The default behaviour of SELinux inherits the underlying/optand/etclabels when sub-directories are created, thus not allowing the installation to complete successfully.Fixes: #529