mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
765 B
765 B
Disallow hostNetwork
and hostPort
Using hostPort
and hostNetwork
allows pods to share the host network stack, allowing potential snooping of network traffic from an application pod.
Policy YAML
disallow_host_network_hostport.yaml
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: validate-host-network-hostport
spec:
rules:
- name: validate-host-network-hostport
match:
resources:
kinds:
- Pod
validate:
message: "Defining hostNetwork and hostPort are not allowed."
pattern:
spec:
(hostNetwork): false
containers:
- name: "*"
ports:
- hostPort: null