From 95895cd45a0868c0aad3db859a0db052db925e25 Mon Sep 17 00:00:00 2001 From: Shiloh Heurich Date: Mon, 5 Feb 2024 18:19:22 -0500 Subject: [PATCH 1/2] feat(chisel2): add dns-account-01 support --- test/chisel2.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/chisel2.py b/test/chisel2.py index e98f5487..eb2288f5 100644 --- a/test/chisel2.py +++ b/test/chisel2.py @@ -115,6 +115,8 @@ def auth_and_issue(domains, chall_type="http-01", email=None, cert_output=None, cleanup = do_http_challenges(client, authzs) elif chall_type == "dns-01": cleanup = do_dns_challenges(client, authzs) + elif chall_type == "dns-account-01": + cleanup = do_dns_account_challenges(client, authzs) else: raise Exception("invalid challenge type %s" % chall_type) @@ -144,6 +146,25 @@ def cleanup(): }).raise_for_status() return cleanup +def do_dns_account_challenges(client, authzs): + cleanup_hosts = [] + for a in authzs: + c = get_chall(a, challenges.DNSACCOUNT01) + name, value = (c.validation_domain_name(client.net.account.uri, a.body.identifier.value), + c.validation(client.net.key)) + cleanup_hosts.append(name) + requests.post(SET_TXT, json={ + "host": name + ".", + "value": value + }).raise_for_status() + client.answer_challenge(c, c.response(client.net.key)) + def cleanup(): + for host in cleanup_hosts: + requests.post(CLEAR_TXT, json={ + "host": host + "." + }).raise_for_status() + return cleanup + def do_http_challenges(client, authzs): port = int(PORT) challs = [get_chall(a, challenges.HTTP01) for a in authzs] From b36693821e3443fc12330a12e2950b7405d88dff Mon Sep 17 00:00:00 2001 From: Shiloh Heurich Date: Mon, 18 Mar 2024 18:12:48 -0400 Subject: [PATCH 2/2] fix: use scope in dns-account-01 challenge --- test/chisel2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/chisel2.py b/test/chisel2.py index eb2288f5..c46ad60b 100644 --- a/test/chisel2.py +++ b/test/chisel2.py @@ -149,8 +149,12 @@ def cleanup(): def do_dns_account_challenges(client, authzs): cleanup_hosts = [] for a in authzs: + scope = "host" + if (a.body.wildcard): + scope = "wildcard" + c = get_chall(a, challenges.DNSACCOUNT01) - name, value = (c.validation_domain_name(client.net.account.uri, a.body.identifier.value), + name, value = (c.validation_domain_name(client.net.account.uri, scope, a.body.identifier.value), c.validation(client.net.key)) cleanup_hosts.append(name) requests.post(SET_TXT, json={