]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: acme: check if acme domains are configured
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 21 May 2025 09:13:09 +0000 (11:13 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 21 May 2025 09:41:28 +0000 (11:41 +0200)
When starting the ACME task with a ckch_conf which does not contain the
domains, the ACME task would segfault because it will try to dereference
a NULL in this case.

The patch fix the issue by emitting a warning when no domains are
configured. It's not done at configuration parsing because it is not
easy to emit the warning because there are is no callback system which
give access to the whole ckch_conf once a line is parsed.

No backport needed.

src/acme.c

index a1197f3b7f4f2c781c32a37ce950854c3f24a92c..f983665c6f8550e600c90cd22916ec5d89909c68 100644 (file)
@@ -2266,6 +2266,11 @@ static int acme_start_task(struct ckch_store *store, char **errmsg)
                goto err;
        }
 
+       if (!store->conf.acme.domains) {
+               memprintf(errmsg, "No 'domains' were configured for certificate. ");
+               goto err;
+       }
+
        cfg = get_acme_cfg(store->conf.acme.id);
        if (!cfg) {
                memprintf(errmsg, "No ACME configuration found for file '%s'.\n", store->path);