diff --git a/README.rst b/README.rst index 318756e..3e0e870 100644 --- a/README.rst +++ b/README.rst @@ -34,7 +34,7 @@ To start using DNS authentication for ispconfig, pass the following arguments on certbot's command line: ============================================================= ============================================== -``--authenticator certbot-dns-ispconfig:dns-netcup`` select the authenticator plugin (Required) +``--authenticator certbot-dns-ispconfig:dns-ispconfig`` select the authenticator plugin (Required) ``--certbot-dns-ispconfig:dns-ispconfig-credentials`` ispconfig Remote User credentials INI file. (Required) @@ -57,7 +57,7 @@ An example ``credentials.ini`` file: certbot_dns_ispconfig:dns_ispconfig_username = myremoteuser certbot_dns_ispconfig:dns_ispconfig_password = verysecureremoteuserpassword - certbot_dns_ispconfig:dns_ispconfig_endpoint = https://localhost:8080 + certbot_dns_ispconfig:dns_ispconfig_endpoint = https://localhost:8080/remote/json.php The path to this file can be provided interactively or using the ``--certbot-dns-ispconfig:dns-ispconfig-credentials`` command-line argument. Certbot diff --git a/certbot_dns_ispconfig/dns_ispconfig.py b/certbot_dns_ispconfig/dns_ispconfig.py index 4d64c52..61d11a1 100644 --- a/certbot_dns_ispconfig/dns_ispconfig.py +++ b/certbot_dns_ispconfig/dns_ispconfig.py @@ -1,6 +1,7 @@ """DNS Authenticator for ISPConfig.""" import json import logging +import time import requests import zope.interface @@ -133,7 +134,7 @@ class _ISPConfigClient(object): :raises certbot.errors.PluginError: if an error occurs communicating with the ISPConfig API """ self._login() - zone_id, zone_name = self._find_managed_zone_id(domain) + zone_id, zone_name = self._find_managed_zone_id(domain, record_name) if zone_id is None: raise errors.PluginError("Domain not known") logger.debug("domain found: %s with id: %s", zone_name, zone_id) @@ -167,7 +168,7 @@ class _ISPConfigClient(object): :raises certbot.errors.PluginError: if an error occurs communicating with the ISPConfig API """ self._login() - zone_id, zone_name = self._find_managed_zone_id(domain) + zone_id, zone_name = self._find_managed_zone_id(domain, record_name) if zone_id is None: raise errors.PluginError("Domain not known") logger.debug("domain found: %s with id: %s", zone_name, zone_id) @@ -196,6 +197,7 @@ class _ISPConfigClient(object): "zone": zone_id, "ttl": record_ttl, "update_serial": False, + "stamp": time.strftime('%Y-%m-%d %H:%M:%S'), }, } return data @@ -218,7 +220,7 @@ class _ISPConfigClient(object): logger.debug("delete with data: %s", data) result = self._api_request("dns_txt_delete", data) - def _find_managed_zone_id(self, domain): + def _find_managed_zone_id(self, domain, record_name): """ Find the managed zone for a given domain. @@ -228,7 +230,7 @@ class _ISPConfigClient(object): :raises certbot.errors.PluginError: if the managed zone cannot be found. """ - zone_dns_name_guesses = dns_common.base_domain_name_guesses(domain) + zone_dns_name_guesses = [record_name] + dns_common.base_domain_name_guesses(domain) for zone_name in zone_dns_name_guesses: # get the zone id diff --git a/setup.py b/setup.py index bffd7c6..f100835 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ install_requires = [ from os import path this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, "README.rst"), encoding="utf-8") as f: +with open(path.join(this_directory, "README.rst")) as f: long_description = f.read() setup(