letsencrypt-cloudflare-hook icon indicating copy to clipboard operation
letsencrypt-cloudflare-hook copied to clipboard

Crashes if domain does not exist

Open Naozumi opened this issue 8 years ago • 0 comments

Issue: If a domain is missing from CloudFlare then the hook crashes, taking out the ongoing process and preventing attempts for other domains.

Cause: It might seem odd one but I host website for other people and sometimes they remove the site without warning, as happened with one site. The issue then was that when my cron task checked the domain list that included this domain and others it would try this problematic domain and CloudFlare had removed the site. The hook.py then crashed and all other domains in my domain list file get ignored.

Proposed Fix: If CloudFlare returns a null for a website, fail the verification rather than crashing so other sites can still be processed correctly.

Stack Trace: Traceback (most recent call last): File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 203, in <module> main(sys.argv[1:]) File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 199, in main ops[argv[0]](argv[1:]) File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 167, in create_all_txt_records create_txt_record(args[i:i+X]) File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 105, in create_txt_record zone_id = _get_zone_id(domain) File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 83, in _get_zone_id return r.json()['result'][0]['id'] IndexError: list index out of range

Config File: CHALLENGETYPE="dns-01" DOMAINS_TXT="${BASEDIR}/domains" HOOK="/data/am/dehydrated/hooks/cloudflare/hook.py" CONTACT_EMAIL="x@y" export CF_EMAIL=x@y export CF_KEY=12345

Domains File: working.com www.working.com autoremovedfromcloudflare.com www.autoremovedfromcloudflare.com example.com www.example.com In this Domains File example.com is never processed due to crash with previous domain

Hope this makes sense. And thank you for your script - it's an amazing help!

Naozumi avatar Apr 05 '17 22:04 Naozumi