summaryrefslogtreecommitdiffstats
path: root/acmens.py
diff options
context:
space:
mode:
Diffstat (limited to 'acmens.py')
-rw-r--r--acmens.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/acmens.py b/acmens.py
index 37e187f..eb0ec9a 100644
--- a/acmens.py
+++ b/acmens.py
@@ -155,18 +155,17 @@ def _do_challenge(challenge_type, authz_url, nonce_url, auth, account_key, thumb
if c["type"] == "http-01":
http_challenge = c
if challenge is None:
- if http_challenge is None:
- if dns_challenge is None:
- sys.stderr.write("Error: Unable to find challenges!")
- sys.exit(1)
- else:
- # Fallback to dns challenge.
- challenge = dns_challenge
- challenge_type = "dns"
- else:
+ if http_challenge:
# Fallback to http challenge.
challenge = http_challenge
challenge_type = "http"
+ elif dns_challenge:
+ # Fallback to dns challenge.
+ challenge = dns_challenge
+ challenge_type = "dns"
+ else:
+ sys.stderr.write("Error: Unable to find challenges!")
+ sys.exit(1)
keyauthorization = "{0}.{1}".format(challenge["token"], thumbprint)
dns_payload = _b64(hashlib.sha256(keyauthorization.encode()).digest())