DynDns keep an active account with autologin

DynDns now requires users with free accounts to login every 30 days in order to keep their accounts... painful. Here is how to overcome the manual login using a scheduled auto-login script developed by kopf (thanks!).

1. Install python-mechanize which is a python module for navigating through web forms. On Ubuntu/Debian this can be done as follow:
sudo apt-get install python-mechanize

2. Create a new python script:
vi chmod 555 dyndns-autologin.py

with the contents as provided by kopf here:
https://github.com/kopf/dyndns-autologin/blob/master/autologin.py

Which is kindly made available to Kopf for use under the Apache licence here.

3. Make the script executable and read only
chmod 555 dyndns-autologin.py

4. Create and store your login details in settings.py
vi settings.py

!! CAUTION THIS STEP STORES YOUR PASSWORD IN THE CLEAR !!
In order to login to DynDns the script needs your credentials, they are stored in the clear, unencrypted. I do not mind this as I use a unique password for DynDns and I consider DynDns as a 'low value' service from a security perspective so if the password is compromised I personally would not be worried. 

with the contents:
USERNAME = 'your DynDns username'
PASSWORD = 'your DynDns password'

You may want to set the settings file to not be readable using a chmod 000 mask. This may cause issues when creating a scheduled job with cron see step 6, depending on your user account setups.

5. Test the script by typing into the terminal:
python /pathtoscript/dyndns-autologin.py

If the script is successful you should see the following outputs:
 Logged in successfully.

6. Set the script up to log in on a weekly basis using job scheduler cron:
crontab -e

Select your preferred editor and add the following line to create your cron job
@weekly /pathtoscript/dyndns-autologin.py #DynDns auto login

Credits:
https://github.com/kopf/dyndns-autologin thanks Kopf

No comments:

Post a Comment