{"id":542,"date":"2014-01-28T12:29:57","date_gmt":"2014-01-28T17:29:57","guid":{"rendered":"http:\/\/otac.isa-geek.net\/blog\/?p=542"},"modified":"2014-01-28T12:44:17","modified_gmt":"2014-01-28T17:44:17","slug":"avoiding-the-dreaded-dyn-denial","status":"publish","type":"post","link":"https:\/\/otac.isa-geek.net\/blog\/?p=542","title":{"rendered":"Avoiding the Dreaded Dyn Denial"},"content":{"rendered":"<p>I&#8217;ve been a user of <a href=\"http:\/\/dydns.com\">DynDNS<\/a> for my dynamic dns needs over a decade, and it&#8217;s a been a great way to maintain an online web presence, even when all I had was a sporadic dial-up account to <a href=\"http:\/\/en.wikipedia.org\/wiki\/LIME_(Cable_%26_Wireless)\">TOJ<\/a> (OG Jamaican developers know what I mean). This site has been on Dyn almost since they first started providing free dynamic dns accounts.<br \/>\nImagine my chagrin to be informed that DynDNS is reducing the number and type of free accounts that they provide, and in order to maintain your free account, you<a href=\"http:\/\/dyn.com\/legal\/account-ownership-and-recovery-policy\/\"> must sign in to the DynDNS web porta<\/a>l at least once a month! This is in addition to the already existing condition that your dynamic dns ip has to be updated monthly in order to keep the account alive. Not such great news &#8211; who is going to remember to manually login to a web page every month? (That may be the point, since once your free account expires, you are encouraged to buy a premium account).<br \/>\nI&#8217;ve copied some other online resources and tweaked them a bit for an automated mechanism that signs in to DynDNS and sends a quick email to notify you that all is well (or not).<\/p>\n<p>Here&#8217;s the details:<br \/>\n<strong>dyn_account_check.ksh<\/strong><\/p>\n<h6>#!\/bin\/bash<br \/>\n################################################<br \/>\n#<br \/>\n# dyndnslogin<br \/>\n# Automate login to prevent account expiration<br \/>\n#<br \/>\n################################################<br \/>\n# DynDNS Settings<br \/>\nUSERNAME=`cat ~\/.dyn_account_info`<br \/>\nPASSWORD=`echo $USERNAME|cut -f2 -d&#8217; &#8216;`<br \/>\nUSERNAME=`echo $USERNAME|cut -f1 -d&#8217; &#8216;`<br \/>\n################################################<br \/>\n# Variabeln PROGNAME=dyndnslogin<br \/>\nCOOKIE=`mktemp &#8211;tmpdir=&#8221;\/tmp&#8221; -t ${PROGNAME}_cookie_***XXXX`<br \/>\nOUTPUT=`mktemp &#8211;tmpdir=&#8221;\/tmp&#8221; -t ${PROGNAME}_output_***XXXX`<br \/>\nUSERAGENT=&#8221;Mozilla\/5.0&#8243;<br \/>\nERROR_RECIPIENTS=duane.cato@eschateq.com,duanecato@yahoo.com,duane.cato@gmail.com<br \/>\n################################################<br \/>\n# Main<\/h6>\n<h6>MULTIFORM=`curl -s -k -A $USERAGENT -c $COOKIE https:\/\/account.dyn.com \\ | awk &#8211;<br \/>\nF\\&#8217; &#8216;\/multiform\/{ print $6 }&#8217;`<\/h6>\n<h6>curl -s -k &#8211;location -A &#8220;$USERAGENT&#8221; -b $COOKIE -c $COOKIE -o $OUTPUT \\&#8211;data &#8221;<br \/>\nusername=$USERNAME&amp;password=$PASSWORD&amp;iov_id=&amp;sub mit=Log+in&amp;multiform=$MULTIFORM&#8221; \\https:\/\/account.dyn.com\/<\/h6>\n<h6>#get just the user portion<br \/>\nUSER_PFX=`echo $USERNAME |cut -f1 -d&#8217;@&#8217;`<br \/>\nif grep -E -i &#8220;(Welcome|Hi).*$USER_PFX&#8221; $OUTPUT &gt; \/dev\/null 2&gt;&amp;1<br \/>\nthen<br \/>\necho &#8220;`date`: Dyn Login successful&#8221;<br \/>\necho &#8220;`date`: Dyn Login successful&#8221; &gt; \/tmp\/empty.txt<br \/>\nmailx -s &#8220;`date`: Dyn Login successful&#8221; -a $OUTPUT &lt; \/tmp\/empty.txt $ERROR_RE CIPIENTS else echo &#8220;`date`: Dyn Login failed&#8221; echo &#8220;`date`: Dyn Login failed&#8221; &gt; \/tmp\/empty.txt<br \/>\nmailx -s &#8220;`date`: Dyn Login failed&#8221; -a $OUTPUT &lt; \/tmp\/empty.txt $ERROR_RECIPIENTS<br \/>\nFAILED=&#8221;true&#8221;<br \/>\nfi<\/h6>\n<h6>rm $COOKIE<br \/>\nrm $OUTPUT<\/h6>\n<h6>if [ &#8220;$FAILED&#8221; = &#8220;true&#8221; ]<br \/>\nthen<br \/>\nexit 1<br \/>\nfi<br \/>\n# EOF<\/h6>\n<p>Pretty straight forward, I added a little bit of security obfuscation and notification logic, but this is mostly ripped from <a href=\"http:\/\/www.stoufis.gr\/blog\/topics\/2010\">someone else<\/a> &#8211; many thanks!\u00a0Stick a call to this script in your crontab (or other scheduling solution).\u00a0Hopefully, this helps others keep their free DynDNS going smoothly. On a side note, after looking through Dyns&#8217; offerings, I realized they are quite cost competitive in their provision of domain and mail delegation services, and ended up going with them for another project. When possible, I may speak a little on using them as a pluggable cloud-based enterprise infrastructure component &#8211; I had a very positive experience. More to come.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been a user of DynDNS for my dynamic dns needs over a decade, and it&#8217;s a been a great way to maintain an online web presence, even when all I had was a sporadic dial-up account to TOJ (OG Jamaican developers know what I mean). This site has been on Dyn almost since they [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,8],"tags":[],"class_list":["post-542","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"_links":{"self":[{"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=542"}],"version-history":[{"count":11,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/542\/revisions"}],"predecessor-version":[{"id":558,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/542\/revisions\/558"}],"wp:attachment":[{"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otac.isa-geek.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}