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

PowerDNS PDNS_API_URL API version issue #2016

Closed m0t1x closed 10 months ago

m0t1x commented 10 months ago

Welcome

What did you expect to see?

Would lilke that lego accepts API version in PDNS_API_URL or to detect the version properly.

What did you see instead?

When 'PDNS_API_URL' is set to 'http://server/', without 'api/v1' prefix, API version is not detected and all pdns requests are made to / instead to /api/v1 so all PowerDNS requests fails.

When 'PDNS_API_URL' is set to 'http://server/api/v1' all pdns requests are made to /api/v1/api/v1. So version prefix is duplicated and again all PowerDNS request fails.

Why not just allow API version in URL?

Another project noticed the same issue - https://github.com/traefik/traefik/issues/9726

How do you use lego?

Binary

Reproduction steps

  1. Install lego
  2. Configure PDNS_API_KEY and PDNS_API_URL with http://server or with http://server/api/v1
  3. Run
    lego -a \                                             
    -d <domain> \
    -m <e-mail> \
    --server <ACME server if used > \
    --dns pdns \
    renew

Version of lego

lego version 4.14.0 darwin/arm64

Logs

`PDNS_API_URL=https://< server >/api/v1` ```console ... Error
Cannot GET /api/v1/api
... ``` `PDNS_API_URL=https://< server >` ```console ... Error
Cannot GET /api
... ```

Go environment (if applicable)

No response

ldez commented 10 months ago

Hello,

I explained the behavior here: https://github.com/traefik/traefik/issues/9726#issuecomment-1432329197

Why not just allow API version in URL?

Because there are several use-cases depending on users.