forked from TrueCloudLab/lego
duckdns: fix CNAME support (#1732)
This commit is contained in:
parent
87ee39a1dc
commit
79fcc56402
3 changed files with 11 additions and 9 deletions
|
@ -12,6 +12,7 @@
|
||||||
- **[dnsprovider]** pdns: notify secondary servers after updates
|
- **[dnsprovider]** pdns: notify secondary servers after updates
|
||||||
|
|
||||||
### Changed:
|
### Changed:
|
||||||
|
|
||||||
- **[dnsprovider]** allinkl: removed deprecated sha1 hashing
|
- **[dnsprovider]** allinkl: removed deprecated sha1 hashing
|
||||||
- **[dnsprovider]** auroradns: update authentification
|
- **[dnsprovider]** auroradns: update authentification
|
||||||
- **[dnsprovider]** dnspod: deprecated. Use Tencent Cloud instead.
|
- **[dnsprovider]** dnspod: deprecated. Use Tencent Cloud instead.
|
||||||
|
|
|
@ -79,13 +79,14 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||||
|
|
||||||
// Present creates a TXT record to fulfill the dns-01 challenge.
|
// Present creates a TXT record to fulfill the dns-01 challenge.
|
||||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
_, txtRecord := dns01.GetRecord(domain, keyAuth)
|
fqdn, txtRecord := dns01.GetRecord(domain, keyAuth)
|
||||||
return d.updateTxtRecord(domain, d.config.Token, txtRecord, false)
|
return d.updateTxtRecord(dns01.UnFqdn(fqdn), d.config.Token, txtRecord, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CleanUp clears DuckDNS TXT record.
|
// CleanUp clears DuckDNS TXT record.
|
||||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
return d.updateTxtRecord(domain, d.config.Token, "", true)
|
fqdn, _ := dns01.GetRecord(domain, keyAuth)
|
||||||
|
return d.updateTxtRecord(dns01.UnFqdn(fqdn), d.config.Token, "", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
||||||
|
|
|
@ -107,32 +107,32 @@ func Test_getMainDomain(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "explicit domain: sub domain",
|
desc: "explicit domain: sub domain",
|
||||||
domain: "sub.duckdns.org",
|
domain: "_acme-challenge.sub.duckdns.org",
|
||||||
expected: "sub.duckdns.org",
|
expected: "sub.duckdns.org",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "explicit domain: subsub domain",
|
desc: "explicit domain: subsub domain",
|
||||||
domain: "my.sub.duckdns.org",
|
domain: "_acme-challenge.my.sub.duckdns.org",
|
||||||
expected: "sub.duckdns.org",
|
expected: "sub.duckdns.org",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "explicit domain: subsubsub domain",
|
desc: "explicit domain: subsubsub domain",
|
||||||
domain: "my.sub.sub.duckdns.org",
|
domain: "_acme-challenge.my.sub.sub.duckdns.org",
|
||||||
expected: "sub.duckdns.org",
|
expected: "sub.duckdns.org",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "only subname: sub domain",
|
desc: "only subname: sub domain",
|
||||||
domain: "sub",
|
domain: "_acme-challenge.sub",
|
||||||
expected: "sub",
|
expected: "sub",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "only subname: subsub domain",
|
desc: "only subname: subsub domain",
|
||||||
domain: "my.sub",
|
domain: "_acme-challenge.my.sub",
|
||||||
expected: "sub",
|
expected: "sub",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "only subname: subsubsub domain",
|
desc: "only subname: subsubsub domain",
|
||||||
domain: "my.sub.sub",
|
domain: "_acme-challenge.my.sub.sub",
|
||||||
expected: "sub",
|
expected: "sub",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue