May 15 2013
Dyn SLA Update – or, How To Lose Friends and Alienate Customers
I today received an email from Dyn (previously DynDNS), stating:
Starting now, if you would like to maintain your free Dyn account, you must log into your account once a month. Failure to do so will result in expiration and loss of your hostname. Note that using an update client will no longer suffice for this monthly login.
(emphasis theirs)
Now, if this were a service which requires interaction then this would be an unfriendly but potentially fair way to weed-out inactive accounts. This isn’t one of those cases, though – I can happily go for months or even years where my only interaction with Dyn(DNS) is via auto-update clients. And this is the heart of the problem – many routers and embedded devices have built-in DynDNS clients, frequently with no option to switch to an alternative service. Possibly this is worth $25/year, possibly it isn’t. Personally, I’m not paying a penny to a company trying to hold its users to ransom like this. For my usage, there are a handful for hostnames in a Dyn(DNS) domain – and therefore these cannot to transferred to a different provider. I keep them going purely so that historic links will still work.
And, to resolve the immediate problem, I wrote this script which can be scheduled to run every 15 days in order to keep my account active – enjoy!
#!/bin/bash LOGIN="****" PASSWORD="****" COOKIES="/tmp/.dynsdns.cookies.txt" AL="en-gb" #UA="Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/0.0.0 (KHTML, like Gecko) Version/0.0.0 Safari/0.0.0" LOGINURL="https://account.dyn.com/entrance/" POSTURL="$LOGINURL" CHKURL="https://account.dyn.com/" (( DEBUG )) && DST="-" || DST="/dev/null" [[ -w "$( dirname "$COOKIES" )" ]] || { echo >&2 "FATAL: Cannot write to directory '$( dirname "$COOKIES" )'" ; exit 1; } # Ensure no broken session caching... if [[ -s "$COOKIES" ]]; then [[ -w "$COOKIES" ]] || { echo >&2 "FATAL: Cannot write to file '$COOKIES'" ; exit 1 ; } rm -f "$COOKIES" >/dev/null 2>&1 fi (( DEBUG )) && echo >&2 "DEBUG: Fetching initial headers to pre-load cookies..." curl -b $COOKIES -c $COOKIES -Ikso "$DST" -A "$UA" --url "$LOGINURL" (( DEBUG )) && echo >&2 "DEBUG: Fetching UID..." VALUE="$( curl -b $COOKIES -c $COOKIES -kso - -A "$UA" --url "$LOGINURL" | \ grep -m 1 "multiform" | \ cut -d"'" -f 6 )" (( DEBUG )) && echo >&2 "DEBUG: Read UID as '$VALUE' - posting data..." curl -b $COOKIES -c $COOKIES -d "username=$LOGIN" -d "password=$PASSWORD" -d "iov_id" -d "multiform=$VALUE" -e "$LOGINURL" -kso "$DST" -A "$UA" --url "$POSTURL" (( DEBUG )) && echo >&2 "DEBUG: Response received - verifying result..." curl -b $COOKIES -c $COOKIES -e "$POSTURL" -kso - -A "$UA" -H "Accept-Language: $AL" --url "$CHKURL" | \ grep -qE "<span>(Welcome|Hi) <b>$LOGIN</b></span>" \ && echo "Login successful" \ || { echo >&2 "Login failed" ; exit 1 ; } exit 0
Download this script from http://files.stuart.shelton.me/unix/dyndns-login.sh.
Trent
16th May 2013 @ 6:41 am
Thank you so much for this.
I don’t know much about this, but could you please explain how one initialises this fantastic script you have created please? I’d like to use it myself, but am unsure as to how.
Thank you kindly
Trent
Martin
17th May 2013 @ 12:37 am
Awesome script, thanks! Sadly, DYN is more and more unfriendly to legacy free accounts. I also have one with hostnames I would hate to lose.
Noone
17th May 2013 @ 10:21 am
great job, i would be pelased if you could publish a windows dos batch version with cURL of this.
Martin
17th May 2013 @ 6:42 pm
@Trent. You schedule the script to run from crontab. Obviously, it assumes a Linux box or unix-like OS (like apple).
fermulator
18th May 2013 @ 8:26 pm
Hey it looks like your script was truncated? (the last line seems to just … stop … without the closing double quote)
Kril
18th May 2013 @ 8:52 pm
Thanks man.
Works perfect, now scheduled on dd-wrt
Stuart
19th May 2013 @ 1:40 pm
@fermulator – Looks okay to me… perhaps a copy/paste problem?
Try downloading from this link:
http://files.stuart.shelton.me/unix/dyndns-login.sh
fermulator
19th May 2013 @ 4:15 pm
Thanks! My mistake, I had scripts disabled so I couldn’t see the full script.
Note, since the impact to this /failing/ is so drastic, I strongly recommend, as part of the cron job people create, that they ALSO send an e-mail on FAIL.
For example:
fermulator
19th May 2013 @ 4:16 pm
(if you need help setting up msmtp from a linux server, I have it documented here: http://ubuntuforums.org/showthread.php?t=1185134 — only do the /first/ section of the how to)
Stuart
19th May 2013 @ 4:46 pm
Personally, I’ve always like ‘ssmtp‘ as a simple one-line-configuration MTA…