Web service for Dynamic DNS service
Last in my small series about running your own Dynamic DNS service: how to support clients which can't use the "nsupdate" tool directly.
Required:
- A webserver with a scripting language
- A dumb client which a browser or browser emulation (like lynx or curl)
On the server side you need a little script, plus the "dns-update.pl" from this posting plus the Bind key for the zone you want to update. Here is the script, let's say the name is "update-zone.php":
<?php if ($_GET['key'] == 'cryptic_key') { system("/srv/www/updates.domain/dns-update.pl /srv/www/updates.domain/entry1-transfer.key entry1.updates.domain " . $_SERVER['REMOTE_ADDR']); } ?>
The "cryptic_key" should be a random value, it's only required to identify the client. Then the "dns-update.pl" script is executed with the Bind key, the hostname which should be updated and the IP address of the client. Note: if you want the client to supply it's name as well (the second parameter), make sure you sanitize the input.
Now all the client has to do is open a website from time to time:
lynx -source -dump 'http://<webserver>/update-zone.php?key=cryptic_key'
It's a good idea to protect the website with https as well.
Comments
Display comments as Linear | Threaded