Developing a perl program...
Developing a perl program to update my IP address
- Home
- Control Panel
- Community Forum
- General Discussion
- Developer Discussion
- Developing a perl program to update my IP address
- Community Forum
- Developing a perl program to update my IP address
Topic: Developing a perl program to update my IP address
I've written a simple perl program to run as a cron job every 20 minutes and there's something I can't figure out.I'm basically using wget to request an update using the IP update protocol found here:https://www.dynu.com/en-US/DynamicDNS/IP-Update-ProtocolThe script basically does this:wget --tries=1 --timeout=10 -P /tmp "https://api.dynu.com/nic/update?hostname=dynu.net&alias=MYDOMAINNAME&password=MD5SUM_PASSWORD" (wget is a simple program that allows you to basically download web pages, like a very primitive web browser)And this works perfectly fine, on my machine, at my desk, at home - where my IP address hasn't changed in a few months.However, if I do the same thing on another machine, with another IP address, I always get this following response:badauthWhy am I getting a badauth? Why does this only work on my machine at home? Why am I doing this? I'm trying to invalidate the IP address by updating it just to test the script.This happens if I enter that URL in a web-browser too. Why won't it update the IP address? I certainly have the correct domain name, and password.The script checks to see if the IP address may have changed, by accessing a web browser file, so it actually only connects to https://api.dynu.com ONLY IF, this file is inaccessible (i.e. the IP address has changed) - so I should be not be seen as being abuse. My goal is to update ONLY when the IP address has changed to reduce traffic to api.dynu.com.Also, if you want, I'll give you the perl script, but it's dependent on you running a webserver, and having /home/${USER}/public_html accessible as it's currently written, and you having a valid TLS certificate.
Reply with quote | Report
The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
Reply with quote | Report
https://api.dynu.com/nic/update?hostname=sth.dynu.net&alias=MYDOMAINNAME&password=MD5SUM_PASSWORD if you have a subdomain for sth.dynu.net and the subdomain is MYDOMAINNAME.sth.dynu.net.
Reply with quote | Report
Ohhhhh, I think I got it. I didn't quite understand what a subdomain was. I wonder why it works on the computer that has the current IP address/domain name set?Let me see if I have time to fix it tomorrow, then I'll post a link to the perl script if anybody wants it. Um, I'll make it a BSD license, or whatever. May as well set it up to work with either HTTPS or HTTP, and not require /home/*/public_html to be present. Probably be useful to more people if I did that.
Reply with quote | Report
anthonywebuser wrote:The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
Reply with quote | Report
Author | Topic: Developing a perl program to update my IP address |
---|---|
richwicks Joined: 07/06/2018 |
Developing a perl program to update my IP address 17 July 2018 16:06
I've written a simple perl program to run as a cron job every 20 minutes and there's something I can't figure out.I'm basically using wget to request an update using the IP update protocol found here:https://www.dynu.com/en-US/DynamicDNS/IP-Update-ProtocolThe script basically does this:wget --tries=1 --timeout=10 -P /tmp "https://api.dynu.com/nic/update?hostname=dynu.net&alias=MYDOMAINNAME&password=MD5SUM_PASSWORD" (wget is a simple program that allows you to basically download web pages, like a very primitive web browser)And this works perfectly fine, on my machine, at my desk, at home - where my IP address hasn't changed in a few months.However, if I do the same thing on another machine, with another IP address, I always get this following response:badauthWhy am I getting a badauth? Why does this only work on my machine at home? Why am I doing this? I'm trying to invalidate the IP address by updating it just to test the script.This happens if I enter that URL in a web-browser too. Why won't it update the IP address? I certainly have the correct domain name, and password.The script checks to see if the IP address may have changed, by accessing a web browser file, so it actually only connects to https://api.dynu.com ONLY IF, this file is inaccessible (i.e. the IP address has changed) - so I should be not be seen as being abuse. My goal is to update ONLY when the IP address has changed to reduce traffic to api.dynu.com.Also, if you want, I'll give you the perl script, but it's dependent on you running a webserver, and having /home/${USER}/public_html accessible as it's currently written, and you having a valid TLS certificate.
|
anthonywebuser Joined: 23/06/2017 |
Developing a perl program to update my IP address 17 July 2018 23:27
The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
|
anthonywebuser Joined: 23/06/2017 |
Developing a perl program to update my IP address 17 July 2018 23:29
https://api.dynu.com/nic/update?hostname=sth.dynu.net&alias=MYDOMAINNAME&password=MD5SUM_PASSWORD if you have a subdomain for sth.dynu.net and the subdomain is MYDOMAINNAME.sth.dynu.net.
|
richwicks Joined: 07/06/2018 |
Developing a perl program to update my IP address 18 July 2018 01:01
Ohhhhh, I think I got it. I didn't quite understand what a subdomain was. I wonder why it works on the computer that has the current IP address/domain name set?Let me see if I have time to fix it tomorrow, then I'll post a link to the perl script if anybody wants it. Um, I'll make it a BSD license, or whatever. May as well set it up to work with either HTTPS or HTTP, and not require /home/*/public_html to be present. Probably be useful to more people if I did that.
|
richwicks Joined: 07/06/2018 |
Developing a perl program to update my IP address 18 July 2018 13:19
|
It is currently 26 December 2024 19:05 US Mountain Standard Time
26 December 2024 19:05