Files
dsk-devops-toolchains/helm/openebs/templates/kyverno/allow-selinux.yaml
2024-01-03 17:29:11 +09:00

34 lines
1.1 KiB
YAML

{{- if .Values.rbac.kyvernoEnabled }}
apiVersion: kyverno.io/v1
kind: Policy
metadata:
name: allow-selinux
annotations:
policies.kyverno.io/title: Allow SELinux
policies.kyverno.io/category: Pod Security Standards (Baseline)
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Pod
policies.kyverno.io/description: >-
SELinux options can be used to escalate privileges and should be allowed.
spec:
validationFailureAction: enforce
background: true
rules:
- name: seLinux
match:
resources:
kinds:
- Pod
validate:
message: >-
Setting custom SELinux options is allowed. The fields
spec.securityContext.seLinuxOptions, spec.containers[*].securityContext.seLinuxOptions,
and spec.initContainers[*].securityContext.seLinuxOptions must be empty.
pattern:
spec:
=(securityContext):
=(seLinuxOptions): "on"
containers:
- =(securityContext):
=(seLinuxOptions): "on"
{{- end }}