Access to host ports allows potential snooping of network traffic and should not be allowed, or at minimum restricted to a known list. This policy ensures the `hostPort` field is unset or set to `0`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: disallow-host-portsannotations:policies.kyverno.io/title: Disallow hostPortspolicies.kyverno.io/category: Pod Security Standards (Baseline)policies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podkyverno.io/kyverno-version: 1.6.0kyverno.io/kubernetes-version: 1.22-1.23policies.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. This policy ensures the `hostPort` field is unset or set to `0`. "spec:validationFailureAction: Auditbackground: truerules:- name: host-ports-nonematch:any:- resources:kinds:- Podvalidate:message: Use of host ports is disallowed. The fields spec.containers[*].ports[*].hostPort , spec.initContainers[*].ports[*].hostPort, and spec.ephemeralContainers[*].ports[*].hostPort must either be unset or set to `0`.pattern:spec:"=(ephemeralContainers)":- "=(ports)":- "=(hostPort)": 0"=(initContainers)":- "=(ports)":- "=(hostPort)": 0containers:- "=(ports)":- "=(hostPort)": 0
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.