]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: acme: alert when the map doesn't exist at startup
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 20 Nov 2025 11:12:33 +0000 (12:12 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 20 Nov 2025 11:22:19 +0000 (12:22 +0100)
When configuring an acme section with the 'map' keyword, the user must
use an existing map. If the map doesn't exist, a log will be emitted
when trying to add the challenge to the map.

This patch change the behavior by checking at startup if the map exists,
so haproxy would warn and won't start with a non-existing map.

This must be backported in 3.2.

src/acme.c

index 9d73f311cdaaaffc0feaff515ea85cef9474c938..f649ba72fdb9651ad74c3a38cc6bc15415fa8490 100644 (file)
@@ -777,6 +777,16 @@ static int cfg_postparser_acme()
                        ha_alert("acme '%s' was used on a crt line [%s:%d], but no '%s' section exists!\n",
                                 tmp_acme->name, tmp_acme->filename, -tmp_acme->linenum, tmp_acme->name);
                }
+               if (tmp_acme->map) {
+                       struct pat_ref *ref;
+
+                       ref = pat_ref_lookup(tmp_acme->map);
+                       if (!ref) {
+                               ret++;
+                               ha_alert("acme section '%s' line [%s:%d] has the map '%s' configured, but this map doesn't exist\n",
+                                        tmp_acme->name, tmp_acme->filename, tmp_acme->linenum, tmp_acme->map);
+                       }
+               }
                tmp_acme = tmp_acme->next;
        }