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: 6/7/2018 |
Developing a perl program to update my IP address Tuesday, July 17, 2018 4:06 PM
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: 6/23/2017 |
Developing a perl program to update my IP address Tuesday, July 17, 2018 11:27 PM
The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
|
anthonywebuser Joined: 6/23/2017 |
Developing a perl program to update my IP address Tuesday, July 17, 2018 11:29 PM
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: 6/7/2018 |
Developing a perl program to update my IP address Wednesday, July 18, 2018 1:01 AM
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: 6/7/2018 |
Developing a perl program to update my IP address Wednesday, July 18, 2018 1:19 PM
|
It is currently Tuesday, November 26, 2024 8:19 PM US Mountain Standard Time
Tuesday, November 26, 2024 8:19 PM