]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: acme: failure when no directory is specified
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 28 Apr 2025 15:37:21 +0000 (17:37 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 28 Apr 2025 16:20:21 +0000 (18:20 +0200)
The "directory" parameter of the acme section is mandatory. This patch
exits with an alert when this parameter is not found.

src/acme.c

index ced64445cda35ce20bd3cff3145f7d4bd63c33c2..39c7a2b164693425baa6c804c946db55a10ea1ac 100644 (file)
@@ -413,12 +413,19 @@ static int cfg_postsection_acme()
 
        path = cur_acme->account.file;
 
+       if (!cur_acme->directory) {
+               err_code |= ERR_ALERT | ERR_FATAL | ERR_ABORT;
+               ha_alert("acme: No directory defined in ACME section '%s'.\n", cur_acme->name);
+               goto out;
+       }
+
        store = ckch_store_new(path);
        if (!store) {
                ha_alert("acme: out of memory.\n");
                err_code |= ERR_ALERT | ERR_FATAL | ERR_ABORT;
                goto out;
        }
+
        /* tries to open the account key  */
        if (stat(path, &st) == 0) {
                if (ssl_sock_load_key_into_ckch(path, NULL, store->data, &errmsg)) {