This is a simple tool to update a given DNS hosts file managed by Godaddy.
You can (sort of) think of this as a way to get Dynamic DNS from a domain name
managed by Godaddy. This script can be run manually, from cron, or any other
way a script gets executed on your system.
Once Python is installed, the dependencies can be installed via pip:
# For system-wide install
pip install -r requirements.txt
# For local-user install
pip install --user -r requirements.txt
usage: update.py [-h] config
positional arguments:
config The JSON config file to load.
optional arguments:
-h, --help show this help message and exit
update.py requires a valid configuration JSON file. There is a sample config
file included in this repository which you can use as a template (be sure to
remove the comments, those aren't valid JSON).
The configuration file needs to have the following fields:
domain : This field indicates the base domain you wish to update. Let's sayssh.foobar.net to be the full name for my IP to point to. In thatdomain would be foobar.net.sub-domain : This field indicates the sub-domain you wish to update. Again,ssh.foobar.net to be the full name for my IP to point to, I'dsub-domain be ssh.refresh_time : update.py keeps track of the last time it updated the IPrefresh_time is a field that tells the script tohours, days, seconds,weeks.ip_url : This is a website which, when accessed, will return the IPkey : This is the application key from Godaddy's API key tool.secret_key : This is the secret key from Godaddy's API key tool.The ip_url setting in the configuration file detailed above must return a
JSON object containing a field, ip which has the IP address to be used. The
idea here is that the remote site will be able to return the public address of
the system contacting it (which, in turn, can be used to find out the correct
IP for the dynamic DNS to work). Of course, it can return any IP address
and the updater will use it. So, if you wanted, you could use this for
something other than dynamic DNS.
A sample CGI script that can generate such a response can be found
here.
After the updater script runs, it will update the config JSON file with two
new entries:
last_ip : This is the last IP used to update Godaddy.last_update : This is the last time Godaddy was updated.These two entries will always be automatically generated by the script, and are
not intended to be manually changed.
My script should be fine to run under Python 3.x. However, godaddypy has
certain 2.7-isms that currently prevent it from running under 3.x.
Probably. You can run this script as often as you want and set your refresh
time to seconds. Of course, I wouldn't recommend doing that.
Personally, I run mine from cron every 5-15 minutes, and then have a full
refresh every 12 hours or so.