libdns / googleclouddns

Google Cloud DNS provider implementation for libdns interfaces
MIT License
10 stars 5 forks source link

Append to TXT record fails #3

Open Sohalt opened 1 year ago

Sohalt commented 1 year ago

Appending a TXT record as done e.g. by the https://github.com/caddy-dns/googleclouddns plugin fails (cf. https://github.com/caddyserver/caddy/issues/5093)

Sep 29 15:21:30 host caddy[862115]: {"level":"error","ts":1664457690.5285676,"logger":"tls","msg":"job failed","error":"*.example.com: obtaining certificate: [*.example.com] Obtain: [*.example.com] solving challenges: presenting for challenge: adding temporary record for zone \"example.com.\": googleapi: Error 409: The resource 'entity.rrset' named '_acme-challenge.example.com. (TXT)' already exists, alreadyExists (order=https://acme-v02.api.letsencrypt.org/acme/order/753499426/129950511876) (ca=https://acme-v02.api.letsencrypt.org/directory)"}
mholt commented 1 year ago

(specifically, if there is already a TXT record of that name; multiple TXT records should be supported.)

brockwood commented 1 year ago

Thanks for the heads up. I'll take a closer look at the issue this weekend.

brockwood commented 1 year ago

I have a PR while I do some final testing. I should have this merged and tagged shortly.

brockwood commented 1 year ago

Hello @Sohalt. Could you confirm that you are requesting the certs doing something like this? I would like to verify I'm performing the correct test on this change. Thanks!

*.example.com foo.example.com {
        tls {
                dns googleclouddns {
                        gcp_project my-gcp-project
                }
        }
        file_server * {
                root /var/www
        }
        log {
                output file /tmp/caddy.log
                format console
        }
}
Sohalt commented 1 year ago

I think my issue turns up with *. example.com and example.com, not foo.example.com.

mholt commented 1 year ago

^ Right -- ACME uses the same parent domain for a challenge for its wildcard and the parent domain itself; i.e. you'll want to use *.example.com and example.com. (Though you don't necessarily need to use an ACME challenge to test this either. Just set multiple TXT records with the same name.)

Thanks for working on this, @brockwood ! :D

brockwood commented 1 year ago

Thank you both for the info, it is greatly appreciated. :heart:

brockwood commented 1 year ago

Thanks for sticking with this @Sohalt. The latest version of the caddy-dns module has been tagged. Please give it a try and let me know if that fixes it for you.