Allow better DNS autodetection for domains that directly match a DNS hosted zone

This commit is contained in:
Curtis Castrapel 2019-08-15 10:52:26 -07:00
parent 0e31e708e3
commit 1c6fee7292
1 changed files with 13 additions and 3 deletions

View File

@ -294,7 +294,7 @@ class AcmeHandler(object):
if not dns_provider.domains: if not dns_provider.domains:
continue continue
for name in dns_provider.domains: for name in dns_provider.domains:
if domain.endswith("." + name): if name == domain or domain.endswith("." + name):
if len(name) > match_length: if len(name) > match_length:
self.dns_providers_for_domain[domain] = [dns_provider] self.dns_providers_for_domain[domain] = [dns_provider]
match_length = len(name) match_length = len(name)
@ -370,7 +370,12 @@ class AcmeHandler(object):
pass pass
def get_dns_provider(self, type): def get_dns_provider(self, type):
provider_types = {"cloudflare": cloudflare, "dyn": dyn, "route53": route53, "ultradns": ultradns} provider_types = {
"cloudflare": cloudflare,
"dyn": dyn,
"route53": route53,
"ultradns": ultradns,
}
provider = provider_types.get(type) provider = provider_types.get(type)
if not provider: if not provider:
raise UnknownProvider("No such DNS provider: {}".format(type)) raise UnknownProvider("No such DNS provider: {}".format(type))
@ -424,7 +429,12 @@ class ACMEIssuerPlugin(IssuerPlugin):
def get_dns_provider(self, type): def get_dns_provider(self, type):
self.acme = AcmeHandler() self.acme = AcmeHandler()
provider_types = {"cloudflare": cloudflare, "dyn": dyn, "route53": route53, "ultradns": ultradns} provider_types = {
"cloudflare": cloudflare,
"dyn": dyn,
"route53": route53,
"ultradns": ultradns,
}
provider = provider_types.get(type) provider = provider_types.get(type)
if not provider: if not provider:
raise UnknownProvider("No such DNS provider: {}".format(type)) raise UnknownProvider("No such DNS provider: {}".format(type))