Developing a perl program...
Developing a perl program to update my IP address
- Casa
- Pannello di controllo
- Forum della Comunità
- General Discussion
- Developer Discussion
- Developing a perl program to update my IP address
- Forum della Comunità
- Developing a perl program to update my IP address
Argomento: 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.
Rispondi con citazione | Segnalare
The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
Rispondi con citazione | Segnalare
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.
Rispondi con citazione | Segnalare
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.
Rispondi con citazione | Segnalare
anthonywebuser wrote:The update URL should be corrected to the below:https://api.dynu.com/nic/update?hostname=yourname.dynu.net&password=MD5SUM_PASSWORD
Rispondi con citazione | Segnalare
Autore | Argomento: Developing a perl program to update my IP address |
---|---|
richwicks Iscritto: 07/06/2018 |
Developing a perl program to update my IP address martedì 17 luglio 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 Iscritto: 23/06/2017 |
Developing a perl program to update my IP address martedì 17 luglio 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 Iscritto: 23/06/2017 |
Developing a perl program to update my IP address martedì 17 luglio 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 Iscritto: 07/06/2018 |
Developing a perl program to update my IP address mercoledì 18 luglio 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 Iscritto: 07/06/2018 |
Developing a perl program to update my IP address mercoledì 18 luglio 2018 13:19
|
Al momento è venerdì 22 novembre 2024 04:55 US Mountain Standard Time
venerdì 22 novembre 2024 04:55