Skip to content

Commit

Permalink
feat: drop LEGO_EXPERIMENTAL_CNAME_SUPPORT
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Sep 17, 2022
1 parent 0d7ee5e commit d69f143
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
26 changes: 14 additions & 12 deletions challenge/dns01/dns_challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,20 @@ func GetRecord(domain, keyAuth string) (fqdn, value string) {
value = base64.RawURLEncoding.EncodeToString(keyAuthShaBytes[:sha256.Size])
fqdn = fmt.Sprintf("_acme-challenge.%s.", domain)

if ok, _ := strconv.ParseBool(os.Getenv("LEGO_EXPERIMENTAL_CNAME_SUPPORT")); ok {
// recursion counter so it doesn't spin out of control
for limit := 0; limit < 50; limit++ {
// Keep following CNAMEs
r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
// Check if the domain has CNAME then use that
if err == nil && r.Rcode == dns.RcodeSuccess {
fqdn = updateDomainWithCName(r, fqdn)
} else {
// No more CNAME records to follow, exit
return
}
if ok, _ := strconv.ParseBool(os.Getenv("LEGO_DISABLE_CNAME_SUPPORT")); ok {
return
}

// recursion counter so it doesn't spin out of control
for limit := 0; limit < 50; limit++ {
// Keep following CNAMEs
r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
// Check if the domain has CNAME then use that
if err == nil && r.Rcode == dns.RcodeSuccess {
fqdn = updateDomainWithCName(r, fqdn)
} else {
// No more CNAME records to follow, exit
return
}
}

Expand Down
5 changes: 0 additions & 5 deletions docs/content/dns/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ $ CLOUDFLARE_EMAIL_FILE=/the/path/to/my/email \
lego --dns cloudflare --domains www.example.com --email you@example.com run
```

## Experimental Features

To resolve CNAME when creating dns-01 challenge:
set `LEGO_EXPERIMENTAL_CNAME_SUPPORT` to `true`.

## DNS Providers

{{% tableofdnsproviders %}}
2 changes: 1 addition & 1 deletion providers/dns/acmedns/acmedns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

const (
// Fixed test data for unit tests.
egDomain = "threeletter.agency"
egDomain = "example.com"
egFQDN = "_acme-challenge." + egDomain + "."
egKeyAuth = "⚷"
)
Expand Down

0 comments on commit d69f143

Please sign in to comment.