authority.v1/2: call stop_challenge even if start_challenge fails

start_challenge may raise an exception at any point. to not just destroy
the challenge but also try to stop it in order to clean up anything done
by start_challenge already properly
This commit is contained in:
Kishi85 2019-04-04 12:42:57 +02:00
parent 989d3b585a
commit e12abbc3cb
2 changed files with 6 additions and 6 deletions

View File

@ -125,10 +125,10 @@ class ACMEAuthority(AbstractACMEAuthority):
# after all challenges are created, start processing authorizations
for domain in authdomains:
challenge_handlers[domain].start_challenge(domain, account_thumbprint, tokens[domain])
try:
log("Starting key authorization")
challenge_handlers[domain].start_challenge(domain, account_thumbprint, tokens[domain])
# notify challenge are met
log("Starting key authorization")
keyauthorization = "{0}.{1}".format(tokens[domain], account_thumbprint)
code, result = self._send_signed(challenges[domain]['uri'], header, {
"resource": "challenge",

View File

@ -196,11 +196,11 @@ class ACMEAuthority(AbstractACMEAuthority):
# after all challenges are created, start processing authorizations
for authorization in authorizations:
log("Starting verification of {}".format(authorization['_domain']))
challenge_handlers[authorization['_domain']].start_challenge(authorization['identifier']['value'],
account_thumbprint,
authorization['_token'])
try:
log("Starting verification of {}".format(authorization['_domain']))
challenge_handlers[authorization['_domain']].start_challenge(authorization['identifier']['value'],
account_thumbprint,
authorization['_token'])
# notify challenge is met
code, challenge_status, _ = self._request_acme_url(authorization['_challenge']['url'], {
"keyAuthorization": "{0}.{1}".format(authorization['_token'], account_thumbprint),