Skip to content

Commit 8ecdca3

Browse files
committed
SCC: add hostmount-anyuid-v2
the intent of hostmount-anyuid is to allow a pod access to paths on the host. The problem is, hostPath volumes aren't selinux relabeled, and there are paths that the default selinux type `container_t` cannot access. This breaks expectation, and makes pods that rely on hostmount-anyuid brittle to selinux changes on the host (see https://issues.redhat.com/browse/OCPBUGS-55013) Instead of relaxing permissions of all paths on the host, or increasing the ability of container_t, we should trust pods that are granted access to this already powerful SCC to use its power fully. Signed-off-by: Peter Hunt <[email protected]>
1 parent 218530f commit 8ecdca3

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
annotations:
5+
include.release.openshift.io/ibm-cloud-managed: "true"
6+
include.release.openshift.io/self-managed-high-availability: "true"
7+
include.release.openshift.io/single-node-developer: "true"
8+
rbac.authorization.kubernetes.io/autoupdate: "true"
9+
name: system:openshift:scc:hostmount-anyuid-v2
10+
rules:
11+
- apiGroups:
12+
- security.openshift.io
13+
resourceNames:
14+
- hostmount-anyuid-v2
15+
resources:
16+
- securitycontextconstraints
17+
verbs:
18+
- use
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
allowHostDirVolumePlugin: true
2+
allowHostIPC: false
3+
allowHostNetwork: false
4+
allowHostPID: false
5+
allowHostPorts: false
6+
allowPrivilegeEscalation: true
7+
allowPrivilegedContainer: false
8+
allowedCapabilities:
9+
apiVersion: security.openshift.io/v1
10+
defaultAddCapabilities:
11+
fsGroup:
12+
type: RunAsAny
13+
groups: []
14+
kind: SecurityContextConstraints
15+
metadata:
16+
annotations:
17+
include.release.openshift.io/ibm-cloud-managed: "true"
18+
include.release.openshift.io/self-managed-high-availability: "true"
19+
include.release.openshift.io/single-node-developer: "true"
20+
release.openshift.io/create-only: "true"
21+
kubernetes.io/description: |-
22+
hostmount-anyuid-v2 provides all the features of the
23+
restricted SCC but allows host mounts any UID, and any SELinux label by a pod. This is primarily
24+
used by the persistent volume recycler. WARNING: this SCC allows host file
25+
system access as any UID, including UID 0. Grant with caution.
26+
name: hostmount-anyuid-v2
27+
priority:
28+
readOnlyRootFilesystem: false
29+
requiredDropCapabilities:
30+
- MKNOD
31+
runAsUser:
32+
type: RunAsAny
33+
seLinuxContext:
34+
type: RunAsAny
35+
supplementalGroups:
36+
type: RunAsAny
37+
volumes:
38+
- configMap
39+
- csi
40+
- downwardAPI
41+
- emptyDir
42+
- ephemeral
43+
- hostPath
44+
- nfs
45+
- persistentVolumeClaim
46+
- projected
47+
- secret

0 commit comments

Comments
 (0)