[DDNS] reduce refresh time to 5 min and makes more secure

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page 1, 2, 3  Next
Author Message
MatteoDubai
DD-WRT Novice


Joined: 17 Feb 2021
Posts: 34

PostPosted: Sun Jan 02, 2022 16:59    Post subject: [DDNS] reduce refresh time to 5 min and makes more secure Reply with quote
I am setting up a DynDns with Dynu.com (used firmware: DD-WRT v3.0-r47911 std (12/23/21))

Everything works great, however, I have 2 questions:

1) How can I set up the refresh time for the IP to 5 min? I will need to have 1 router with DDWRT at home that will be the VPN server and 1 router in another country (where I live) with DDWRT that will be the VPN client. I will need to make sure that the server IP is refreshed every 5 min to be always updated. The minimum refresh time is 1 day on the configuration page in DDNS.

2) I followed the instructions on the Dynu website and as password I used the SHA256 instead of the password in the configuration, can I make the DDNS even more secure somehow?
The Dynu account is protected with a 20 chars random password tied to a Google account protected with 60 chars random password and 2FA.
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sun Jan 02, 2022 17:35    Post subject: Reply with quote
for almost all providers it is 600 sec see:
cat /tmp/ddns/inadyn.conf

the "--update_period_sec" will show the seconds between updates.
The value you are referring to is the forced update, it will update even if it is not necessary.

You can only change this value manually then kill the inadyn process but before you do that look at the way to restart it (ps from CLI) Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
MatteoDubai
DD-WRT Novice


Joined: 17 Feb 2021
Posts: 34

PostPosted: Sun Jan 02, 2022 17:40    Post subject: Reply with quote
Thank you for the quick reply.

Can I reboot the router to restart the process?

Regarding the security, can I do something to make it more secure? Exposing the DDNS and the VPN server over the internet I would like to make sure I have maximum security.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Mon Jan 03, 2022 10:32    Post subject: Reply with quote
MatteoDubai wrote:
Thank you for the quick reply.

Can I reboot the router to restart the process?

Regarding the security, can I do something to make it more secure? Exposing the DDNS and the VPN server over the internet I would like to make sure I have maximum security.


If you reboot the router the default values will return.
You have to start inadyn from the CLI.

How to do that is really easy just look at how it is normally started, from the CLI do: ps
That shows all the running processes and if you just copy the line for inadyn that is how you can start it again.

About security, your VPN server is secure (as long as you keep the keys secure)

If someone hijacks your DDNS account they can reroute your DDNS but without the proper keys you simply will not connect so although this qualifies as a DoS attack you are not compromised.
But of course it is good practice to secure your DDNS account with a strong and unique password

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 10:21    Post subject: Reply with quote
Could a command be programmed at router startup to change that value from 86400 to another value like 3600 for example?

could you make a scheduled cron job to force the ddns update?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sat Dec 09, 2023 10:32    Post subject: Reply with quote
spyfly wrote:
Could a command be programmed at router startup to change that value from 86400 to another value like 3600 for example?

could you make a scheduled cron job to force the ddns update?


Yes to both questions

The relevant part of the DDNS wiki (debug section) has just been updated see over there.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 10:41    Post subject: Reply with quote
I am checking https://wiki.dd-wrt.com/wiki/index.php/Dynamic_DNS#Debugging_your_configuration thank you

the option to force update faster (cad 3600 seconds) is very necessary, there is no sense in a 24 hours forced update, it is too much.
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2967
Location: Germany

PostPosted: Sat Dec 09, 2023 10:44    Post subject: Reply with quote
Do not do this, most dyndns providers have update policies

Spam leads to suspension of the account

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 10:48    Post subject: Reply with quote
Is it possible to do something like this?

1. Execute by hand:

cd /tmp/ddns
cp /tmp/ddns/inadyn.conf /jffs/inadyn.conf
vi /jffs/inadyn.conf



2. Save this script in the firewall so that it executes itself:

killall inadyn


inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /jffs/inadyn.conf -P /var/run/inadyn.pid -l info -t 30 -C
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sat Dec 09, 2023 10:54    Post subject: Reply with quote
spyfly wrote:
Is it possible to do something like this?

1. Execute by hand:

cd /tmp/ddns
cp /tmp/ddns/inadyn.conf /jffs/inadyn.conf
vi /jffs/inadyn.conf



2. Save this script in the firewall so that it executes itself:

killall inadyn


inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /jffs/inadyn.conf -P /var/run/inadyn.pid -l info -t 30 -C


why not just try it Smile

Be warned DDNS providers do not like it if you update frequently they might ban you.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 11:10    Post subject: Reply with quote
the theory was very nice but when I put it into practice it does not let me.

The command cp /tmp/ddns/inadyn.conf /jffs/inadyn.conf does not create a copy of the file. if once executed, I do
cd /jffs/
ls
I see that there are no files in that path

it also does not work to create the file by hand with:
vi /jffs/inadyn.conf
when I save it with ESC + :wq it tells me that it is read-only

even mkdir /jffs/ddns doesn't create the directory either

It is as if I cannot write to /jffs/.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sat Dec 09, 2023 11:25    Post subject: Reply with quote
spyfly wrote:
the theory was very nice but when I put it into practice it does not let me.

The command cp /tmp/ddns/inadyn.conf /jffs/inadyn.conf does not create a copy of the file. if once executed, I do
cd /jffs/
ls
I see that there are no files in that path

it also does not work to create the file by hand with:
vi /jffs/inadyn.conf
when I save it with ESC + :wq it tells me that it is read-only

even mkdir /jffs/ddns doesn't create the directory either

It is as if I cannot write to /jffs/.


Haha, if you do not have a writeable /jffs then you can not write to it.

How to get/make that is beyond the scope of this article.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 11:36    Post subject: Reply with quote
as I can't write in jffs to create my own inadym configuration, could I force with a scheduled task in cron the update fast?

so i can use cron job like this: 3,8,13,18,23,28,33,38,43,48,53,58 * * * * sleep 20 ; curl -s -S "https://www.duckdns.org/update?domains=DDDDDDDDD&token=TTTTTTT-TTTT-TTTT-TTTT-TTTTTTTTTTTT" >> /var/log/dyndns.log 2>&1 &

or this 3,8,13,18,23,28,33,38,43,48,53,58 * * * * sleep 43 && printf "$(date "+%Y-%m-%d %T") " >> /var/log/dyndns.log && curl -s -S "https://www.duckdns.org/update?domains=XXXXXXXXXXX&token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" > /var/log/dyndns.log && printf "\n" >> /var/log/dyndns.log 2>&1 &
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Sat Dec 09, 2023 11:52    Post subject: Reply with quote
You can research how to make a writable /jffs (hint USB, JFFS2) or simply make a cron job to restart DDNS.

Just some suggestions Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
spyfly
DD-WRT User


Joined: 26 Jun 2010
Posts: 92

PostPosted: Sat Dec 09, 2023 12:16    Post subject: Reply with quote
From telnet I have tested it and it works with:
Code:
killall inadyn

inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /tmp/ddns/inadyn.conf -P /var/run/inadyn.pid -l notice -t 30 -C


would be to make a cron that executes those 2 commands, something like that, right?
I didn't know how to make a cron with 2 commands so I made 2 crons

Code:
00 * * * * * root killall inadyn

01 * * * * * root inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /tmp/ddns/inadyn.conf -P /var/run/inadyn.pid -l notice -t 30 -C


when i stop and start the inadyn service it forces the ip update?Are you sure about that?
Goto page 1, 2, 3  Next Display posts from previous:    Page 1 of 3
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum