From 2c13835084e398eb5b358374414b0d758de65444 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Tue, 3 Dec 2024 19:51:37 +0100 Subject: [PATCH] inwx: delete only the TXT record related to the DNS challenge (#2373) Co-authored-by: Fernandez Ludovic --- providers/dns/inwx/inwx.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/providers/dns/inwx/inwx.go b/providers/dns/inwx/inwx.go index cefea832..6ed416a2 100644 --- a/providers/dns/inwx/inwx.go +++ b/providers/dns/inwx/inwx.go @@ -180,15 +180,26 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return fmt.Errorf("inwx: %w", err) } - var lastErr error + var recordID int for _, record := range response.Records { - err = d.client.Nameservers.DeleteRecord(record.ID) - if err != nil { - lastErr = fmt.Errorf("inwx: %w", err) + if record.Content != challengeInfo.Value { + continue } + + recordID = record.ID + break } - return lastErr + if recordID == 0 { + return errors.New("inwx: TXT record not found") + } + + err = d.client.Nameservers.DeleteRecord(recordID) + if err != nil { + return fmt.Errorf("inwx: %w", err) + } + + return nil } // Timeout returns the timeout and interval to use when checking for DNS propagation.