Community discussions

MikroTik App
 
Timmske
just joined
Topic Author
Posts: 3
Joined: Sun Aug 11, 2019 12:28 am

.htaccess input for DynDNS Update

Fri Jul 24, 2020 5:48 pm

Hello everybody,

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.
: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";
    }
}
I would really appreciate some help :)
Thanks in advance!
 
User avatar
Bongo
newbie
Posts: 37
Joined: Thu Aug 11, 2011 4:28 am

Re: .htaccess input for DynDNS Update

Fri Jan 08, 2021 1:30 am

hi, if im correct, you only want your router/ip to update to your host?

if so, easiest is edit htaccess and deny all & allow yourself only ( your internet IP only )

and yes it will accept username & password also

#######################
order deny,allow
deny from all
allow from <your ip>
#######################

i would like to ask if you can share your ddns host server setup

Who is online

Users browsing this forum: No registered users and 24 guests