Merge b36693821e into b656642cf5
This commit is contained in:
commit
0d7cba80c4
|
|
@ -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,29 @@ def do_dns_challenges(client, authzs):
|
|||
}).raise_for_status()
|
||||
return 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, scope, 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]
|
||||
|
|
|
|||
Loading…
Reference in New Issue