Project

dns-update

0.0
No commit activity in last 3 years
No release in over 3 years
Speaks nsupdate's protocol, queries jsonip.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12

Runtime

~> 1.59
 Project Readme

Gem Version

dns-update

Ruby Dynamic DNS Updater

To install:

gem install dns-update

To use:

Usage: dns-update [options]
	-u, --url URL                    JSON IP URL
	-e, --key-name KEY-NAME          Name of the TSIG key
	-k, --key KEY                    Base64 encoded TSIG key
	-z, --zone ZONE                  DNS Zone to update
	-r, --record RECORD              DNS Record to update
	-n, --nameserver NAMESERVER      Nameserver to update
	-t, --ttl TTL                    TTL of newly updated record

To set up your zone file for dynamic updates, you should generate a key file with tsig-keygen:

$ tsig-keygen
key "tsig-key" {
	algorithm hmac-sha256;
	secret "ww4qyRqNH7CVk8U4m0Y0Rjin5G35YJgMv93sjTcRFo4=";
};

Save the output to a safe place, copy and paste it into your named.conf, and add an update-policy to your zone config:

$ cat named.conf
key "tsig-key" {
	algorithm hmac-sha256;
	secret "ww4qyRqNH7CVk8U4m0Y0Rjin5G35YJgMv93sjTcRFo4=";
};
zone "insomnike.tk" {
	type master;
	file "/etc/bind/db.insomnike.tk";
	update-policy {
		grant tsig-key zonesub ANY;
	};
	notify yes;
};
...

Now you can call dns-update with your authentication details. It will get your external IP from jsonip.com and then update your DNS records:

dns-update -e tsig-key -z insomnike.tk \
	-n ns.insomnike.tk -r house.insomnike.tk \
	-k ww4qyRqNH7CVk8U4m0Y0Rjin5G35YJgMv93sjTcRFo4=