1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-13 15:57:31 +00:00
kyverno/charts/kyverno/templates/policies/default/disallow-proc-mount.yaml
treydock 48f0d90dd1
Allow some helm policies to be excluded (#1611)
* Allow some helm policies to be excluded

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>

* Make Helm security policies opt-in when podSecurityStandard=custom

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-02-18 11:50:35 -08:00

34 lines
No EOL
1.1 KiB
YAML

{{- $name := "require-default-proc-mount" }}
{{- if eq (include "kyverno.podSecurityDefault" (merge (dict "name" $name) .)) "true" }}
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: {{ $name }}
annotations:
policies.kyverno.io/category: Pod Security Standards (Default)
policies.kyverno.io/description: >-
The default /proc masks are set up to reduce attack surface and should be required.
spec:
validationFailureAction: {{ .Values.validationFailureAction }}
background: true
rules:
- name: check-proc-mount
match:
resources:
kinds:
- Pod
validate:
message: >-
Changing the proc mount from the default is not allowed. The fields
spec.containers[*].securityContext.procMount and
spec.initContainers[*].securityContext.procMount must not be changed
from `Default`.
pattern:
spec:
=(initContainers):
- =(securityContext):
=(procMount): "Default"
containers:
- =(securityContext):
=(procMount): "Default"
{{- end -}}