All Policies

Enforce Consul min TLS version

This policy will check the TLS Min version to ensure that whenever the mesh is set, there is a minimum version of TLS set for all the service mesh proxies and this enforces that service mesh mTLS traffic uses TLS v1.2 or newer.

Policy Definition

/consul/enforce-min-tls-version/enforce-min-tls-version.yaml

 1apiVersion: kyverno.io/v1
 2kind: ClusterPolicy
 3metadata:
 4  name: enforce-min-tls-version
 5  annotations:
 6    policies.kyverno.io/title: Enforce Consul min TLS version 
 7    policies.kyverno.io/category: Consul
 8    policies.kyverno.io/severity: medium
 9    policies.kyverno.io/subject: Mesh
10    kyverno.io/kyverno-version: 1.8.0
11    policies.kyverno.io/minversion: 1.6.0
12    kyverno.io/kubernetes-version: "1.24"
13    policies.kyverno.io/description: >-
14            This policy will check the TLS Min version to ensure that whenever the mesh is set, there is a minimum version of TLS set for all the service mesh proxies and this enforces that service mesh mTLS traffic uses TLS v1.2 or newer.
15spec:
16  validationFailureAction: enforce
17  background: true
18  rules:
19  - name: check-for-tls-version
20    match:
21      any:
22      - resources:
23          kinds:
24            - Mesh
25    validate:
26      message: The minimum version of TLS is TLS v1_2
27      pattern:
28        spec:
29          tls:
30            incoming:
31              tlsMinVersion: TLSv1_2