Skip to content

Commit 04606e2

Browse files
committed
fix(kubeovn-webhook): wire client-cert verification end-to-end, observe first
Review of the original commits found both hardening mechanisms inert, and that was correct: the NetworkPolicy could never be enforced because packages/system/kubeovn/values.yaml sets ENABLE_NP: false, so kube-ovn-controller runs with --enable-np=false and programs no ACLs; and --client-ca-file was never passed by the chart, so the RequireAndVerifyClientCert branch was unreachable. Only the TLS 1.2 floor did anything. The NetworkPolicy is dropped rather than fixed. Enforcing it would mean turning on ENABLE_NP for the whole cluster, which is a far larger change than this disclosure warrants, and shipping an object that looks like a control but enforces nothing is worse than not shipping it. Client-cert verification is now reachable: clientCAFile is a chart value and the flag is passed when set. It stays off by default, because turning it on blind is dangerous — this webhook is registered failurePolicy: Fail, so if the API server does not present a certificate (it only does when the cluster runs an AdmissionConfiguration naming a kubeConfigFile for this webhook), requiring one stops pod creation cluster-wide. So the default is tls.RequestClientCert: certificates are requested and logged, never required. Nothing is rejected and admission cannot break, while the log states per issuer whether enforcement is possible on this cluster. Setting clientCAFile then flips it to RequireAndVerifyClientCert. Addresses GHSA-g883-q79m-8225. This commit makes the fix deployable and observable; enforcement is a follow-up once the logs confirm the API server presents a certificate on each supported variant. Assisted-By: Claude Signed-off-by: Andrei Kvapil <[email protected]>
1 parent d497744 commit 04606e2

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎packages/system/kubeovn-webhook/templates/deployment.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ spec:
5050
- "--tls-key-file=/etc/webhook/certs/tls.key"
5151
- "--port-security={{ .Values.portSecurity }}"
5252
- "--routes={{ .Values.routes }}"
53+
{{- with .Values.clientCAFile }}
54+
- "--client-ca-file={{ . }}"
55+
{{- end }}
5356
tolerations:
5457
- effect: NoSchedule
5558
operator: Exists
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
portSecurity: true
22
routes: ""
3+
# Client-certificate verification for callers of the /mutate-pods endpoint.
4+
#
5+
# The handler returns namespace-derived annotations to whoever asks it, so the
6+
# only thing that keeps it from answering an arbitrary in-cluster pod is
7+
# authenticating the caller (GHSA-g883-q79m-8225). NetworkPolicy is not an
8+
# option here: packages/system/kubeovn/values.yaml sets ENABLE_NP: false, so
9+
# kube-ovn-controller programs no ACLs and a NetworkPolicy object would be
10+
# created and never enforced.
11+
#
12+
# Empty (the default) = certificates are requested and logged, never required.
13+
# Nothing is rejected, so this cannot break admission. Read the webhook log:
14+
# "client certificate: presented, issuer ..." → enforcement is possible
15+
# "client certificate: none presented" → it is not, yet
16+
#
17+
# Set it to the in-pod path of a CA bundle to switch to
18+
# RequireAndVerifyClientCert. Do this ONLY after the log confirms the API
19+
# server presents a certificate: this webhook is registered with
20+
# failurePolicy: Fail, so rejecting the API server stops pod creation
21+
# cluster-wide. The API server sends a certificate only when the cluster runs
22+
# with an AdmissionConfiguration that names a kubeConfigFile for this webhook.
23+
clientCAFile: ""
324
image: ghcr.io/cozystack/cozystack/kubeovn-webhook:v1.6.0@sha256:593c324a38db59495497c5b68b90cad25dfe6753c73b7a287b3280e26f70a15f

0 commit comments

Comments
 (0)