From e18992ca19b64561e873957a4c2590487601f4f5 Mon Sep 17 00:00:00 2001 From: ch4nn0n Date: Wed, 15 Jul 2026 21:41:22 +0800 Subject: haproxy: T9097: add ssl checks-only for TLS health checks When load balancing TLS backends in TCP passthrough mode there is currently no way to perform an HTTPS health check: http-check sends the request in plaintext, and the only TLS option (backend ssl no-verify/ca-certificate) renders the 'ssl' keyword on the server lines, which re-encrypts the forwarded traffic and breaks passthrough of clients that already speak TLS end-to-end (e.g. kube-apiserver clients authenticating with TLS client certificates). Add 'set load-balancing haproxy backend ssl checks-only' (valueless). When set, the existing backend ssl options apply to health checks only: server lines get 'check-ssl verify none' or 'check-ssl ca-file .pem' instead of 'ssl ...', leaving forwarded traffic untouched. Commit validation rejects checks-only when no server in the backend has check enabled, or when neither no-verify nor ca-certificate is set, since either case would otherwise be inert. Existing configurations render unchanged. --- data/templates/load-balancing/haproxy.cfg.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2 index 438796cee..9a4ec1fa1 100644 --- a/data/templates/load-balancing/haproxy.cfg.j2 +++ b/data/templates/load-balancing/haproxy.cfg.j2 @@ -252,7 +252,9 @@ backend {{ back }} {% endfor %} {% endif %} {% if back_config.server is vyos_defined %} -{% set ssl_back = 'ssl ca-file /run/haproxy/' ~ back_config.ssl.ca_certificate ~ '.pem' if back_config.ssl.ca_certificate is vyos_defined else ('ssl verify none' if back_config.ssl.no_verify is vyos_defined else '') %} +{# With checks-only, TLS is used for health checks but forwarded traffic stays untouched (e.g. TCP passthrough to TLS backends) #} +{% set ssl_keyword = 'check-ssl' if back_config.ssl.checks_only is vyos_defined else 'ssl' %} +{% set ssl_back = ssl_keyword ~ ' ca-file /run/haproxy/' ~ back_config.ssl.ca_certificate ~ '.pem' if back_config.ssl.ca_certificate is vyos_defined else (ssl_keyword ~ ' verify none' if back_config.ssl.no_verify is vyos_defined else '') %} {% for server, server_config in back_config.server.items() %} {% set address = server_config.address %} {% set port = server_config.port %} -- cgit v1.2.3