-
-
Notifications
You must be signed in to change notification settings - Fork 57
Allow overwriting IP address for specific (sub)domain in dyndns request #1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Allow overwriting IP address for specific (sub)domain in dyndns request #1141
Conversation
bd8d863 to
8173a08
Compare
|
Very welcome PR! Thanks for your work on this :-) The syntax you chose seems to assume that there will never be TLDs with the names Or is that mitigated by the constraint, that all hostnames must belong to the same domain/zone? Or that Would a different separator make more sense here? fiwswe |
|
Do we need a discriminator suffix at all? (The address family is evident from the value .) |
|
@peterthomassen Thinking about it, I agree that the suffix is unnecessary. That would also help to keep down the length of the URL. Even the scenario where one would want to set both IPv4 and IPv6 addresses for a hostname independently could be handled like this: Extrapolating this syntax further, I don't see any practical value in allowing more than one IP value for each address family. But I could be missing some use case? |
|
Hi @fiwswe and @peterthomassen, Thank you both for your input. My design was guided by the principle of keeping the API explicit and consistent to avoid ambiguity. Here are my detailed thoughts on the points you raised.
This is mitigated by the suffix requirement. The suffix acts as a namespace, creating a clear distinction and preventing collisions. For example:
Even if
While inferring the address family from the value is possible, I believe it introduces significant inconsistencies and implementation complexity. Let's explore the two main alternatives that I'm seeing to using a suffix: 1. Multiple Parameters with the Same Name (e.g., This approach would either introduce a major inconsistency to the API or be a breaking change. While Django's If we were to process multiple values for domain-based parameters, we would face a dilemma:
Either of these don't sound great to me. So I would personally prefer keeping the suffix, but let's first explore the other option that I see and @fiwswe already proposed. 2. Comma-Separated Values (e.g., The complexity here lies in defining the semantic rules for the resulting values, which would lead to either API inconsistencies or ambiguous behavior.
Both cases shows that supporting a comma-separated format would create either an inconsistent API comparing domain parameters with Given these points, the current suffix-based approach seems to me to be the most consistent approach with the current API. It avoids ambiguity, differences parameter handling, and prevents breaking changes. I'm open to changing the implementation though, should you still think no suffix should be used. Finally, with both suffix-less options, there is a minor risk of ambiguity if a name like |
|
@molikuner Thanks for your work! Any API where the same parameter can be used multiple times (possibly relying on the order of parameters) is probably not a good idea. That eliminates your section 1. The syntax
As for having different rules for Having deSEC manage a potential future TLD My Python skills are not sufficient to help with coding, sorry. But the design of the API should not be influenced by what happens to be convenient in code I think. Keeping URLs short and having a syntax that is able to express all use cases is more important IMHO. fiwswe |
|
About the potential ambiguity with the potential future TLD |
|
Thanks @fiwswe for your response. There are a few points that I don't necessarily agree with, or at least want to explain some of my thoughts:
This is already how the existing query parameters work. If you specify them multiple times, only the last one will be considered. I don't want to say that I disagree with you, but we have to live with the existing API (and must not break it, as existing clients might rely on this behavior). Please also note, that I wasn't suggesting to rely on the order. Just that the domain could be specified twice one time for the IPv4 address and one time for the IPv6 address. But I see how there is little benefit over the other solution with comma separated values.
IMHO a request like this should be allowed:
We can already do requests like this:
That's actually a good point. With my current proposal this would be possible:
Why create yet another keyword? Your proposal of
From my experience, ignoring inconsistencies increases support burden, as people don't understand these slight differences. Keeping things simple is usually the better approach. So even if it might seem negligible I would prefer consistency. Adjusting the way the existing parameters are handled is also weird since we have the parameters that specify the IP version in their name already. I also want to highlight another point: "scriptability". This API is intended to be used by some script and having both IPv4 and IPv6 address in the same parameter creates certain edge-cases that need to be handled: Given someone tries to create a simple script that updates curl \
"https://update.dedyn.io/?hostname=updater.example.com,server.example.com&server.example.com=$IPV4,$IPV6" \
--header ...Now this would fail, if the expected IPv4 address as well as the expected IPv6 address are none, i.e. there shouldn't be any A or AAAA record. It would fail as the value of the |
Are you referring to URL parameters in general or the deSEC IP Update API specifically? For the general case it would depend on the application interpreting the URL parameters I think. But you are probably correct for the deSEC case.
No you weren't. I had some alternative specifications in the back of my mind, akin to
We can? I didn't know that. In that case I withdraw that constraint. OTOH in that case determining to which address family the
ok.
But they don't need to change and the So with this adjusted, instead of Regarding scriptability, I agree that is a valid concern. Maybe that was why I discarded empty list elements and suggested the more explicit It would need to be specified what happens in cases like: |
|
Thanks for this PR and the interesting discussion! deSEC's API already supports bulk operations. Is there a kind of change that is supported in this PR but not through bulk operations? |
|
@nils-wisiol No, I don't think anything we are trying to change in this PR is a feature not supported by the general API. (Let's turn that statement around: I think the general API supports everything we need for this PR. No issues there.) Apparently the IP Update API also allows specifying multiple IPs for an address family. I was not aware of that fact before and I must have missed it in the documentation as well. But it is in fact documented. So that was my mistake. Sorry for the confusion. |
|
Hey @nils-wisiol, The bulk operations API indeed supports the updates that we're talking here about already (and even more as it seems). I would love to use it, but unfortunately some of my devices aren't too flexible on the request being send. Thus also supporting bulk operations via the "dyndns API" would be appreciated as I can influence the requests parameters a bit on these devices. In my previous PR (#1112) the support to update more than one subdomains was already introduced. But so far it's not possible to set different IP addresses for specific domains that are updated. E.g. it's not possible to set one subdomain to This current PR would improve on the previous PR by allowing to specify different IP addresses for the updated subdomains in the "dyndns API". |
|
I just found one use-case that I wouldn't be able to replicate easily when using non-suffixed domain parameters. Given I want to update the A and AAAA records for the following domains (no means there shouldn't be a record at all):
With non-suffixed domain parameters one would have to create the following request: Please note the extra Using the initially proposed domain parameters with suffixes it would look like this: Maybe it's just me, but I think the second option is a bit more readable and easier to understand as it explicitly states "set IPv4 for This approach would also have the benefit that either IPv4 or IPv6 could still be inferred by the client IP address, which so far I've not found an option to do with the non-suffixed approach, i.e. the following would do the same, if the request comes from That being said, @peterthomassen and @nils-wisiol please let me know which API format you prefer or if you have any other concerns. I would be happy to adjust the code accordingly. |
I disagree. This could be achieved like this (shorter and without repetitions of any IPs): Or in the more practical and slightly expanded example:
|
|
Oops sorry, I just noticed (after sending of course) that my alternatives do not handle removing the |
|
So is avoiding the need to use an IP/prefix more than once a required goal here? For DDNS clients the only one I know, where using a placeholder more than once is at least unspecified, is FRITZ!OS. Has anyone tested this with FRITZ!OS (or with other DDNS clients)? Scripts that manually construct the URL should not be an issue here, I think. |
|
Hi, I lost track what is implemented in #1112 and what is open for this PR.
Do I understand correctly it is possible since the merge of #1112 to use multiple subdomains in a comma-separated list but not to overwrite IPv6 addresses with the LAN prefix? |
#1112 implements the following:
What you can't do yet, is assign different IPs/prefixes to different hostnames. That is what this PR is about. Thus your use-case is only partially implemented. You can get all but the All of the currently implemented functionality is documented btw. Go ahead and try it out. |
|
Hi @renne, Sorry for the late reply, I was quite busy last week. Thanks @fiwswe for the quick response, but I think with the current feature set implemented by #1112 it's possible to already do the following:
This would be virtually the same behavior (even if there are some additional The update request in the Fritz!Box should be something like this: As it seems you already have a host handling |
|
@renne now that I think about it even more, if you don't care about the As long as you don't define an The result is something like this:
|
|
I just tested with an old Fritz!Box that I had around and noticed some weird behavior in the dyndns client of it. For some reason it doesn't support using the The update URL was set to (as suggested above): This is the request that I observed: As you can see, the As a workaround, I noticed one can do two requests by configuring the client to use two update URLs by concatenating them using a space: Then the first request will set the IPv4 addresses correctly and the second request will update the IPv6 addresses. I could observe the following requests in this case: Note 1: You can not do more than two requests due to rate limiting in this way. Note 2: This was tested on FRITZ!OS version |
|
Today I tested a Fritz!Box 7530AX with Fritz!OS 8.20. |
|
Since I had a rather elaborate setup process faking multiple things to test this, I wasn't 100% sure before, but I also had this problem that the Fritz!Box dyndns client would just not do anything. You could try changing the value for the "Domainname" in config. Every time I changed the value, it was actually doing something for me. The logs are still empty, but at least in the "Online-Monitor" page I was able to see "IPv4-Status: angemeldet, IPv6-Status: angemeldet" after a few seconds. I'm using an actual |
|
How about separating the potential FRITZ!OS issues from the actual deSEC update mechanism? Build the test URL manually and send it via e.g. curl. E.g. use these two URLs alternately (replacing
If FRITZ!OS does not work as advertised then a bug should be reported to FRITZ! GmbH. I have tried something like the above (using curl) but received HTTP Status 500 whenever I tried to update an IPv6 prefix. IPv6 addresses work fine. See Problems updating IPv6 prefix in the deSEC Forum. I have not built a testing setup for testing the FRITZ!OS DynDNS client yet. It would require a webserver or proxy that logs the request to see what it is actually sending. I might do that though. |
|
I have built a testing setup for the FRITZ!OS DynDNS client as follows:
Then I modified the URL in the DynDNS settings in FRITZ!OS on my FRITZ!Box to point to my webserver instead of the DDNS provider I normally use. Nothing else was changed and the URL in the settings looked like this: This resulted in correct values for the parameters So the FRITZ!OS 8.20 DynDNS client works as advertised for me. All of the placeholders were replaced with the expected values. @molikuner I don't know what the cause of your issue was. But if you used the |
|
@fiwswe Did you check if comma-separated hostnames work with the Fritz!OS DynDNS-client? |
|
@renne Initially I didn't but I just checked now:
So yes, with some caveats multiple hostnames work fine. PS. During testing of some variants my FRITZ!Box apparently crashed and the device rebooted. So lesson learned: Don't try to change things too fast as I suspect multiple changes where in flight when this happened. FRITZ!OS does not like that, it seems. |
What does this PR do?
This PR introduces the possibility to set different IP addresses and/or networks for each updated (sub)domain in the dyndns update. It does so by allowing to overwrite request parameters for specific (sub)domains using a new
<domain>.<parameter>syntax.Given the following request:
The following IP addresses would be set after:
Why is it needed?
This PR addresses most remaining concerns from #13, as it allows specifying specific addresses for specific (sub)domains. For example in Germany some ISPs provide an IPv6 network and an IPv6 address for the router that is outside of the given network (see for example this comment in my previous PR).
How is it implemented?
While retrieving the IP address from the request parameters, additional request parameters are considered before falling back to the previous parameters or client IP address:
For IPv4:
<domain>.myip<domain>.myipv4<domain>.ipFor IPv6:
<domain>.myipv6<domain>.ipv6<domain>.myip<domain>.ip