Skip to content
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

EasyDNS server response "no update required" results in Error response from DDNS server, ignoring #373

Closed
steveestabrook opened this issue Jan 16, 2022 · 15 comments
Milestone

Comments

@steveestabrook
Copy link

When querying EasyDNS, the server response "no update required" is treated as an error.
inadyn retries every two minutes.
Similar to the issue resolved in #214

In-a-dyn version 2.5 -- Dynamic DNS update client.
Update forced for alias xxx.xxx.xxx, new IP# xxx.xxx.xxx.xxx
Fatal error in DDNS server response:
[200 OK] OK


no update required for xxx.xxx.xxx to xxx.xxx.xxx.xxx
Error response from DDNS server, ignoring ...
@troglobit
Copy link
Owner

Thanks for the report! Is the exact string from the server: no update required?

@steveestabrook
Copy link
Author

steveestabrook commented Jan 16, 2022

It's wrapped in html. The actual message is

no update required for followed by the fqdn to followed by the dynamic IP address

@troglobit
Copy link
Owner

OK, thanks! I think this patch should help, do you have any means of testing it?

diff --git a/plugins/easydns.c b/plugins/easydns.c
index ef80821..d814443 100644
--- a/plugins/easydns.c
+++ b/plugins/easydns.c
@@ -79,7 +79,7 @@ static int response(http_trans_t *trans, ddns_info_t *info, ddns_alias_t *alias)
 
        DO(http_status_valid(trans->status));
 
-       if (strstr(resp, "NOERROR"))
+       if (strstr(resp, "NOERROR") || strstr(resp, "no update required"))
                return 0;
 
        if (strstr(resp, "TOOSOON"))

@troglobit
Copy link
Owner

Hmm, I found this discussion online https://community.sophos.com/sophos-xg-firewall/f/discussions/103809/dynamic-dns-and-easydns-functionality/378085#378085 it refers to the same output you get, but it seems to have the "NOERROR" string as well, which we look for already:

<html><head><title>Current IP Check</title></head><body>Current IP Address: aa.bb.cc.dd</body></html>                                                         
                                                                                
Jul 06 20:59:51.346847: process_checkip_response:aa.bb.cc.dd                  
Jul 06 20:59:51.346864: checkip_response: going to update ip                    
Jul 06 20:59:51.463413: connect_to_server: members.easydns.com:80               
Jul 06 20:59:51.499388: connect_to_server: connect(members.easydns.com) successf
ul                                                                              
Jul 06 20:59:51.499418: Connected with server - client_fd: 0 server_fd: 5       
Jul 06 20:59:51.499468: write_server_socket:writen = 230, exerted = 0           
Jul 06 20:59:51.850408: read_server_socket(): read bytes: HTTP/1.1 200 OK       
Date: Sat, 07 Jul 2018 01:00:35 GMT                                             
Server: Apache                                                                  
X-Powered-By: PHP/5.4.45-0+deb7u5                                               
Set-Cookie: easydns_language=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; pat
h=/                                                                             
Vary: Accept-Encoding                                                           
Content-Length: 59                                                              
Connection: close                                                               
Content-Type: text/html                                                         
                                                                                
NOERROR                                                                         
no update required for name.net to aa.bb.cc.dd                            

Do you get NOERROR as well? I notice you're running a bit older version, so maybe it's another problem you've run into?

@steveestabrook
Copy link
Author

I'm using TrueNAS 12.0 which is based on FreeBSD 12.2
NOERROR is not present in the logs

@troglobit
Copy link
Owner

Hmm, OK maybe it's not shown with normal log level. Could you try running with -l debug to get more debug output?

Also, but maybe you know this already, since TrueNAS packages Inadyn, you need to report this bug also to them so they can backport, or patch locally for their releases. I don't know if they just use FreeBSD pkgs, but anyway I'm not in control of any of the downstream projects.

@steveestabrook
Copy link
Author

steveestabrook commented Jan 16, 2022

debug level log

root@nas:~ # inadyn -1 -n -l debug -f /usr/local/etc/inadyn.conf
inadyn 84700 - - In-a-dyn version 2.5 -- Dynamic DNS update client.
inadyn 84700 - - Base64 encoded string: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
inadyn 84700 - - Get address for default@easydns.com
inadyn 84700 - - Checking for IP# change, connecting to checkip.dyndns.org([193.122.6.168]:80)
inadyn 84700 - - Querying DDNS checkip server for my public IP#: GET / HTTP/1.0
Host: checkip.dyndns.org
User-Agent: inadyn/2.5 https://github.com/troglobit/inadyn/issues

inadyn 84700 - - Server response: HTTP/1.1 200 OK
Date: Sun, 16 Jan 2022 04:17:06 GMT
Content-Type: text/html
Content-Length: 106
Cache-Control: no-cache
Pragma: no-cache
X-Cache: MISS from m0C8DDBBED3C0
X-Cache-Lookup: HIT from m0C8DDBBED3C0:3127
Via: 1.1 m0C8DDBBED3C0 (squid/5.0.2)
Connection: close

<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
inadyn 84700 - - Checked my IP, return code 0: OK
inadyn 84700 - - IP server response:
inadyn 84700 - - HTTP/1.1 200 OK
Date: Sun, 16 Jan 2022 04:17:06 GMT
Content-Type: text/html
Content-Length: 106
Cache-Control: no-cache
Pragma: no-cache
X-Cache: MISS from m0C8DDBBED3C0
X-Cache-Lookup: HIT from m0C8DDBBED3C0:3127
Via: 1.1 m0C8DDBBED3C0 (squid/5.0.2)
Connection: close

