From 06b3802346b4a4c172c66bcde49532e875dfda2d Mon Sep 17 00:00:00 2001 From: Michael Cross Date: Fri, 19 Feb 2016 08:14:26 +0000 Subject: [PATCH] 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. --- acme/dns_challenge.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/acme/dns_challenge.go b/acme/dns_challenge.go index b45a964f..4cd58f50 100644 --- a/acme/dns_challenge.go +++ b/acme/dns_challenge.go @@ -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 + } } } }