Page 1 of 1
Trying to get DynU DynamicDNS script working
Posted: Thu May 13, 2021 4:39 am
by robertbreese
https://www.dynu.com/DynamicDNS/IPUpdat ... ynamic-DNS
Trying to get this script working with my hAP AC2. All the info is filled in properly, I have tested on my openwrt. When I use winbox and paste it in the script box, then hit run, nothing happens. When I check the logs, there still absolutely nothing. I have tried telnetting in and running the script but it doesn't paste properly. I suppose I could try from web interface terminal?
Re: Trying to get DynU DynamicDNS script working
Posted: Thu May 13, 2021 3:10 pm
by elico
Do you still need help with this?
Re: Trying to get DynU DynamicDNS script working
Posted: Fri May 14, 2021 1:20 am
by robertbreese
Got it working by adding MikroTiks built in cloud hostname to the cname DNS record on dynu. Also had to disable the a record
Re: Trying to get DynU DynamicDNS script working
Posted: Tue Feb 01, 2022 10:23 pm
by Sela69
https://www.dynu.com/DynamicDNS/IPUpdat ... ynamic-DNS
Trying to get this script working with my hAP AC2. All the info is filled in properly, I have tested on my openwrt. When I use winbox and paste it in the script box, then hit run, nothing happens. When I check the logs, there still absolutely nothing. I have tried telnetting in and running the script but it doesn't paste properly. I suppose I could try from web interface terminal?
Hi , is there anyone able to run this script provided by dynu ? I'm on 7.1.1 stable and even if I run the script apparently nothing happens. No logs so I'm guessing that is not running ...
Re: Trying to get DynU DynamicDNS script working
Posted: Tue Feb 01, 2022 10:53 pm
by mozerd
Hi , is there anyone able to run this script provided by dynu ? I'm on 7.1.1 stable and even if I run the script apparently nothing happens. No logs so I'm guessing that is not running ...
I use dynu and the following script works in RoS 7.xxx
I have identified the following parameters that you must change to your data by using
search and replace,
When you do the search and replace make sure to not copy the "blank spaces at the beginning or end of each term"
1. owner=XXXXXXXXXX [your Tik admin account name]
2. ddnsuser \"idIDidIDid\" [your dynu account name]
3. ddnspass \"pwdpwdpwdpwdpwdpwd\" [your dynu account passwors]
4. theinterface \"ether#\" [Yout Tik WAN interface usually ether1]
5. ddnshost \"nnnnnnnnn.myddns.sssss\" [your Dynu host name you chose]
------------------------------------------------------------
/system script add dont-require-permissions=no name=Dynu owner=XXXXXXXXXX policy=read,write,policy,test source=":global ddnsuser \"idIDidIDid\"\
\n:global ddnspass \"pwdpwdpwdpwdpwdpwd\"\
\n:global theinterface \"ether#\"\
\n:global ddnshost \"nnnnnnnnn.myddns.sssss\"\
\n:global ipddns [:resolve \$ddnshost];\
\n:global ipfresh [ /ip address get [/ip address find interface=\$theinterface ] address ]\
\n:if ([ :typeof \$ipfresh ] = nil ) do={\
\n:log info (\"DynuDDNS: No IP address on \$theinterface .\")\
\n} else={\
\n:for i from=( [:len \$ipfresh] - 1) to=0 do={\
\n:if ( [:pick \$ipfresh \$i] = \"/\") do={\
\n:set ipfresh [:pick \$ipfresh 0 \$i];\
\n}\
\n}\
\n:if (\$ipddns != \$ipfresh) do={\
\n:log info (\"DynuDDNS: IP-Dynu = \$ipddns\")\
\n:log info (\"DynuDDNS: IP-Fresh = \$ipfresh\")\
\n:log info \"DynuDDNS: Update IP needed, Sending UPDATE...!\"\
\n:global str \"/nic/update\?hostname=\$ddnshost&myip=\$ipfresh\"\
\n/tool fetch address=api.dynu.com src-path=\$str mode=http user=\$ddnsuser password=\$ddnspass dst-path=(\"/Dynu.\".\$ddnshost)\
\n:delay 1\
\n:global str [/file find name=\"Dynu.\$ddnshost\"];\
\n/file remove \$str\
\n:global ipddns \$ipfresh\
\n:log info \"DynuDDNS: IP updated to \$ipfresh!\"\
\n} else={\
\n:log info \"DynuDDNS: does not need changes\";\
\n} }\
\n\r\
\n"
Re: Trying to get DynU DynamicDNS script working
Posted: Tue Feb 01, 2022 11:16 pm
by Sela69
Hi, first of all thank you for answering me,
It does work (or at least it seems to me !)
Re: Trying to get DynU DynamicDNS script working
Posted: Sun Oct 09, 2022 1:12 am
by Shahid
Latest Updated Script Working on Mikrotik v 7.5
/tool fetch mode=http url="http://api.ipify.org" src-path="" dst-path=/dyn.html
:local currentIP [/file get dyn.html contents]
:log warning "Public IP Detected $currentIP"
######################################################
:global ddnsuser "username"
:global ddnspass "password"
:global ddnshost "host.mywire.org"
:global ipddns [:resolve $ddnshost];
:log warning "Current DNS $ipddns"
/file/remove dyn.html
:if ($ipddns != $currentIP) do={
:log warning ("Updating IP = $currentIP")
:global str "/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP"
/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $currentIP
:log info "DynuDDNS: IP updated to $currentIP!"
} else={
:log info "No Need to change, IP Already Updated";
} }
Re: Trying to get DynU DynamicDNS script working
Posted: Sun Oct 09, 2022 2:14 am
by rextended
Better do some cleaning up on that mess, including removing the useless logging...
viewtopic.php?p=961067#p961068
Re: Trying to get DynU DynamicDNS script working
Posted: Sun Oct 09, 2022 9:49 am
by Shahid
Logging is very helpful for newbies. It helps a lot to understand what is going on.
Re: Trying to get DynU DynamicDNS script working
Posted: Sun Oct 09, 2022 2:46 pm
by rextended
Logging is very helpful for newbies. It helps a lot to understand what is going on.
Is rigth, but excessive logging, after the script works, do the opposite..
Re: Trying to get DynU DynamicDNS script working
Posted: Sat Jun 17, 2023 12:23 pm
by r0berts
Query on security:
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Many thanks,
Roberts
Re: Trying to get DynU DynamicDNS script working
Posted: Sat Jun 17, 2023 4:16 pm
by optio
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Because there is no difference when sending as URL parameters or POST/PUT body, both can be read if you intercept traffic. GET request is more convinant since you don't need to create body which complicates creating HTTP request, depending which HTTP client is used and system. Safety concern regarding GET request is when URL logging, history, analytics... is involved, like browser history, it is better to avoid performing such requests with credentials in URL directly in browser without private mode or you will need to manually clear history.
Re: Trying to get DynU DynamicDNS script working
Posted: Sat Jun 17, 2023 8:26 pm
by rextended
Query on security:
Could someone explain to me please, why it is safe to send username and password as GET parameters?
?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP
Many thanks,
Roberts
Since the mode is httpS, it is impossible to detect the URL on both GET and POST.
Re: Trying to get DynU DynamicDNS script working
Posted: Sat Jun 17, 2023 8:54 pm
by r0berts
Thanks Optio and Rextended,
If I understand correctly, then the router makes a https request and as long the line for connection to api says so, it is safe
/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost)
The $str variable contains the sensitive information, but because mode is https, we are safe from network monitoring.
I think what confused me was someone in a script above wrote:
\n/tool fetch address=api.dynu.com src-path=\$str mode=http user=\$ddnsuser password=\$ddnspass dst-path=(\"/Dynu.\".\$ddnshost)\
and I thought - what if the api server (for performance reasons) only accepts http connections.
Thanks again,
Roberts