From 2489ff01be7f023fbfeac7bce640469d59fad450 Mon Sep 17 00:00:00 2001 From: Jonathan Grahl Date: Thu, 14 Mar 2024 17:24:39 +0100 Subject: [PATCH] fix: suffix entry with .verify if using rootdomain --- Makefile | 2 +- gandiclient.go | 4 ++-- main.go | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4d7ca67..887f4a5 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ endif GO_VERSION ?= $(shell go mod edit -json | grep -${GREP_PREGEX_FLAG}o '"Go":\s+"([0-9.]+)"' | sed -E 's/.+"([0-9.]+)"/\1/') IMAGE_NAME := molnett/cert-manager-webhook-gandi -IMAGE_TAG := 0.2.1 +IMAGE_TAG := 0.2.2 OUT := $(shell pwd)/_out diff --git a/gandiclient.go b/gandiclient.go index 93ab636..0819b68 100644 --- a/gandiclient.go +++ b/gandiclient.go @@ -118,13 +118,13 @@ func (c *GandiClient) CreateTxtRecord(domain *string, name *string, value *strin req.Header.Set("Content-Type", "application/json") - status, _, err := c.doRequest(req, false) + status, body, err := c.doRequest(req, false) if err != nil { return err } if status != http.StatusCreated && status != http.StatusOK { - return fmt.Errorf("failed creating TXT record: %v", err) + return fmt.Errorf("failed creating TXT record: %d, %s", status, string(body)) } return nil diff --git a/main.go b/main.go index a24d15c..0b31fb8 100644 --- a/main.go +++ b/main.go @@ -107,6 +107,8 @@ func (c *gandiDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error { if cfg.RootDomain != "" { entry = strings.TrimPrefix(ch.ResolvedFQDN, "_acme-challenge.") entry = strings.TrimSuffix(entry, ".") + entry = strings.Replace(entry, ".", "_", -1) + entry = entry + ".verify" domain = cfg.RootDomain }