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:
committed by
Matthias Bilger
parent
73e50fce28
commit
ff5aec2d5d
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user