DynDNS Updates without a Client

My new hosting provide Strato offers DynDNS. I was searching for a DynDNS client for my OpenSolaris Home Server, but a small bash script does the job as good as any other client.

dyndns-update.sh
#! /bin/bash
 
. ${HOME}/.dyndns.cfg
DOMAINS=$(cat ${HOME}/.dyndns.domains)
 
echo "$(date '+%Y-%m-%d %H:%M') $(basename $0)"
for domain in ${DOMAINS}; do
        echo -n "  ${domain} - "
        curl --silent --show-error --insecure --user ${LOGIN} "${UPDATE_URL}?hostname=${domain}"
done

First, the login credentials (the $LOGIN variable) and the server's URL ($UPDATE_URL) are read from the config file ~/.dyndns.cfg.

Here an example config file:

dyndns.cfg
LOGIN="jdoe:secret"
UPDATE_URL="http://members.dyndns.org/nic/update" # DynDNS service
# UPDATE_URL="https://dyndns.strato.com/nic/update" # Strato's DynDNS service

The file .dyndns.domains contains all the domains which should be updated. They must be whitespace separated, I recomment to put one domain per line.

In the for loop, curl is used to update the domains.

Currently, I use the switch –insecure to disable the SSL certificate check. As soon a I found out how to download the server certificate and check it in the correct way I will let you know in an update.

This script is part of my scripts collection, so you can find the latest version at http://bitbucket.org/andunix/scripts/src/tip/bin/cron-dyndns-update.

You can find the DynDNS protocol specification at http://www.dyndns.com/developers/specs/syntax.html.