diff --git a/acme/dns_challenge.go b/acme/dns_challenge.go index 7c4cb80d..13373974 100644 --- a/acme/dns_challenge.go +++ b/acme/dns_challenge.go @@ -11,7 +11,6 @@ import ( "time" "github.com/miekg/dns" - "golang.org/x/net/publicsuffix" ) type preCheckDNSFunc func(fqdn, value string) (bool, error) @@ -242,10 +241,6 @@ func FindZoneByFqdn(fqdn string, nameservers []string) (string, error) { labelIndexes := dns.Split(fqdn) for _, index := range labelIndexes { domain := fqdn[index:] - // Give up if we have reached the TLD - if isTLD(domain) { - break - } in, err := dnsQuery(domain, dns.TypeSOA, nameservers, true) if err != nil { @@ -273,14 +268,6 @@ func FindZoneByFqdn(fqdn string, nameservers []string) (string, error) { return "", fmt.Errorf("Could not find the start of authority") } -func isTLD(domain string) bool { - publicsuffix, _ := publicsuffix.PublicSuffix(UnFqdn(domain)) - if publicsuffix == UnFqdn(domain) { - return true - } - return false -} - // ClearFqdnCache clears the cache of fqdn to zone mappings. Primarily used in testing. func ClearFqdnCache() { fqdnToZone = map[string]string{} diff --git a/acme/dns_challenge_test.go b/acme/dns_challenge_test.go index 597aaac1..4a2a7fea 100644 --- a/acme/dns_challenge_test.go +++ b/acme/dns_challenge_test.go @@ -37,14 +37,6 @@ var lookupNameserversTestsErr = []struct { {"_null.n0n0.", "Could not determine the zone", }, - // invalid domain - {"_null.com.", - "Could not determine the zone", - }, - // invalid domain - {"in-valid.co.uk.", - "Could not determine the zone", - }, } var findZoneByFqdnTests = []struct { @@ -53,6 +45,7 @@ var findZoneByFqdnTests = []struct { }{ {"mail.google.com.", "google.com."}, // domain is a CNAME {"foo.google.com.", "google.com."}, // domain is a non-existent subdomain + {"example.com.ac.", "ac."}, // domain is a eTLD } var checkAuthoritativeNssTests = []struct {