diff --git a/providers/dns/hurricane/hurricane.go b/providers/dns/hurricane/hurricane.go index 3427e600..34d38d63 100644 --- a/providers/dns/hurricane/hurricane.go +++ b/providers/dns/hurricane/hurricane.go @@ -86,9 +86,9 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { // Present updates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, _, keyAuth string) error { - _, txtRecord := dns01.GetRecord(domain, keyAuth) + fqdn, txtRecord := dns01.GetRecord(domain, keyAuth) - err := d.client.UpdateTxtRecord(context.Background(), domain, txtRecord) + err := d.client.UpdateTxtRecord(context.Background(), dns01.UnFqdn(fqdn), txtRecord) if err != nil { return fmt.Errorf("hurricane: %w", err) } @@ -97,8 +97,10 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error { } // CleanUp updates the TXT record matching the specified parameters. -func (d *DNSProvider) CleanUp(domain, _, _ string) error { - err := d.client.UpdateTxtRecord(context.Background(), domain, ".") +func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error { + fqdn, _ := dns01.GetRecord(domain, keyAuth) + + err := d.client.UpdateTxtRecord(context.Background(), dns01.UnFqdn(fqdn), ".") if err != nil { return fmt.Errorf("hurricane: %w", err) } diff --git a/providers/dns/hurricane/internal/client.go b/providers/dns/hurricane/internal/client.go index 81b863cc..e5848112 100644 --- a/providers/dns/hurricane/internal/client.go +++ b/providers/dns/hurricane/internal/client.go @@ -51,8 +51,8 @@ func NewClient(credentials map[string]string) *Client { } // UpdateTxtRecord updates a TXT record. -func (c *Client) UpdateTxtRecord(ctx context.Context, domain string, txt string) error { - hostname := fmt.Sprintf("_acme-challenge.%s", domain) +func (c *Client) UpdateTxtRecord(ctx context.Context, hostname string, txt string) error { + domain := strings.TrimPrefix(hostname, "_acme-challenge.") c.credMu.Lock() token, ok := c.credentials[domain] diff --git a/providers/dns/hurricane/internal/client_test.go b/providers/dns/hurricane/internal/client_test.go index b4869d69..f68d9b73 100644 --- a/providers/dns/hurricane/internal/client_test.go +++ b/providers/dns/hurricane/internal/client_test.go @@ -75,7 +75,7 @@ func TestClient_UpdateTxtRecord(t *testing.T) { client := NewClient(map[string]string{"example.com": "secret"}) client.baseURL = server.URL - err := client.UpdateTxtRecord(context.Background(), "example.com", "foo") + err := client.UpdateTxtRecord(context.Background(), "_acme-challenge.example.com", "foo") test.expected(t, err) }) }