Access to host ports allows potential snooping of network traffic and should not be allowed by requiring host ports be undefined (recommended) or at minimum restricted to a known list. This policy ensures the `hostPort` field, if defined, is set to either a port in the specified range or to a value of zero. This policy is mutually exclusive of the disallow-host-ports policy. Note that Kubernetes Pod Security Admission does not support the host port range rule.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: disallow-host-ports-rangeannotations:policies.kyverno.io/title: Disallow hostPorts Range (Alternate)policies.kyverno.io/category: Pod Security Standards (Baseline)policies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podkyverno.io/kyverno-version: 1.6.0policies.kyverno.io/minversion: 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 by requiring host ports be undefined (recommended) or at minimum restricted to a known list. This policy ensures the `hostPort` field, if defined, is set to either a port in the specified range or to a value of zero. This policy is mutually exclusive of the disallow-host-ports policy. Note that Kubernetes Pod Security Admission does not support the host port range rule.spec:validationFailureAction: Auditbackground: truerules:- name: host-port-rangematch:any:- resources:kinds:- Podpreconditions:all:- key: "{{ request.operation }}"operator: NotEqualsvalue: DELETEvalidate:message: The only permitted hostPorts are in the range 5000-6000 or 0.deny:conditions:all:- key: "{{ request.object.spec.[ephemeralContainers, initContainers, containers][].ports[].hostPort }}"operator: AnyNotInvalue: 5000-6000- key: "{{ request.object.spec.[ephemeralContainers, initContainers, containers][].ports[].hostPort }}"operator: AnyNotInvalue:- 0
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.