I recently set-up a DynDNS Server on my own VPS. To prevent anybody except me updating the ip adress for a subdomain I used a .htaccess file with username and password input.
Is the RouterOS scripting language capable of sending input to the form that shows up when accessing the update url?
Here's an example script I found on the internet.
Code: Select all
:global ddnsuser "xxxxxxxxxxx"
:global ddnspass "xxxxxxxxxxx"
:global theinterface "pppoe-out1"
:global ddnshost1 "xxx.domain.com"
:global ipddns
:global ipfresh [/ip address get [find where interface=$theinterface] value-name=address]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("DynDNS: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("DynDNS: IP-DynDNS = $ipddns")
:log info ("DynDNS: IP-Fresh = $ipfresh")
:log info "DynDNS: Update IP needed, Sending UPDATE...!"
:global str1 "/update/\?username=$ddnsuser&password=$ddnspass&domain=mysubdomain&ip=$ipfresh"
/tool fetch address=dyndns.formality.de src-path=$str1 mode=https dst-path=("/DynDNS.".$ddnshost1)
:delay 1
:global str1 [/file find name="DynDNS.$ddnshost1"];
/file remove $str1
:global ipddns $ipfresh
:log info "DynDNS: IP updated to $ipfresh!"
} else={
:log info "DynDNS: dont need changes";
}
}
Thanks in advance!