Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook doent work! #56

Open
vaminakov opened this issue Apr 15, 2019 · 4 comments
Open

Hook doent work! #56

vaminakov opened this issue Apr 15, 2019 · 4 comments

Comments

@vaminakov
Copy link

Hello!
After some changes on cloudflare hook stopped working. Not it have issue:

+ 2 pending challenge(s)
 + Deploying challenge tokens...
 + CloudFlare hook executing: deploy_challenge
Traceback (most recent call last):
  File "/etc/dehydrated/hooks/letsencrypt-cloudflare-hook.py", line 206, in <module>
    main(sys.argv[1:])
  File "/etc/dehydrated/hooks/letsencrypt-cloudflare-hook.py", line 203, in main
    ops[argv[0]](argv[1:])
  File "/etc/dehydrated/hooks/letsencrypt-cloudflare-hook.py", line 167, in create_all_txt_records
    create_txt_record(args[i:i+X])
  File "/etc/dehydrated/hooks/letsencrypt-cloudflare-hook.py", line 105, in create_txt_record
    zone_id = _get_zone_id(domain)
  File "/etc/dehydrated/hooks/letsencrypt-cloudflare-hook.py", line 83, in _get_zone_id
    return r.json()['result'][0]['id']
IndexError: list index out of range
@vaminakov
Copy link
Author

It seems that CloudFlare api changed answer of json request:

{'result': [], 'result_info': {'page': 1, 'per_page': 20, 'total_pages': 0, 'count': 0, 'total_count': 0}, 'success': True, 'errors': [], 'messages': []}

so it haven't ID.

@D-Workz
Copy link

D-Workz commented May 13, 2019

hey,
for me, the problem was the function get_tld --> get top level domain, somehow it returned only as suggested the top level domain which ended up beeing ".com, .de and so on..."
Somehow clear that this couldnt work, how did it ever thou?
what fixed it was to exchange in "hook.py":
get_tld
with
get_fld
in line:

 from tld import get_fld

and the call in function:

def _get_zone_id(domain):
    fld = get_fld('http://' + domain)
    url = "https://api.cloudflare.com/client/v4/zones?name={0}".format(fld)
    r = requests.get(url, headers=CF_HEADERS)
    r.raise_for_status()
    return r.json()['result'][0]['id']

this worked for me.

@YasharF
Copy link

YasharF commented May 18, 2019

Since this repo is abandoned by its owner, there is a new maintained fork that also addresses dependency issues including vulnerabilities in the dependencies: https://github.com/SeattleDevs/letsencrypt-cloudflare-hook . That repo has the fix which @D-Workz mentioned. Feel free to open an issue in that repo if you find a problem.

@D-Workz
Copy link

D-Workz commented May 22, 2019

cool thanks, for the team work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants