]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: acme: add the dns-01-record field to the sink
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 22 Oct 2025 16:31:51 +0000 (18:31 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 23 Oct 2025 09:14:07 +0000 (11:14 +0200)
The dns-01-record field in the dpapi sink, output the authentication
token which is needed in the TXT record in order to validate the DNS-01
challenge.

src/acme.c

index 851aede88e2baf9421b9f7c561ced5c734999570..6e97608293827a8f74144192ca03777f45c0b36d 100644 (file)
@@ -1688,10 +1688,13 @@ int acme_res_auth(struct task *task, struct acme_ctx *ctx, struct acme_auth *aut
                /* compute a response for the TXT entry */
                if (strcasecmp(ctx->cfg->challenge, "dns-01") == 0) {
                        struct sink *dpapi;
-                       struct ist line[13];
+                       struct ist line[16];
                        int nmsg = 0;
+                       struct buffer *dns_record = NULL;
 
-                       if (acme_txt_record(ist(ctx->cfg->account.thumbprint), auth->token, &trash) == 0) {
+                       dns_record = get_trash_chunk();
+
+                       if (acme_txt_record(ist(ctx->cfg->account.thumbprint), auth->token, dns_record) == 0) {
                                memprintf(errmsg, "couldn't compute the dns-01 challenge");
                                goto error;
                        }
@@ -1716,6 +1719,12 @@ int acme_res_auth(struct task *task, struct acme_ctx *ctx, struct acme_auth *aut
                                line[nmsg++] = ist(ctx->cfg->vars);
                                line[nmsg++] = ist("\"\n");
                        }
+                       if (auth->dns.ptr) {
+                               line[nmsg++] = ist("dns-01-record \"");
+                               line[nmsg++] = ist2(dns_record->area, dns_record->data);
+                               line[nmsg++] = ist("\"\n");
+                       }
+
                        line[nmsg++] = ist2( hc->res.buf.area, hc->res.buf.data); /* dump the HTTP response */
                        line[nmsg++] = ist("\n\0");