forked from TrueCloudLab/lego
DNS Challenge: Fix handling of CNAMEs
Prior to this commit, the checkDNSPropagation function was exiting early if the TXT record could not be found on the recursive nameserver, and thus the authoritative nameservers were not being queried until after the record showed up on the recursive nameserver causing a delay. This commit changes that behaviour so that the authoritative nameservers are queried on each execution of checkDNSPropagation when possible.
This commit is contained in:
parent
d17982745f
commit
06b3802346
1 changed files with 8 additions and 10 deletions
|
@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue