forked from TrueCloudLab/lego
Merge pull request #136 from xi2/fix-handling-of-cnames
DNS Challenge: Fix handling of CNAMEs
This commit is contained in:
commit
7dcfb4a92b
1 changed files with 8 additions and 10 deletions
|
@ -82,16 +82,14 @@ func checkDNSPropagation(fqdn, value string) (bool, error) {
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
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 cn.Hdr.Name == fqdn {
|
||||
fqdn = cn.Target
|
||||
break
|
||||
if r.Rcode == dns.RcodeSuccess {
|
||||
// If we see a CNAME here then use the alias
|
||||
for _, rr := range r.Answer {
|
||||
if cn, ok := rr.(*dns.CNAME); ok {
|
||||
if cn.Hdr.Name == fqdn {
|
||||
fqdn = cn.Target
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue