]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: ssl: fix verify bypass on duplicated crt-list ssl configs
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 1 Dec 2026 10:09:18 +0000 (10:09 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 1 Dec 2026 10:18:27 +0000 (11:18 +0100)
crtlist_dup_ssl_conf() duplicates a ssl_bind_conf for the crt-list
entries created by the multi-keytype bundle emulation (crt.pem.ecdsa +
.pem.rsa) and for each "ssl-f-use" rule, but it never copied the
verify, no_ca_names, early_data and ktls scalar fields. Because dst
is allocated with calloc(), the duplicates always carried
verify == SSL_SOCK_VERIFY_NONE, so the switch in
ssl_sock_prepare_ctx() fell back to the bind-level ssl_conf and
configured OpenSSL with SSL_VERIFY_NONE: a "verify required ca-file"
set on a crt-list line or on a ssl-f-use line was silently ignored
for every keytype of a bundle (and for the whole frontend with
ssl-f-use), letting unauthenticated clients complete the TLS
handshake and reach the backend with ssl_c_used == 0, without any
warning at startup or under "haproxy -c".

The bundle duplication exists since 2.3 and the ssl-f-use rules since
3.2. Copying the scalar fields is enough to restore the intended
behaviour: entry-level verify is now enforced on every duplicated
entry.

Note for backports: the ktls field of struct ssl_bind_conf was
introduced in 3.3 (e8674658aec "MINOR: cfgparse: Add a new ktls option
to bind and server"), so the "dst->ktls = src->ktls;" line must be
dropped when backporting to 3.2, 3.1 and 3.0. The other three fields
(verify, no_ca_names, early_data) exist in every concerned branch.

Reported-by: Dominik Maier <dmnk@google.com>
src/ssl_crtlist.c

index 023f8ebc9e7f8631c0ce5660d711e7f53b7c8363..529b4344ce5cb3b99f89671d251e81ad11ab93d5 100644 (file)
@@ -117,6 +117,12 @@ struct ssl_bind_conf *crtlist_dup_ssl_conf(struct ssl_bind_conf *src)
                dst->alpn_len = src->alpn_len;
        }
 #endif
+
+       dst->verify = src->verify;
+       dst->no_ca_names = src->no_ca_names;
+       dst->early_data = src->early_data;
+       dst->ktls = src->ktls;
+
        if (src->ca_file) {
                dst->ca_file = strdup(src->ca_file);
                if (!dst->ca_file)