From 7475d5e73f1c8d76dd8a2ca9bb431e1a10c32ce3 Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Tue, 11 Jun 2019 09:19:46 +0200 Subject: [PATCH] authority.v2: Check challenge return code on validation as well --- acertmgr/authority/v2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acertmgr/authority/v2.py b/acertmgr/authority/v2.py index 1daa1f0..0636560 100644 --- a/acertmgr/authority/v2.py +++ b/acertmgr/authority/v2.py @@ -208,11 +208,11 @@ class ACMEAuthority(AbstractACMEAuthority): time.sleep(5) code, challenge_status, _ = self._request_acme_url(authorization['_challenge']['url']) - if challenge_status.get('status') == "valid": + if code < 400 and challenge_status.get('status') == "valid": log("{0} verified".format(authorization['_domain'])) else: - raise ValueError("{0} challenge did not pass: {1}".format( - authorization['_domain'], challenge_status)) + raise ValueError("{0} challenge did not pass ({1}): {2}".format( + authorization['_domain'], code, challenge_status)) finally: challenge_handlers[authorization['_domain']].stop_challenge(authorization['identifier']['value'], account_thumbprint,