troglobit / inadyn

In-a-Dyn is a dynamic DNS client with multiple SSL/TLS library support
https://troglobit.com/projects/inadyn/
GNU General Public License v2.0
975 stars 141 forks source link

URL encoding problem #175

Closed invin12 closed 7 years ago

invin12 commented 7 years ago

I have an error 400 with duckdns.org

inadyn[1826]: Sending alias table update to DDNS server: GET %2fupdate%3fdomains%3dcovo.duckdns.org%26token%3dxxxxxx-67b4-40e9-9f39-ab860d720d05%26ip%3dxx.xx.149.91 HTTP/1.0
Host: www.duckdns.org
Authorization: Basic bm91c2VyOjQ0MGIyYWVlLTY3YjQtNDBlOS05ZjM5LWFiODYwZDcyMGQwNQ==
User-Agent: inadyn/2.2-rc1 https://github.com/troglobit/inadyn/issues

inadyn[1826]: Successfully sent DDNS update using HTTPS!
inadyn[1826]: Successfully received DDNS update response (288 bytes) using HTTPS!
inadyn[1826]: DDNS server response: HTTP/1.1 400 Bad Request
Server: awselb/2.0
Date: Wed, 27 Sep 2017 12:31:47 GMT
Content-Type: text/html
Content-Length: 138
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
</body>
</html>
inadyn[1826]: Fatal error in DDNS server response:
inadyn[1826]: [400 Bad Request] <html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
</body>
</html>

but no problem with manual update through telnet

root@dmRouter:~# telnet www.duckdns.org 80
GET /update?domains=scovo.duckdns.org&token=xxxxxxx-67b4-40e9-9f39-ab860d720d05&ip=xx.xx.149.91 HTTP/1.0

HTTP/1.1 200 OK
Date: Wed, 27 Sep 2017 12:21:56 GMT
Connection: close
Set-Cookie: AWSALB=c9HFQ4PlzZl+rGoxB8FmZ/lblLru7as03GtToDAkr2Jv0j7242sZt5cQ8bSS3eG/yO35kIfinKNg7vKJ90dTRLexc1R2ZMlIZtU3x77+20IqhNgBiiv6r8i8xkqH; Expires=Wed, 04 Oct 2017 12:21:56 GMT; Path=/
Server: nginx/1.4.6 (Ubuntu)
X-Clacks-Overhead: GNU Terry Pratchett

Is it possible to make a request without URL encoding?

troglobit commented 7 years ago

Could you include your configuration file, except your password of course?

invin12 commented 7 years ago
# Inadyn v2.0 configuration file format
verify-address = true
period = 600
iterations = 1

custom webcam-odincovo {
    username        = nouser
    password        = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ssl         = true
    checkip-command = "/sbin/ifconfig vlan2 | grep 'inet addr'"
    ddns-server     = www.duckdns.org
    ddns-path       = "/update?domains=%h&token=%p&ip=%i"
    ddns-response   = "ok"
    hostname        = { su155-odincovo.duckdns.org,unixnet.duckdns.org,webcam-odincovo.duckdns.org,invin1.duckdns.org,8mkr-odincovo.duckdns.org }
#   checkip-server  = api.ipify.org
}
troglobit commented 7 years ago

Aha, so you're using the custom DDNS provider support with custom URL encoding. There was a couple of bug fixes to URL encoding just prior to the v2.2 GA release. Also, DuckDNS has an official plugin which should simplify your configuration.

Therefore I'd recommend upgrading to the official v2.2 release and try the following configration instead:

verify-address = true
period         = 600

provider duckdns.org {
    username        = nouser
    password        = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    checkip-command = "/sbin/ifconfig vlan2 | grep 'inet addr'" 
    hostname        = { "su155-odincovo.duckdns.org", "unixnet.duckdns.org", "webcam-odincovo.duckdns.org", "invin1.duckdns.org", "8mkr-odincovo.duckdns.org" }
}

This should work, unless you run into another bug. (SSL is the default these days.)

invin12 commented 7 years ago

Ok, thank you, I will try this. It`s a little problem to recompile inadyn on my dd-wrt router under ARM.

schischlak commented 7 years ago

I have the same problem, and still. I tried all of this, no success. Please view my case, maybe its fixable and I did something wrong :-) Problem: 400 Bad Request answer from spdns provider, what I see is the encoded Url for update request. On "inadyn -l debug -n" I see " Sending alias table update to DDNS server: GET %2fnic%2fupdate%3f%26myip%3d192.168.0.1%26hostname%3dxxxx.spdns.de HTTP/1.0" Im using In-a-dyn version 2.2-rc1 -- Dynamic DNS update client. I cannot update to any other version, because its an ARM Asus Router with Merlin-OS on it. I changed the package-source to some other, but since I updated some libs on system, older inadyn wont run anymore. But inadyn is running, just not working correctly. I have to use custom ddns in config, because my provider SPDNS is maybe not supported directly. The Update Url is "update.spdyn.de/nic/update?" which I have to set. The old problem that inadyn always appends the hostname at the end of the update-url is known, so the string ddns-path = "/nic/update?&myip=192.168.0.1&hostname=" works normally. I update the RFC-IP so spdyn puts itself the IP in which called the update. Worked for years. Question is now, can I do something with the config not to encode URL or just wait for new version some days ?

troglobit commented 7 years ago

@schischlak I cannot support every version of Inadyn that some distribution decided to ship. My spare time is limited to supporting the latest official release, in this case v2.2. I'm not particularly happy to hear about distributions shipping pre-release quality of my SW.

However, the following config snippet, from the man page, should work for spdyn.de, which is a supported provider.

# spdyn.de
provider spdyn.de {
    username   = your_username
    password   = your_password
    hostname   = your_host.spdyn.de
}
schischlak commented 7 years ago

Thank you very much. I got the inadyn from the original entware-ng binaries repo, updated with opkg normal way. They say "We've downgraded inadyn fork down to last stable release" maybe thats why I got this version. I tried this already but client says "Invalid DDNS provider spdyn.de - Parse error in /opt/etc/inadyn.conf" therefore I said must use "custom".

troglobit commented 7 years ago

Try provider default@spdyn.de ...

On Mon, Oct 2, 2017, 16:15 schischlak, notifications@github.com wrote:

Thank you very much. I got the inadyn from the original entware-ng binaries repo, updated with opkg normal way. They say "We've downgraded inadyn fork down to last stable release" maybe thats why I got this version. I tried this already but client says "Invalid DDNS provider spdyn.de - Parse error in /opt/etc/inadyn.conf" therefore I said must use "custom".

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/troglobit/inadyn/issues/175#issuecomment-333547443, or mute the thread https://github.com/notifications/unsubscribe-auth/AALM3eDGzPjroct1yzjPeABV4oamnFUjks5soPAYgaJpZM4PltBy .

schischlak commented 7 years ago

inadyn[4052]: Successfully sent DDNS update using HTTPS! inadyn[4052]: Successfully received DDNS update response (890 bytes) using HTTPS! inadyn[4052]: DDNS server response: HTTP/1.1 200 OK inadyn[4052]: Successful alias table update for .... !

troglobit commented 7 years ago

@schischlak So ... I take it, it worked?

troglobit commented 7 years ago

Please let me know if we can close this issue now.

schischlak commented 7 years ago

Yes, you can close this issue. The problem can be solved by using the right version with the url-encode-problem fixed (2.2) and then proper settings for the dyn-provider, if it is directly supported. I was lucky mine was supported (spdns) by inadyn, because with custom settings I got problems with "libconfused" after update. Thank you very much :-)

troglobit commented 7 years ago

Alright, closing.