-
Notifications
You must be signed in to change notification settings - Fork 4
/
kyverno.yaml
48 lines (48 loc) · 1.32 KB
/
kyverno.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: psp-defaultallowprivilegeescalation
spec:
schemaValidation: false
rules:
- name: psp-defaultallowprivilegeescalation
match:
resources:
kinds:
- Pod
mutate:
patchesJson6902: |-
- op: add
path: "/spec/securityContext/allowPrivilegeEscalation"
value: "false"
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: psp-allowprivilegeescalation
spec:
validationFailureAction: Enforce
rules:
- name: psp-allowprivilegeescalation
match:
resources:
kinds:
- Pod
validate:
message: >-
Privilege escalation is disallowed. The fields
spec.containers[*].securityContext.allowPrivilegeEscalation, and
spec.initContainers[*].securityContext.allowPrivilegeEscalation, and
spec.ephemeralContainers[*].securityContext.allowPrivilegeEscalation must
be undefined or set to `false`.
pattern:
spec:
=(initContainers):
- =(securityContext):
=(allowPrivilegeEscalation): "false"
=(ephemeralContainers):
- =(securityContext):
=(allowPrivilegeEscalation): "false"
containers:
- =(securityContext):
=(allowPrivilegeEscalation): "false"