chrisb86 / nsupdate Goto Github PK
View Code? Open in Web Editor NEWUpdate a nameserver entry at inwx with the current WAN IP (DynDNS)
Update a nameserver entry at inwx with the current WAN IP (DynDNS)
Hello,
I've got an issue on IPV6-Updates. If the Option USE_DRILL is set to yes i get everytime NSLOOKUP=AAAA - so everytime my IPV6 gets updated:
So 9. Aug 19:10:03 CEST 2015 - _._.*** updated. Old IP: AAAA New IP: ::
When USE_DRILL = NO the IP doesn't need an update.
So 9. Aug 20:36:02 CEST 2015 - No update needed for _..**. Current IP: *::_
IPV4 works well with USE_DRILL = YES or NO.
I'm not sure if this really is a problem or if it should be like this. I'm so happy that i found that script - but actually i don't understand it 100% - and can't really create a patch. Sorry.
Greetings,
Jonathan
For convenience reasons it would be very nice especially for new user so they don't need to lookup HTML code elements.
I already did some tests, it took some time because there are no examples in the documentation for this case.
I think it is ready for implementation.
I don't know if the used XML-Parser is available on most systems. Maybe there are other options.
New dependency as an option would be:
You can try this:
#/usr/bin/env bash
INWX_USER="NiceUserName"
INWX_PASSWORD="VeryStrongPassword"
MAIN_DOMAIN="example.de"
DOMAIN="home.example.de"
TYPE="AAAA"
API_INFO_REQUEST="<?xml version=\"1.0\"?>
<methodCall>
<methodName>nameserver.info</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>user</name>
<value>
<string>$INWX_USER</string>
</value>
</member>
<member>
<name>lang</name>
<value>
<string>en</string>
</value>
</member>
<member>
<name>pass</name>
<value>
<string>$INWX_PASSWORD</string>
</value>
</member>
<member>
<name>domain</name>
<value>
<string>$MAIN_DOMAIN</string>
</value>
</member>
<member>
<name>name</name>
<value>
<string>$DOMAIN</string>
</value>
</member>
<member>
<name>type</name>
<value>
<string>$TYPE</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>"
# The full xpath
# XPATH='string(/methodResponse/params/param/value/struct/member[name="resData"]/value/struct/member[name="record"]/value/array/data/value/struct/member[name="id"]/value/int)'
# A short version of the xpath
XPATH='string(//member[name="id"]/value/int/text())'
ID=$(curl -s -X POST https://api.domrobot.com/xmlrpc/ \
-H "Content-Type: application/xml" \
-d "$API_NFO_REQUEST" \
| xmllint --xpath $XPATH -)
#curl -X POST https://api.domrobot.com/xmlrpc/ \
#-H "Content-Type: application/xml" \
#-d "$API_INFO_REQUEST"
# If you want a beautiful formatted XML-output use this (pipe):
#| xmllint --format -
#The AAAA-Type Record-ID of home.example.de is: 123456789
echo $(printf "The %s-Type Record-ID of %s is: %s" "$TYPE" "$DOMAIN" "$ID")
Three files changed. Checks where included and the IP Provider changed from http to https.
Hi,
I've encountered a strange bug. The WAN_IP
is sometimes blank and then the script updates the DNS entry (which I presume doesn't work since it's blank). This only happens when I run the script. Running the curl
command by hand works like a charm. It's bit strange. I might update the script in order that it fails whenever WAN_IP
or NSLOOKUP
is blank/not set.
Cheers,
scho
Hi there
thanks for your great work.
I want to let you know, that the wan_ip is never set on systems without xmllint.
The wan_ip part is currently nested in the xmllint check, when you put it into a separate function i.e. get_wan_ip and call that one after get_domain_info everything works like charm.
Cheers
I got this error-message:
Starting nameserver update with config file ./nsupdate.d/nsupdate.config
<?xml version="1.0" encoding="UTF-8"?><methodResponse><fault><value><struct><member><name>faultString</name><value><string>parse error. not well formed.
error occurred at line 17, column 50, byte index 561</string></value></member><member><name>faultCode</name><value><int>-32700</int></value></member></struct></value></fault></methodResponse>
Is there a problem with the inwx-API or the script?
Hi @chrisb86 ,
as I can see the two latest commits (+2 merge) are missing.
I think it was done by the manual renaming of master -> main
Your local branch was not up to date so now some history is gone (not really I still have it on my fork https://github.com/EV21/nsupdate/commits/master ) - You can still fix it. - Just add my fork as remote, pull the changes and push it back to origin.
I think this should fix it:
git remote add ev21 [email protected]:EV21/nsupdate.git
git pull ev21 master
git push origin main
You could have waited for the release (announced to be released later in January) of the GitHub renaming tool. see https://github.com/github/renaming
Hello,
it is possible that the domain record only get updated when the ip address since last check (could be checked with the logs) have changed?
Currently I'm running the script every 10 minute to be sure that when the ip address is changed the domain is updated. I don't know if thats for inwx.de okay. :)
The default IP check site is now only per https reachable. http://ip.dblx.io gives an 301 error.
Hello,
I was just trying the script to update my INWX domain, but I get some error.
This is the output on CLI:
Starting nameserver update with config file ./nsupdate.d/www_example_org_AAAA.config (./nsupdate.sh.log)
<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>code</name><value><int>2005</int></value></member><member><name>msg</name><value><string>Parameter value syntax error</string></value></member><member><name>reasonCode</name><value><string>INVALID_CONTENT</string></value></member><member><name>reason</name><value><string>The following parameter is invalid: content</string></value></member><member><name>details</name><value><array><data><value><struct><member><name>code</name><value><string>PARAM_INVALID</string></value></member><member><name>msg</name><value><string>The parameter '' is invalid</string></value></member></struct></value></data></array></value></member><member><name>svTRID</name><value><string>20210927-163119648</string></value></member><member><name>runtime</name><value><double>0.002600</double></value></member></struct></value></param></params></methodResponse>Starting nameserver update with config file ./nsupdate.d/www_example_org_A.config (./nsupdate.sh.log
This is from the log:
Mon Sep 27 14:33:21 UTC 2021 - www.example.org updated. Old IP: ::1 New IP:
Mon Sep 27 14:33:22 UTC 2021 - No update needed for www.example.org. Current IP: 192.0.2.22
Any idea why the IPv6 is not updated?
Behind a router it's possible to get the external IP directly through upnp.
E.g. miniupnp ships with a neat script named external-ip which just returns the external IP without pinging some arbitrary online service.
since two days ddclient isnt working anymore. i searched the internet for an alternative and found this script. i configured everything like i should and got an "Authentication error" back when running the script. manually updating ip works fine so my login data should be correct. do i miss something?
Hello,
when I try to run the script as a cron job, no config file is found. When I try to run it via ssh, everything works fine. A workaround for me was to write a script, which cd's into the folder of the script and then executes it.
Thanks a lot for your work on this script.
Best regards
Andreas
Edit: Another workaround is to disable the config file check.
OS: FreeNAS-9.3-STABLE-201506292130
see PR: #22
For some reason the script is unable to retrieve WAN_IP. The dependencies are all met. The script is running on a OpenWrt Chaos Calmer Router.
$ cat nsupdate.config
# nsupdate.config
# from which site should we get your wan ip?
IP_CHECK_SITE="https://ip.dblx.io"
# use drill instead of nslookup for hostname lookup
USE_DRILL="YES"
# Use IPv6 connection
IPV6="NO"
# Update an MX record
MX="NO"
# Suppress all messages
SILENT=NO
# Login credentials for the inwx admin interface
INWX_USER="User"
INWX_PASS='XXXXXXX'
# The hostname that you want to update and it's ID from the inwx interface
# You get the ID when you edit the given nameserver entry and hover the save button.
DOMAIN="home.domain.de"
INWX_DOMAIN_ID="123456789"
$ cat nsupdate.sh.log
Sat Jul 16 13:02:24 CEST 2016 - home.domain.de updated. Old IP: 77.21.146.128 New IP:
Sat Jul 16 13:04:32 CEST 2016 - home.domain.de updated. Old IP: 77.21.146.128 New IP:
Sat Jul 16 13:09:23 CEST 2016 - home.domain.de updated. Old IP: 77.21.146.128 New IP:
Sat Jul 16 13:16:30 CEST 2016 - No update needed for home. Current IP:
Sat Jul 16 13:17:50 CEST 2016 - No update needed for home. Current IP:
Sat Jul 16 13:18:14 CEST 2016 - home.domain.de updated. Old IP: 77.21.146.128 New IP:
Sat Jul 16 13:20:13 CEST 2016 - No update needed for home.domain.de. Current IP:
Sat Jul 16 13:22:23 CEST 2016 - home.domain.de updated. Old IP: 77.21.146.128 New IP:
Is this a issue with https://ip.dblx.io? If so, are there any alternatives available?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.