Skip to content

Commit 231e0a7

Browse files
committed
Add notes about Debian
1 parent 422efb3 commit 231e0a7

File tree

1 file changed

+6
-2
lines changed
  • keps/sig-storage/1710-selinux-relabeling

1 file changed

+6
-2
lines changed

keps/sig-storage/1710-selinux-relabeling/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ Further in this KEP we assume that the SELinux is enabled on the system. This KE
118118

119119
See [SELinux documentation](https://selinuxproject.org/page/NB_MLS) for more details.
120120

121+
In this document we use `container_t` and `container_file_t` labels for container processes / files, which are the default labels on Fedora based distributions (AlmaLinux, CentOS, Red Hat Enterprise Linux, Rocky Linux, ...).
122+
For example, Debian uses `svirt_lxc_net_t` and `svirt_lxc_file_t` as the default labels for containers, but the principles are the same.
123+
The implementation of this KEP does not depend on the actual labels used in the system.
124+
121125
### SELinux label assignment
122126
In Kubernetes, the SELinux label of a pod is assigned in two ways:
123127
1. Either it is set by user in PodSpec or Container: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/.
@@ -465,13 +469,13 @@ spec:
465469
* Same as the previous story. Kubelet mounts the volume without any SELinux option + the container runtime relabels the volumes recursively.
466470

467471
**Feature gates `SELinuxMountReadWriteOncePod == true` && `SELinuxMount == false`**:
468-
* If `myclaim` is a RWOP volume (`Spec.AccessModes == ["ReadWriteOncePod']`) *and* the corresponding CSI drivers support SELinux mount, kubelet mounts the volume with `-o context=system_u:object_r:container_file_t:s0:c10,c0`.
472+
* If `myclaim` is a RWOP volume (`Spec.AccessModes == ["ReadWriteOncePod']`) *and* the corresponding CSI drivers support SELinux mount, kubelet fills the blanks in the `seLinuxOptions` from the system defaults (`user: system_u`, `role: object_r`, `type: container_t` on Fedora based distros), translates them to a file label (`container_t` -> `container_file_t`) and mounts the volume with `-o context=system_u:object_r:container_file_t:s0:c10,c0`.
469473
* If `myclaim` is any other volume, kubelet mounts the volume without any SELinux option + the container runtime relabels the volume recursively.
470474
* The secret token volume is relabeled by the container runtime, because Secret and Projected volumes do not support SELinux mount.
471475

472476
**Feature gates `SELinuxMountReadWriteOncePod == true` && `SELinuxMount == true`**:
473477
* Since there is no `SELinuxChangePolicy` set, kubelet implies `MountOption`.
474-
If the corresponding CSI driver (or in-tree volume plugin) support SELinux mount, the volume is mounted with `-o context=system_u:object_r:container_file_t:s0:c10,c0`.
478+
If the corresponding CSI driver (or in-tree volume plugin) support SELinux mount, kubelet fills the blanks in the `seLinuxOptions` from the system defaults as described above and the volume is mounted with `-o context=system_u:object_r:container_file_t:s0:c10,c0`.
475479
* Otherwise, kubelet mounts the volume without any SELinux option + the container runtime relabels the volume recursively.
476480
* The secret token volume is relabeled by the container runtime, because Secret and Projected volumes do not support SELinux mount.
477481

0 commit comments

Comments
 (0)