Skip to content

Commit ba625bc

Browse files
Demivandsseng
authored andcommitted
fix: allow CSI volumes to be mounted with an SELinux context
CSI-provisioned volumes are mounted by the driver through kubelet, outside Talos's mount manager, so nothing labels their contents and they come out unlabeled_t. Operators can request a label through StorageClass mountOptions, which reaches the driver's mount call, but the mount syscall relabels the filesystem away from fs_t, and pod_p is not permitted relabelfrom on it. Under enforcing the mount fails and the volume is unusable. Grant pod_p relabelfrom on fs_t. The target type is already covered by the existing ephemeral_t fs_classes grant, which maps to the filesystem class too. Fixes #14182 Signed-off-by: Ivan Demchuk <ivan.demchuk@gmail.com> Signed-off-by: Dmitrii Sharshakov <dmitry.sharshakov@siderolabs.com>
1 parent fc0a1f0 commit ba625bc

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

0 Bytes
Binary file not shown.

internal/pkg/selinux/policy/selinux/services/cri.cil

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@
217217
mount
218218
quotaget
219219
quotamod
220-
; relabelfrom
220+
; CSI drivers mount volumes with an explicit context=, requested through StorageClass
221+
; mountOptions, and the mount syscall relabels the filesystem away from fs_t. The target
222+
; type is covered by the ephemeral_t fs_classes grant below.
223+
relabelfrom
221224
; relabelto
222225
remount
223226
unmount

0 commit comments

Comments
 (0)