go-acme / lego

Let's Encrypt/ACME client and library written in Go
https://go-acme.github.io/lego/
MIT License
7.58k stars 994 forks source link

pdns: optional custom API version #2019

Closed m0t1x closed 6 months ago

m0t1x commented 10 months ago

Some PowerDNS servers don't have exposed the root API endpoints and PowerDNS API version auto-detection fails. Use the optional parameter PDNS_CUSTOM_API_VERSION to set the version number in such situations.

related to #2016

ldez commented 9 months ago

Do we agree that I close the issue and flag it as "question" and you still created a PR? What exactly do you expect from this behavior?

m0t1x commented 9 months ago

Hi, As described in the PR, PowerDNS has root API endpoints to provide the version information (https://doc.powerdns.com/recursor/common/api/endpoint-api.html). Some PowerDNS deployment don't have these endpoints exposed and without them it is not possible to auto-detect PowerDNS API version and the whole process with lego fails. Using custom variable to set the API version, you can skip the API version auto-detection and the process will continue. I found I am not the only one with this issue, but it's up to you to see whether you want to have this feature or not. Best Regards,Marijan

7c commented 8 months ago

I agree, powerdns 4.* does not have this endpoint, so i had to hack into the code in order to set the apiVersion to 1.

I am setting PDNS_API_URL=https://server/api/v1 - all works until the PATCH command. The patch command is using zone.URL as path and it is coming from pdns "url": "/api/v1/servers/localhost/zones/domain.com." - since we do call a c.Host.JoinPath inside pdns/client.go/joinPath function. It automatically does the url as "/api/v1/api/v1/servers/localhost/zones/domain.com" at PATCH (UpdateRecords call inside pdns/internal/client.go)