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
982 stars 142 forks source link

dynv6 (IPv6) fails to update IP address and returns a "400 Bad Request" error #446

Closed oblivcheck closed 1 year ago

oblivcheck commented 1 year ago

i have checked #433 and #382.

this is my file:/etc/inadyn.conf

# In-A-Dyn v2.0 configuration file format
period          = 300
user-agent      = Mozilla/5.0

# dynv6.com update using a custom checkip-command, which works
# if you have access to an Internet-connected interface.  Make
# sure to verify the command works on your system first
allow-ipv6 = true                # required option for IPv6 atm.
#provider default@dynv6.com {
provider default@dynv6.com {
    username = mmmytoken
    password = not_used
    hostname = { mydomain.dynv6.net }
    checkip-command = "/sbin/ip -6 addr | grep inet6 | awk -F '[ \t]+|/' '{print $3}'>
}

# inadyn -l debug --foreground --force:

inadyn[13960]: In-a-dyn version 2.11.0 -- Dynamic DNS update client.
inadyn[13960]: Guessing DDNS plugin 'default@ipv4.dynv6.com' from 'dynv6.com'
inadyn[13960]: Failed resolving hostname mydomain.dynv6.net: No address associated with hostname
inadyn[13960]: Get address for default@ipv4.dynv6.com
inadyn[13960]: Starting command to get my public IP#: INADYN_PROVIDER="default@ipv4.dynv6.com" INADYN_USER="MMMPASSWD" /sbin/ip -6 addr | grep inet6 | awk -F '[   ]+|/' '{print $3}' | grep -v ^::1 | grep -v ^fe80
inadyn[13960]: Command 'INADYN_PROVIDER="default@ipv4.dynv6.com" INADYN_USER="MMMPASSWD" /sbin/ip -6 addr | grep inet6 | awk -F '[         ]+|/' '{print $3}' | grep -v ^::1 | grep -v ^fe80' returns 37 bytes
inadyn[13960]: Command response:
inadyn[13960]: MYIPV6
inadyn[13960]: Checking IPv6 address MYIPV6 ...
inadyn[13960]: IPv6 address MYIPV6 is valid.
inadyn[13960]: Current IP# MYIPV6 at default@ipv4.dynv6.com
inadyn[13960]: Update forced for alias mydomain.dynv6.net, new IP# MYIPV6
inadyn[13960]: Sending IP# update to DDNS server, initiating HTTPS ...
inadyn[13960]: Sending IP# update to DDNS server, connecting to ipv4.dynv6.com([95.216.144.82]:443)
inadyn[13960]: Certificate OK
inadyn[13960]: SSL server cert subject: CN=dynv6.com
inadyn[13960]: SSL server cert issuer: C=US,O=Let's Encrypt,CN=R3
inadyn[13960]: Sending alias table update to DDNS server: GET /api/update?ipv4=MYIPV6&hostname=mydomain.dynv6.net&token=MMMPASSWDHTTP/1.0
Host: ipv4.dynv6.com
User-Agent: Mozilla/5.0

inadyn[13960]: Successfully sent HTTPS request!
inadyn[13960]: Successfully received HTTPS response (103/8191 bytes)!
inadyn[13960]: DDNS server response: HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Connection: close

400 Bad Request
inadyn[13960]: Fatal error in DDNS server response: DDNS server response not OK
inadyn[13960]: 400 Bad Request
inadyn[13960]: Error response from DDNS server, exiting!
inadyn[13960]: Error code 48: DDNS server response not OK

I only have "public ipv6", v4 is behind multi-layer NAT

problem may be hereinadyn[13960]: Sending alias table update to DDNS server: GET /api/update?ipv4=MYIPV6&hostname=mydomain.dynv6.net&token=MMMPASSWDHTTP/1.0

According to https://dynv6.com/docs/apis this should be /api/update?ipv6=MYIPV6&hostname=mydomain.dynv6.net&token=MMMPASSWDHTTP/1.0

Also triedprovider default@dynv6.com run # inadyn -l debug --foreground --force

~~inadyn[13994]: In-a-dyn version 2.11.0 -- Dynamic DNS update client. inadyn[13994]: Cannot find an DDNS plugin for provider 'default@dynv6.com' inadyn[13994]: Error code 74: Missing .conf file~~

I tried modifying plugins/dynv6.cto always use ipv6 send request or always include ipv6= in path. but still return error 400.

Not sure if it's my configuration problem, but using the script provided by https://gist.github.com/corny/7a07f5ac901844bd20c9, I successfully updated my dns records.

troglobit commented 1 year ago

Have you tried the latest code on the master branch? The above log seems to indicate a run with v2.11.0, which has known problems with dynv6, as you've noticed. One of the fixes is a missing space before HTTP/1.0, see cffc7af, which seem to be the root cause of your troubles.

oblivcheck commented 1 year ago

My bad, mistakenly thought that the patch was already in the latest released version. everything is fine now:D

troglobit commented 1 year ago

Awesome! I'm a bit behind on release activities, but a new release is just around the corner with this fix, promise!

(closing)