Merge pull request #136 from xi2/fix-handling-of-cnames

DNS Challenge: Fix handling of CNAMEs
This commit is contained in:
xenolf 2016-02-20 01:24:12 +01:00
commit 7dcfb4a92b

View file

@ -82,16 +82,14 @@ func checkDNSPropagation(fqdn, value string) (bool, error) {
if err != nil { if err != nil {
return false, err return false, err
} }
if r.Rcode != dns.RcodeSuccess { if r.Rcode == dns.RcodeSuccess {
return false, fmt.Errorf("Could not resolve %s -> %s", fqdn, dns.RcodeToString[r.Rcode]) // If we see a CNAME here then use the alias
} for _, rr := range r.Answer {
if cn, ok := rr.(*dns.CNAME); ok {
// If we see a CNAME here then use the alias if cn.Hdr.Name == fqdn {
for _, rr := range r.Answer { fqdn = cn.Target
if cn, ok := rr.(*dns.CNAME); ok { break
if cn.Hdr.Name == fqdn { }
fqdn = cn.Target
break
} }
} }
} }