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

No error handling on 403 #13

Open
EinDev opened this issue Apr 15, 2021 · 0 comments
Open

No error handling on 403 #13

EinDev opened this issue Apr 15, 2021 · 0 comments

Comments

@EinDev
Copy link

EinDev commented Apr 15, 2021

If the Powerdns returns a 403 Access Denied (e.g. if the API key is "User", not "Operator") it will just return an error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/error_handler.py", line 124, in _call_registered
    self.funcs[-1]()
  File "/usr/lib/python3/dist-packages/certbot/auth_handler.py", line 243, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/local/lib/python3.8/dist-packages/certbot_pdns/authenticator.py", line 75, in cleanup
    self.backend.cleanup(achall)
  File "/usr/local/lib/python3.8/dist-packages/certbot_pdns/PdnsApiAuthenticator.py", line 113, in cleanup
    self.flush_zone(zone["name"])
  File "/usr/local/lib/python3.8/dist-packages/certbot_pdns/PdnsApiAuthenticator.py", line 36, in flush_zone
    res = self.api.flush_zone_cache(zone_name)
  File "/usr/local/lib/python3.8/dist-packages/certbot_pdns/pdnsapi.py", line 110, in flush_zone_cache
    return self._query("/servers/localhost/cache/flush?domain=%s" % zone_name, "PUT")
  File "/usr/local/lib/python3.8/dist-packages/certbot_pdns/pdnsapi.py", line 61, in _query
    return None if request.status_code == 204 else request.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

After changing the role to "Operator" it worked.
Also maybe adding a hint to the README that the Operator Role is required would help others, too :)

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

1 participant