]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: ssl/cli: keep the crt-store conf on "add ssl crt-list"
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 25 Nov 2026 17:04:35 +0000 (18:04 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 25 Nov 2026 16:51:43 +0000 (17:51 +0100)
In cli_parse_add_crtlist(), a store without any instance takes the conf
parsed from the line, even when it was declared in a crt-store section.
So adding such a certificate to a crt-list over the CLI silently drops
the settings of its "load" line: the file names are no longer reported
by "show ssl cert", and above all "ocsp-update on" is lost, so no OCSP
update is scheduled for it. A line with other keywords also replaces the
ones of the crt-store, while this is refused in a crt-list file.

Let's only replace the conf when the store doesn't come from a
crt-store, and compare the confs otherwise, as is done at boot. This
relies on the previous patch to work on an updated certificate. This was
introduced by commit 1bc6e990f ("MEDIUM: ssl/cli: handle crt-store
keywords in crt-list over the CLI") in 3.0-dev12, so this should be
backported to 3.0.

src/ssl_crtlist.c

index a3fb796188df92a586f789e244bd29b42e0822b7..758d2300dd01cb18f8dd57188db3341f8fc9072b 100644 (file)
@@ -1419,10 +1419,10 @@ static int cli_parse_add_crtlist(char **args, char *payload, struct appctx *appc
        }
 
        /* We can use a crt-store keyword when:
-        * - no ckch_inst are linked OR
+        * - no ckch_inst are linked and the store is not from a crt-store OR
         * - ckch_inst are linked but exact same ckch_conf is used.
         */
-       if (LIST_ISEMPTY(&store->ckch_inst)) {
+       if (LIST_ISEMPTY(&store->ckch_inst) && store->conf.used != CKCH_CONF_SET_CRTSTORE) {
 
                old_cc = store->conf;
                store->conf = cc;