<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
inadyn 84700 - - Checking IPv4 address xxx.xxx.xxx.xxx ...
inadyn 84700 - - IPv4 address xxx.xxx.xxx.xxx is valid.
inadyn 84700 - - Current IP# xxx.xxx.xxx.xxx at default@easydns.com
inadyn 84700 - - Update forced for alias xxx.xxx.xxx, new IP# xxx.xxx.xxx.xxx
inadyn 84700 - - Sending IP# update to DDNS server, connecting to api.cp.easydns.com([64.68.203.28]:80)
inadyn 84700 - - Sending alias table update to DDNS server: GET /dyn/generic.php?hostname=xxx.xxx.xxx&myip=xxx.xxx.xxx.xxx&wildcard=OFF HTTP/1.0
Host: api.cp.easydns.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
User-Agent: inadyn/2.5 https://github.com/troglobit/inadyn/issues

inadyn 84700 - - DDNS server response: HTTP/1.1 200 OK
Date: Sun, 16 Jan 2022 04:17:06 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: easydns_language=en_US; expires=Mon, 16-Jan-2023 04:17:06 GMT; Max-Age=31536000; path=/
Set-Cookie: EasyDNS_SID=xxxxxxxxxxxxxxxxxxxxxxxxxx; expires=Sun, 16-Jan-2022 06:17:06 GMT; Max-Age=7200; path=/; domain=api.cp.easydns.com; secure; HttpOnly
X-Frame-Options: sameorigin
Content-Security-Policy: frame-ancestors 'self';
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
X-Cache: MISS from m0C8DDBBED3C0
X-Cache-Lookup: MISS from m0C8DDBBED3C0:3127
Via: 1.1 m0C8DDBBED3C0 (squid/5.0.2)
Connection: close

<HTML><BODY><FONT FACE="sans-serif" SIZE="-1">OK<br />
<hr noshade size="1">
no update required for xxx.xxx.xxx to xxx.xxx.xxx.xxx<br />
</FONT></BODY></HTML>
inadyn 84700 - - Fatal error in DDNS server response:
inadyn 84700 - - [200 OK] <HTML><BODY><FONT FACE="sans-serif" SIZE="-1">OK<br />
<hr noshade size="1">
no update required for xxx.xxx.xxx to xxx.xxx.xxx.xxx<br />
</FONT></BODY></HTML>
inadyn 84700 - - Error response from DDNS server, exiting!
inadyn 84700 - - Error code 48: DDNS server response not OK
root@nas:~ # 

@steveestabrook
Copy link
Author

I built it on another system from the latest source. It failed with the same errror.
I applied the patch and it worked.

@troglobit
Copy link
Owner

Awesome, thank you for taking the time to investigate, really appreciated! It really appears as if they've changed their (old compat) API. I'll make sure to get this fix into the next release of In-a-dyn! Cheers <3

@troglobit troglobit added this to the v2.9.2 milestone Jan 16, 2022
troglobit added a commit that referenced this issue Jan 30, 2022
Fixes issue #373

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@joshuisken
Copy link

I'm running into something similar, with a custom setting for ddns-server webservices.bhosted.nl in version 2.9.1 (docker):

inadyn    | inadyn[1]: Fatal error in DDNS server response:
inadyn    | inadyn[1]: [200 OK] <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
inadyn    | <head>
inadyn    | <meta name="robots" content="noindex, nofollow">
inadyn    | <title>bHosted.nl</title>
inadyn    | </head>
inadyn    | <body>
inadyn    | 	<p>Record up-to-date, not changed</p>
inadyn    | </body>
inadyn    | </html>

Maybe I should add a string comparison to some/one of the 'static int response' functions (which one)?
Or maybe testing for response [200 OK] is good enough?

@joshuisken
Copy link

Fixed it by adding a line to the config file:
ddns-response = "Record up-to-date, not changed"
Source code is our manual ;-)

@troglobit
Copy link
Owner

Huh, I had completely forgotten about that setting! :-D

We should probably document it a little bit better than just in passing in the README. Anyone up for the task? Basically "just" add a section to the man page inadyn.conf.5

@troglobit
Copy link
Owner

@joshuisken an example config for webservices.bhosted.nl would also be great to have in the docs/README, of course

@joshuisken
Copy link

For bHosted one needs to request a hashed password from support, since just creating a MD5 hashed password fails.
Essential is the dns-response line to match the html response mentioned above.

# Basic configuration file for inadyn/bHosted
period   = 3600  # more or less standard

custom your_host {
        username    = your_bHosted_uid
        password    = 3702345_your_hashed_passwd_2bd226
        hostname    = your.hostname.com
        ddns-server = webservices.bhosted.nl
        ddns-path   = "/dyndns?host=%h&ip=%i&user=%u&password=%p"
	ddns-response = "Record up-to-date, not changed"
}

Is it that you add the specified ddns-response to a list of strings being matched?
I was wondering whether you can separate out success/fail/unchanged responses and whether that would make sense.

@troglobit
Copy link
Owner

Great, we should try to get that documented, at least in the README, how to use custom to access bHosted.

For a better integration, a C plugin could be written. That's how more elaborate success/fail/unchanged responses are handled. However, since there is no automatic way to get the hash (from support, you say), then I don't know if it's worth the effort of making (and maintaining!) a dedicated plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants