Skip to content

Commit 487ff5b

Browse files
committed
feat(chisel2): add dns-account-01 support
1 parent a8711c9 commit 487ff5b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/chisel2.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def auth_and_issue(domains, chall_type="http-01", email=None, cert_output=None,
115115
cleanup = do_http_challenges(client, authzs)
116116
elif chall_type == "dns-01":
117117
cleanup = do_dns_challenges(client, authzs)
118+
elif chall_type == "dns-account-01":
119+
cleanup = do_dns_account_challenges(client, authzs)
118120
else:
119121
raise Exception("invalid challenge type %s" % chall_type)
120122

@@ -144,6 +146,25 @@ def cleanup():
144146
}).raise_for_status()
145147
return cleanup
146148

149+
def do_dns_account_challenges(client, authzs):
150+
cleanup_hosts = []
151+
for a in authzs:
152+
c = get_chall(a, challenges.DNSACCOUNT01)
153+
name, value = (c.validation_domain_name(client.net.account.uri, a.body.identifier.value),
154+
c.validation(client.net.key))
155+
cleanup_hosts.append(name)
156+
requests.post(SET_TXT, json={
157+
"host": name + ".",
158+
"value": value
159+
}).raise_for_status()
160+
client.answer_challenge(c, c.response(client.net.key))
161+
def cleanup():
162+
for host in cleanup_hosts:
163+
requests.post(CLEAR_TXT, json={
164+
"host": host + "."
165+
}).raise_for_status()
166+
return cleanup
167+
147168
def do_http_challenges(client, authzs):
148169
port = int(PORT)
149170
challs = [get_chall(a, challenges.HTTP01) for a in authzs]

0 commit comments

Comments
 (0)