Not mine (#3)
* Update README.md Replaced a leftover dns-netcup with dns-ispconfig in Named arguments section. Also added a ISPConfig 3.1 path to the Credentials file, that is required, I found it to fail when not included. * Update dns_ispconfig.py Added the `stamp` parameter to API JSON that is required by ISPConfig * Allow full name zones Add the original record name (full domain including _acme-challenge bit) to the list of domain guesses to check with ISPConfig. Now the full record is tried first and so if there is a zone named _acme-challenge.example.com it will be used instead of example.com. The actual record name is then empty. * Update sutup.py Removed encoding parameter as it is not known to python 2.7 and default in python 3 Co-authored-by: Michal Krejčí <michal@krejci.vip>
This commit is contained in:
parent
73e50fce28
commit
ff5aec2d5d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue