====== shackspace Dynamic DNS Service ====== {{tag>project software computing infrastructure process howto}} Das ist ein einfach nutzbarer Dynamic DNS Server unterhalb der Zone ''dyn.shackspace.de''. Die Aktualisierung des Eintrags geschieht ganz einfach ueber den Aufruf der URL ''http://dyn.shackspace.de/dyn?digest=md5sum(HOSTNAME:AUTH)'' Es wird die absendende IP-Adresse eingetragen, das gilt gleichermassen fuer IPv6 & und IPv4. Wenn man den Parameter ''&ip=xxxx'' angibt, wird diese Adresse eingetragen: * fuer eine IPv4-Adresse ein DNS IN A RR * fuer eine IPv6-Adresse ein DNS IN AAAA RR * fuer alles uebrige ein DNS IN TXT RR Zugangsdaten gibt's bei admin at, bitte Rechnernamen angeben, Auth-Code kommt zurueck. Beispiele: wget -O /dev/null http://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' ) wget -O /dev/null http://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' )\;ip=127.0.0.1 wget -O /dev/null http://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' )\;ip=offline //Der '\' vor dem Semikolon ist notwendig, damit die Shell dieses nicht als Meta-Character interpretiert// Der Dienst selbst ist nicht besonders gesichert, er kann mit SSL verwendet werden: Beispiele: wget -O /dev/null --no-check-certificate https://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' ) wget -O /dev/null --no-check-certificate https://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' )\;ip=127.0.0.1 wget -O /dev/null --no-check-certificate https://dyn.shackspace.de/dyn?digest=$( echo -n HOSTNAME:AUTH | md5sum | awk '{print $1}' )\;ip=offline ===== Implementierung ===== angelegt: // dynamic zone "dyn.shackspace.de" w/ nsupdate & dyn include "/etc/bind/dyn-key.key"; acl "update-dyn" { key dyn-key; }; zone "dyn.shackspace.de" { type master; file "/etc/bind/dyn.shackspace.de."; allow-update { update-dyn; }; allow-transfer { xfer-allowed; }; }; // "dyn.shackspace.de" END rndc reconfig rndc reload HOST=dyn KEYNAME=$HOST-key dnssec-keygen -a hmac-md5 -b 256 -n host $HOST awk '/^Key: / { k = $2; exit } END { print "key \"'"$KEYNAME"'\" {"; print "\talgorithm hmac-md5;"; print "\tsecret \"" k "\";"; print "};"; }' K$HOST.+*+*.private > $KEYNAME.key rm K$HOST.+*+*.{key,private} chmod g+w /etc/bind ''/etc/bind/shackspace.de.'' dyn IN A 141.31.176.214 dyn IN AAAA 2a01:4f8:190:5484::20 dyn.v4 IN A 78.46.139.5 dyn.v6 IN AAAA 2a01:4f8:190:5484::20 dyn IN NS ns.shackspace.de. dyn IN NS ns3.shackspace.de. dyn IN NS perl.opsec.eu. rndc reload shackspace.de wget http://www.fischglas.de/software/dyn/dyn -O /var/www/dyn.shackspace.de/htdocs/dyn chmod 755 /var/www/dyn.shackspace.de/htdocs/dyn DOMAIN=shackspace.de mkdir /etc/dyn cat > /etc/dyn/dyn.cfg << EOF DNS.Host: 127.0.0.1 DNS.Key: (secret aus /etc/bind/dyn-key.key ) DNS.Key.Name: dyn-key Authfile: /etc/dyn/dyn.$DOMAIN.auth NSUpdate: /usr/bin/nsupdate Debug: 0 EOF cat >> /etc/dyn/dyn.$DOMAIN.auth << EOF test.dyn.$DOMAIN:$(apg -n 1) EOF # fuer nsupdate: aptitude install dnsutils === apache config (aktuell) === ''/etc/apache2/sites-available/dyn.shackspace.de.conf'' ScriptAlias /dyn /var/www/dyn.shackspace.de/htdocs/dyn === apache mod_rewrite config (aktuell) === ''/etc/apache2/sites-available/px4.shackspace.de'' # forward ip address to "dyn" service if none given RewriteCond %{HTTP_HOST} '^dyn(|.v4|.v6]).shackspace.de$' RewriteCond %{REQUEST_URI} ^/dyn$ RewriteCond %{QUERY_STRING} ^digest=[0-9a-f]{32}$ RewriteRule ^/dyn$ http://web07.v6.shackspace.de/dyn?%{QUERY_STRING}&ip=%{REMOTE_ADDR} [P,L] # redirect "/dyn" to web07.v6 = dyn.shackspace.de RewriteCond %{HTTP_HOST} '^dyn(|.v4|.v6]).shackspace.de$' RewriteCond %{REQUEST_URI} ^/dyn$ RewriteRule ^/dyn$ http://web07.v6.shackspace.de/dyn?%{QUERY_STRING} [P,L] # forward ip address to "dyn" service if none given (legacy as of 2016-11-22) RewriteCond %{HTTP_HOST} '^shackspace.de$' RewriteCond %{REQUEST_URI} ^/dyn$ RewriteCond %{QUERY_STRING} ^digest=[0-9a-f]{32}$ RewriteRule ^/dyn$ http://web07.v6.shackspace.de/dyn?%{QUERY_STRING}&ip=%{REMOTE_ADDR} [P,L] # redirect "/dyn" to web07.v6 = dyn.shackspace.de (legacy as of 2016-11-22) RewriteCond %{HTTP_HOST} '^shackspace.de$' RewriteCond %{REQUEST_URI} '^/dyn$' RewriteRule ^/dyn(|\?.*)$ http://web07.v6.shackspace.de/dyn$1 [P,L] ''service apache2 reload'' === lighttpd config (Stand 2011-10) === ''/etc/lighttpd/20-shackspace.de.conf'' cgi.assign = ( ... "/dyn" => "", ... ''/etc/init.d/lighttpd reload'' ==== History ==== * 2016-11-28 * eigener Vserver dyn.shackspace.de * Service-URL angepasst