1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-13 15:57:31 +00:00
kyverno/charts/kyverno-policies/templates/restricted/deny-privilege-escalation.yaml
Bricktop b53ec25ca5
Make whitespace consistent in various helm charts (#2619)
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-28 23:11:30 -07:00

39 lines
1.4 KiB
YAML

{{- $name := "deny-privilege-escalation" }}
{{- if eq (include "kyverno-policies.podSecurityRestricted" (merge (dict "name" $name) .)) "true" }}
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: {{ $name }}
annotations:
policies.kyverno.io/category: Pod Security Standards (Restricted)
{{- if .Values.podSecuritySeverity }}
policies.kyverno.io/severity: {{ .Values.podSecuritySeverity | quote }}
{{- end }}
policies.kyverno.io/description: >-
Privilege escalation, such as via set-user-ID or set-group-ID file mode, should not be allowed.
labels: {{ include "kyverno-policies.labels" . | nindent 4 }}
app: kyverno
spec:
background: true
validationFailureAction: {{ .Values.validationFailureAction }}
rules:
- name: deny-privilege-escalation
match:
resources:
kinds:
- Pod
validate:
message: >-
Privilege escalation is disallowed. The fields
spec.containers[*].securityContext.allowPrivilegeEscalation, and
spec.initContainers[*].securityContext.allowPrivilegeEscalation must
be undefined or set to `false`.
pattern:
spec:
=(initContainers):
- =(securityContext):
=(allowPrivilegeEscalation): "false"
containers:
- =(securityContext):
=(allowPrivilegeEscalation): "false"
{{- end -}}