[Not Solved]
May 21, 2016, 09:14 PM
(This post was last modified: May 27, 2016, 02:11 PM by Yveske.)
So right now godaddy.com has a promotion, € 0,99 for any .com webadres. So this way instead of name.dyndns.com you can have name.com. Another reason and why I did it is that you can have a free ssl certificate from startssl so you won’t have any untrusted website warnings anymore like you have with your self signed certificate. Anyway it’s just cooler and better to have your own web address
The problem is that most of us have a dynamic ip address which changes now and then and godaddy doesn’t have the option to automatically change the ip address where to direct to.
So we are going to have our device do it with godaddypi. Here is how:
If you haven’t already before, install python and pip:
Install pif and godaddypy:
Now go to https://developer.godaddy.com/keys/ and generate a api key.
Now we make the script that will run the program:
Paste this code, just change 'here-comes-you-public-api-key' and 'here-comes-you-secret-api-key' to your just generated key and secret:
Save and close it and then give it the right permission:
Now run the program:
If it works you will see:
And now, in your godaddy DNS configuration, you will see that the ip address has changed to your outside ip address. If you want to make sure it’s the same, run:
to know your own ip address.
Now we know that it works we are going to make it run automatic and because we never know when it will change, we let it run every 5 minutes. We will do this with a cron job:
At the bottom of the file add:
Save and close the file and restart cron:
If you want to let it run more or less look into this wiki page to learn more about setting up a cron job.
So now every time your outside ip address changes it will be adjusted in your godaddy account within 5 minutes.
Don’t forget to add both www and non-www domain name to all your nginx files and now you can get a free ssl certificate with startssl.
The problem is that most of us have a dynamic ip address which changes now and then and godaddy doesn’t have the option to automatically change the ip address where to direct to.
So we are going to have our device do it with godaddypi. Here is how:
If you haven’t already before, install python and pip:
Code:
sudo apt-get install python python-pip
Install pif and godaddypy:
Code:
sudo pip install pif
sudo pip install godaddypy
Now go to https://developer.godaddy.com/keys/ and generate a api key.
Now we make the script that will run the program:
Code:
nano /usr/local/lib/python2.7/dist-packages/godaddypy/ipupdater.py
Paste this code, just change 'here-comes-you-public-api-key' and 'here-comes-you-secret-api-key' to your just generated key and secret:
Code:
#!/usr/bin/env python
# Full package imports
import pif, sys
# Partial imports
from godaddypy import Client, Account
userAccount = Account(api_key='here-comes-you-public-api-key', api_secret='here-comes-you-secret-api-key')
userClient = Client(userAccount)
publicIP = pif.get_public_ip('ident.me')
if publicIP is None or publicIP is False:
print('Unable to retrieve an IP from pif, exiting...')
sys.exit()
# Updates all domains all records
try:
updateResult = userClient.update_ip(publicIP)
except:
print(sys.exc_info()[1])
sys.exit()
if updateResult is True:
print('Update ended with no Exception.')
Save and close it and then give it the right permission:
Code:
sudo chmod -x /usr/local/lib/python2.7/dist-packages/godaddypy/ipupdater.py
Now run the program:
Code:
sudo python /usr/local/lib/python2.7/dist-packages/godaddypy/ipupdater.py
If it works you will see:
Code:
Update ended with no Exception.
And now, in your godaddy DNS configuration, you will see that the ip address has changed to your outside ip address. If you want to make sure it’s the same, run:
Code:
wget http://ipecho.net/plain -O - -q ; echo
Now we know that it works we are going to make it run automatic and because we never know when it will change, we let it run every 5 minutes. We will do this with a cron job:
Code:
sudo crontab -e
At the bottom of the file add:
Code:
*/5 * * * * sudo python /usr/local/lib/python2.7/dist-packages/godaddypy/ipupdater.py
Save and close the file and restart cron:
Code:
sudo service cron restart
If you want to let it run more or less look into this wiki page to learn more about setting up a cron job.
So now every time your outside ip address changes it will be adjusted in your godaddy account within 5 minutes.
Don’t forget to add both www and non-www domain name to all your nginx files and now you can get a free ssl certificate with startssl.