From 745a0690114ad1ce18e85b17b5bc4683ffd29b76 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Mon, 13 Nov 2023 19:27:59 +0000 Subject: [PATCH] implement location version of https://github.com/pan-net-security/certbot-dns-powerdns/pull/19 --- certbot_dns_powerdns/dns_powerdns.py | 9 ++++++--- setup.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/certbot_dns_powerdns/dns_powerdns.py b/certbot_dns_powerdns/dns_powerdns.py index 55fe2ee..8d629c9 100644 --- a/certbot_dns_powerdns/dns_powerdns.py +++ b/certbot_dns_powerdns/dns_powerdns.py @@ -45,6 +45,7 @@ def _setup_credentials(self): 'credentials', 'PowerDNS credentials file', { + 'zone': 'PowerDNS API zone', 'api-url': 'PowerDNS-compatible API FQDN', 'api-key': 'PowerDNS-compatible API key (X-API-Key)' } @@ -52,14 +53,15 @@ def _setup_credentials(self): def _perform(self, domain, validation_name, validation): self._get_powerdns_client().add_txt_record( - domain, validation_name, validation) + self.credentials.conf('zone'), validation_name, validation) def _cleanup(self, domain, validation_name, validation): self._get_powerdns_client().del_txt_record( - domain, validation_name, validation) + self.credentials.conf('zone'), validation_name, validation) def _get_powerdns_client(self): return _PowerDNSLexiconClient( + self.credentials.conf('zone'), self.credentials.conf('api-url'), self.credentials.conf('api-key'), self.ttl @@ -71,12 +73,13 @@ class _PowerDNSLexiconClient(dns_common_lexicon.LexiconClient): Encapsulates all communication with the PowerDNS via Lexicon. """ - def __init__(self, api_url, api_key, ttl): + def __init__(self, zone, api_url, api_key, ttl): super(_PowerDNSLexiconClient, self).__init__() config = dns_common_lexicon.build_lexicon_config('powerdns', { 'ttl': ttl, }, { + 'zone': zone, 'auth_token': api_key, 'pdns_server': api_url, }) diff --git a/setup.py b/setup.py index c5737de..81a6899 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup from setuptools import find_packages -version = "0.2.1" +version = "0.2.1.1" with open('README.md') as f: long_description = f.read()