From e12abbc3cb15ba0fceadc880ef2bc7898ae85171 Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Thu, 4 Apr 2019 12:42:57 +0200 Subject: [PATCH] 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 --- acertmgr/authority/v1.py | 4 ++-- acertmgr/authority/v2.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/acertmgr/authority/v1.py b/acertmgr/authority/v1.py index 473a5e5..3d0697c 100644 --- a/acertmgr/authority/v1.py +++ b/acertmgr/authority/v1.py @@ -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", diff --git a/acertmgr/authority/v2.py b/acertmgr/authority/v2.py index e8b238e..e76ba64 100644 --- a/acertmgr/authority/v2.py +++ b/acertmgr/authority/v2.py @@ -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),