ddns-scripts: implements usage of nsupdate to direct update DNS servers

* new service "bind-nsupdate" using nsupdate to directly updates a PowerDNS or Bind server via nsupdate.
  suggested by Jan Riechers (Pull #957) many thanks!
* updated tld-names.dat

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
Christian Schoenebeck
2015-02-28 16:43:02 +01:00
parent 137744a742
commit fad616a4cc
3 changed files with 171 additions and 40 deletions
+46 -7
View File
@@ -6153,6 +6153,38 @@ store.st
// su : http://en.wikipedia.org/wiki/.su
su
adygeya.su
arkhangelsk.su
balashov.su
bashkiria.su
bryansk.su
dagestan.su
grozny.su
ivanovo.su
kalmykia.su
kaluga.su
karelia.su
khakassia.su
krasnodar.su
kurgan.su
lenug.su
mordovia.su
msk.su
murmansk.su
nalchik.su
nov.su
obninsk.su
penza.su
pokrovsk.su
sochi.su
spb.su
togliatti.su
troitsk.su
tula.su
tuva.su
vladikavkaz.su
vladimir.su
vologda.su
// sv : http://www.svnet.org.sv/niveldos.pdf
sv
@@ -9508,6 +9540,7 @@ zuerich
// ===END ICANN DOMAINS===
// ===BEGIN PRIVATE DOMAINS===
// (Note: these are in alphabetical order by company name)
// Amazon CloudFront : https://aws.amazon.com/cloudfront/
// Submitted by Donavan Miller <donavanm@amazon.com> 2013-03-22
@@ -9941,6 +9974,10 @@ firebaseapp.com
// Submitted by Jonathan Rudenberg <jonathan@flynn.io> 2014-07-12
flynnhub.com
// GDS : https://www.gov.uk/service-manual/operations/operating-servicegovuk-subdomains
// Submitted by David Illsley <david.illsley@digital.cabinet-office.gov.uk> 2014-08-28
service.gov.uk
// GitHub, Inc.
// Submitted by Ben Toews <btoews@github.com> 2014-02-06
github.io
@@ -10052,17 +10089,19 @@ poznan.pl
wroc.pl
zakopane.pl
// priv.at : http://www.nic.priv.at/
// Submitted by registry <lendl@nic.at> 2008-06-09
priv.at
// Red Hat, Inc. OpenShift : https://openshift.redhat.com/
// Submitted by Tim Kramer <tkramer@rhcloud.com> 2012-10-24
rhcloud.com
// GDS : https://www.gov.uk/service-manual/operations/operating-servicegovuk-subdomains
// Submitted by David Illsley <david.illsley@digital.cabinet-office.gov.uk> 2014-08-28
service.gov.uk
// priv.at : http://www.nic.priv.at/
// Submitted by registry <lendl@nic.at> 2008-06-09
priv.at
// SinaAppEngine : http://sae.sina.com.cn/
// Submitted by SinaAppEngine <saesupport@sinacloud.com> 2015-02-02
sinaapp.com
vipsinaapp.com
1kapp.com
// TASK geographical domains (www.task.gda.pl/uslugi/dns)
gda.pl
+46
View File
@@ -0,0 +1,46 @@
#
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
#
# The script directly updates a PowerDNS (or maybe bind server) via nsupdate from bind-client package.
#.based on github request #957 by Jan Riechers <de at r-jan dot de>
#.2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
#
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
#
# using following options from /etc/config/ddns
# option username - keyname
# option password - shared secret (base64 encoded)
# option domain - full qualified domain to update
# option dns_server - DNS server to update
#
# variable __IP already defined with the ip-address to use for update
#
local __TTL=600 #.preset DNS TTL (in seconds)
local __RRTYPE __PW __TCP
[ -x /usr/bin/nsupdate ] || write_log 14 "'nsupdate' not installed or not executable !"
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing 'username'"
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing 'password'"
[ -z "$dns_server" ] && write_log 14 "Service section not configured correctly! Missing 'dns_server'"
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
[ $force_dnstcp -ne 0 ] && __TCP="-v" || __TCP=""
# create command file
cat >$DATFILE <<-EOF
server $dns_server
key $username $password
update del $domain $__RRTYPE
update add $domain $__TTL $__RRTYPE $__IP
show
send
quit
EOF
/usr/bin/nsupdate -d $__TCP $DATFILE >$ERRFILE 2>&1
# nsupdate always return success
write_log 7 "nsupdate reports:\n$(cat $ERRFILE)"
return 0