Comments (2)
Hello,
I'm not sure to understand your problem.
As you can see we have dedicated tests on joinPath
:
Your implementation will break everything.
And the tests seems to say the opposite of the behavior you described 🤔 .
lego/providers/dns/pdns/internal/client_test.go
Lines 74 to 80 in 82e9a5e
from lego.
Hi,
Thanks for the quick reply!
Please find a bit more concrete explanation below.
There are four places where joinPath
is used (which just adds the path to the PDNS_API_URL
, potentially adding /api/v1
to the front if the provided path does not start with /api
and if the API version is not 0):
With a relative path (well represented by the tests and functional in my use case):
lego/providers/dns/pdns/internal/client.go
Lines 55 to 58 in 82e9a5e
With a relative path (well represented by the tests and functional in my use case):
lego/providers/dns/pdns/internal/client.go
Lines 84 to 87 in 82e9a5e
With an absolute path (not represented by the tests and not functional in my use case):
lego/providers/dns/pdns/internal/client.go
Lines 119 to 122 in 82e9a5e
With an absolute path (not represented by the tests and not functional in my use case):
lego/providers/dns/pdns/internal/client.go
Lines 135 to 140 in 82e9a5e
Only the first two are used with a ("manually" built) path that is relative to the APIs root path (/api
and /servers<serverName>/zones/<authZone>
. These are represented well in, e.g., the test case(s) you have included above and also work for my use case.
The problem is with the latter two usages. Here, the path that is passed to joinPath
is starting with zone.URL
, where zone
is the parsed return of the API call within GetHostedZone
(see second code block above). However, at least for my provider, the URL that is returned by querying, in my case, https://login.udmedia.de/dns/api/v1/servers/udmedia/zones/example.com.
is an absolute path to the host's root and thus also includes the relative path to the API again that is aready part of PDNS_API_URL
(i.e., starting with /dns
below rather than /api/v1/...
):
{
"id": "example.com.",
"url": "\/dns\/api\/v1\/servers\/udmedia\/zones\/example.com.",
"name": "example.com.",
"type": "Zone",
<snip>
When this path is then passed to joinPath
, this leads to URL with the duplicated /dns/api/v1/dns/api/v1
that I have listed in my original post.
My crude solution suggested above for the 3rd and 4th usage above (NOT replacing joinPath
for the first two) works for my case and should also work for the standard case, where the API endpoint sits at the URL root with API version 1 where the /api/v1
should already be part of zone.URL
.
However, there are also possibly less invasive solutions. If any of them sounds reasonable, please let me know and I can potentially flesh them out some more:
- Instead of using
zone.URL
in the 3rd and 4thjoinPath
calls above, one could recreated the relative URL analogously to the 2nd usage. With a relative URL, this should then work fine. From reading the PowerDNS API documentation, the URL sounds to be fixed and thuszone.URL
usage just saves some work but should hopefully be replaceable. - When
zone.URL
should still be used, an environmental variable option (something likePDNS_ZONE_URL_ABSOLUTE=1
), whether it is known to contain the absolute URL to the URL's root, could be added and only if that is set, one could basically use my crude solution or try to retrospectively make thezone.URL
a relative path before usingjoinPath
by removing the path fromPDNS_API_URL
from the start of thezone.URL
.
from lego.
Related Issues (20)
- on armv7I-32 CPU: this CPU has no VFPv3 floating point hardware HOT 3
- renew doesn't take multiple domains HOT 1
- "The HTTP S3 Present should not utilize Object ACL permissions, as they are not recommended."
- acme: error presenting token: alicloud: zone com. not found in AliDNS for ... HOT 2
- oraclecloud is using only default realm OC1 for all requests HOT 7
- Missing and misleading hook environment variables HOT 4
- Add support for Route53 private zones HOT 1
- '--dns exec' show output in real time? HOT 3
- Add SLSA provenance to your releases
- renew-hook does not support quoted parameters HOT 1
- Add Retry-After header value to get renewal info result HOT 3
- DNS request prefer IPv6 only HOT 1
- exoscale: fails when issuing certificate for "*.domain.example" and "domain.example" HOT 14
- Ability to update email using the CLI
- Support for provider: mittwald HOT 3
- azuredns: CLI authentication doesn't respect tenant setting
- DNS certificates with many names: Faster verification HOT 13
- Support hook arguments HOT 3
- Whether you can support manual custom validation of DNS records in golang dependent mode?
- Leftover deprecated update renewal info call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lego.