authority.v2: Check challenge return code on validation as well

This commit is contained in:
Kishi85 2019-06-11 09:19:46 +02:00
parent bc991f12d1
commit 7475d5e73f
1 changed files with 3 additions and 3 deletions

View File

@ -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,