Skip to content

Commit

Permalink
Add support for the PowerDNS-Admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
tmuncks committed Oct 18, 2021
1 parent 8884479 commit 19b142d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ certbot-dns-powerdns

PowerDNS DNS Authenticator plugin for [Certbot](https://certbot.eff.org/).

Compatibility:
* PowerDNS Authoritative Server API
* PowerDNS-Admin API

This plugin is built from the ground up and follows the development style and life-cycle
of other `certbot-dns-*` plugins found in the
[Official Certbot Repository](https://github.com/certbot/certbot).
Expand Down
10 changes: 6 additions & 4 deletions certbot_dns_powerdns/dns_powerdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ def __init__(self, api_url, api_key, ttl):
self.provider = powerdns.Provider(config)

def _handle_http_error(self, e, domain_name):
estr = str(e).lower()
if domain_name in str(e) and (
# 4.0 and 4.1 compatibility
str(e).startswith('422 Client Error: Unprocessable Entity for url:') or
# 4.2
str(e).startswith('404 Client Error: Not Found for url:')
# PowerDNS 4.0 and 4.1 compatibility
estr.startswith('422 client error: unprocessable entity for url:') or
# PowerDNS 4.2+ and PowerDNS-Admin compatibility
estr.startswith('403 client error: forbidden for url:') or
estr.lower().startswith('404 client error: not found for url:')
):
return # Expected errors when zone name guess is wrong
return super(_PowerDNSLexiconClient, self)._handle_http_error(e, domain_name)

0 comments on commit 19b142d

Please sign in to comment.