notes on javascript, linux, and more

8.11.2008

Preventing DynDNS.org update abuse

I have been using the free service at www.dyndns.org to keep tabs on my home server's IP address. However, I replaced my wireless/ethernet router, and the new one did not have built in dyndns.org updating, as my old one did.

I decided to use a software solution on my Debian based server. At first, I tried ddclient, but for some reason, it would stop sending updates after a few hours. Then I tried inadyn, but that caused my hostnames to get flagged for abuse. It seemed that neither of the tools was correctly checking the IP address before attempting to make the update, they were just sending the updates periodically even when my IP hadn't changed. This violates dyndns.org's abuse policy, so I just decided to write a simple wrapper script.

#!/bin/bash
DYNIP=`host foo.example.com`
DYNIP=${DYNIP#* has address }

wget -O- http://www.whatismyip.org/ 2>/dev/null > /tmp/currentip

echo current ip\: `cat /tmp/currentip`
echo ip on file\: $DYNIP

if [[ \"`cat /tmp/currentip`\" = *\"$DYNIP\"* ]]; then
echo "ip is up to date"
else
echo "must update"
/usr/sbin/inadyn
fi

rm /tmp/currentip



then i set up inadyn as follows:

# /etc/inadyn.conf

--username myuser --password mypass --alias foo.example.com --iterations 1



So now I just have my script running as a cron job once every hour. From my understanding, I shouldn't need this wrapper, but both inadyn and ddclient were mysterously updating my hostname mapping when they shouldn't have. I could very well have configured them wrong, but things looked ok to me and this solution works, so I'll let it be.

No comments:

About Me

My photo
chicago, il, United States
I'm a software engineer by profession.

Labels