1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-12-29 09:21:51 +01:00

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 # after all challenges are created, start processing authorizations
for domain in authdomains: for domain in authdomains:
challenge_handlers[domain].start_challenge(domain, account_thumbprint, tokens[domain])
try: try:
log("Starting key authorization") challenge_handlers[domain].start_challenge(domain, account_thumbprint, tokens[domain])
# notify challenge are met # notify challenge are met
log("Starting key authorization")
keyauthorization = "{0}.{1}".format(tokens[domain], account_thumbprint) keyauthorization = "{0}.{1}".format(tokens[domain], account_thumbprint)
code, result = self._send_signed(challenges[domain]['uri'], header, { code, result = self._send_signed(challenges[domain]['uri'], header, {
"resource": "challenge", "resource": "challenge",

View File

@ -196,11 +196,11 @@ class ACMEAuthority(AbstractACMEAuthority):
# after all challenges are created, start processing authorizations # after all challenges are created, start processing authorizations
for authorization in 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: 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 # notify challenge is met
code, challenge_status, _ = self._request_acme_url(authorization['_challenge']['url'], { code, challenge_status, _ = self._request_acme_url(authorization['_challenge']['url'], {
"keyAuthorization": "{0}.{1}".format(authorization['_token'], account_thumbprint), "keyAuthorization": "{0}.{1}".format(authorization['_token'], account_thumbprint),