Community discussions

MikroTik App
 
robertbreese
just joined
Topic Author
Posts: 6
Joined: Thu May 13, 2021 1:23 am

Trying to get DynU DynamicDNS script working

Thu May 13, 2021 4:39 am

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?
 
elico
Member Candidate
Member Candidate
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: Trying to get DynU DynamicDNS script working

Thu May 13, 2021 3:10 pm

Do you still need help with this?
 
robertbreese
just joined
Topic Author
Posts: 6
Joined: Thu May 13, 2021 1:23 am

Re: Trying to get DynU DynamicDNS script working

Fri May 14, 2021 1:20 am

Got it working by adding MikroTiks built in cloud hostname to the cname DNS record on dynu. Also had to disable the a record
 
Sela69
just joined
Posts: 9
Joined: Mon Sep 27, 2021 11:19 pm

Re: Trying to get DynU DynamicDNS script working

Tue Feb 01, 2022 10:23 pm

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 ...
 
User avatar
mozerd
Forum Veteran
Forum Veteran
Posts: 872
Joined: Thu Oct 05, 2017 3:39 pm
Location: Canada
Contact:

Re: Trying to get DynU DynamicDNS script working

Tue Feb 01, 2022 10:53 pm

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"
 
Sela69
just joined
Posts: 9
Joined: Mon Sep 27, 2021 11:19 pm

Re: Trying to get DynU DynamicDNS script working

Tue Feb 01, 2022 11:16 pm

Hi, first of all thank you for answering me,

It does work (or at least it seems to me !)
 
User avatar
Shahid
newbie
Posts: 25
Joined: Sat Nov 05, 2016 3:31 am
Location: Multan, Pakistan
Contact:

Re: Trying to get DynU DynamicDNS script working

Sun Oct 09, 2022 1:12 am

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";
} }
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Trying to get DynU DynamicDNS script working

Sun Oct 09, 2022 2:14 am

Better do some cleaning up on that mess, including removing the useless logging...
viewtopic.php?p=961067#p961068
 
User avatar
Shahid
newbie
Posts: 25
Joined: Sat Nov 05, 2016 3:31 am
Location: Multan, Pakistan
Contact:

Re: Trying to get DynU DynamicDNS script working

Sun Oct 09, 2022 9:49 am

Better do some cleaning up on that mess, including removing the useless logging...
viewtopic.php?p=961067#p961068
Logging is very helpful for newbies. It helps a lot to understand what is going on.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Trying to get DynU DynamicDNS script working

Sun Oct 09, 2022 2:46 pm

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.. ;)
 
User avatar
r0berts
newbie
Posts: 49
Joined: Mon Jul 30, 2018 3:29 pm

Re: Trying to get DynU DynamicDNS script working

Sat Jun 17, 2023 12:23 pm

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
 
optio
Long time Member
Long time Member
Posts: 655
Joined: Mon Dec 26, 2022 2:57 pm

Re: Trying to get DynU DynamicDNS script working

Sat Jun 17, 2023 4:16 pm

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.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Trying to get DynU DynamicDNS script working

Sat Jun 17, 2023 8:26 pm

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.
 
User avatar
r0berts
newbie
Posts: 49
Joined: Mon Jul 30, 2018 3:29 pm

Re: Trying to get DynU DynamicDNS script working

Sat Jun 17, 2023 8:54 pm

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

Who is online

Users browsing this forum: No registered users and 23 guests