1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-14 00:06:45 +00:00
kyverno/charts/kyverno/templates/policies/default/disallow-host-ports.yaml
Raj Babu Das bb9e73a316 Adding policies(default, restricted) to kyverno helm charts
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
2021-01-24 05:09:47 +05:30

32 lines
No EOL
926 B
YAML

{{- if eq .Values.policyType "default" }}
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-host-ports
annotations:
policies.kyverno.io/category: Pod Security Standards (Default)
policies.kyverno.io/description: >-
Access to host ports allows potential snooping of network traffic and should not be
allowed, or at minimum restricted to a known list.
spec:
validationFailureAction: audit
background: true
rules:
- name: host-ports
match:
resources:
kinds:
- Pod
validate:
message: >-
Use of host ports is disallowed. The fields spec.containers[*].ports[*].hostPort
and spec.initContainers[*].ports[*].hostPort must be empty.
pattern:
spec:
=(initContainers):
- =(ports):
- X(hostPort): 0
containers:
- =(ports):
- X(hostPort): 0
{{- end -}}