From 1e2793f9ec3dacf8176c716267de855ec0713311 Mon Sep 17 00:00:00 2001 From: Sascha Marcel Hacker Date: Mon, 20 Feb 2023 00:59:17 +0100 Subject: [PATCH] dynu: fix subdomain support (#1842) Co-authored-by: Fernandez Ludovic --- providers/dns/dynu/dynu.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/providers/dns/dynu/dynu.go b/providers/dns/dynu/dynu.go index c2df9fb4..9a9e9858 100644 --- a/providers/dns/dynu/dynu.go +++ b/providers/dns/dynu/dynu.go @@ -97,8 +97,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) - // TODO(ldez) replace domain by FQDN to follow CNAME. - rootDomain, err := d.client.GetRootDomain(domain) + rootDomain, err := d.client.GetRootDomain(dns01.UnFqdn(fqdn)) if err != nil { return fmt.Errorf("dynu: could not find root domain for %s: %w", domain, err) } @@ -115,7 +114,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { } } - subDomain, err := dns01.ExtractSubDomain(fqdn, domain) + subDomain, err := dns01.ExtractSubDomain(fqdn, rootDomain.DomainName) if err != nil { return fmt.Errorf("dynu: %w", err) } @@ -142,8 +141,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) - // TODO(ldez) replace domain by FQDN to follow CNAME. - rootDomain, err := d.client.GetRootDomain(domain) + rootDomain, err := d.client.GetRootDomain(dns01.UnFqdn(fqdn)) if err != nil { return fmt.Errorf("dynu: could not find root domain for %s: %w", domain, err) }