Hello is there any possibility to open an port for a specific time? Monday - Friday form 8 to 17 but nu more than 10 minutes per connection.
Thank You
Maybe with a script…
Can you elaborate…please
This is no trivial script as you first have to detect the day of week (Mon/Tue/..) and this is not provided by routeros. Here are some script for doing that: http://forum.mikrotik.com/t/how-to-make-scheduler-based-on-days-of-the-week/53683/1
En-/disabling script has to be run every day at 08:00 and 17:00 and condition (Mon-Fri) it can en-/disable the firewall rule. Then you have to kill all existing connections with this port. And you have to build a script for run every minute that checks for connections on this port running longer than 10 minutes and kill those.
All over all, that is something you will have to do on your own if you want to. These scripts will have more than 50 lines in sum I guess. Nothing I will code for some forum question because you don´t want to do it on your own.
If there are specific questions feel free to ask and you probably will get answer, but a forum is no self-service shop.
Ofcorse and you can take date, month, year using a script!!!
Ermm, what?
I am talking about MikroTik devices do not know that 2019/09/27 is a Friday. You have to script that (see link above).
Do you really think your answers were helpful? “Maybe with a script” and “of course”?
You know there’s this “time” parameter for firewall, right?
time (time-time,sat | fri | thu | wed | tue | mon | sun; Default: ) Allows to create filter based on the packets’ arrival time and date or, for locally generated packets, departure time and date
Only problem I see is the 10 minutes per connection limit, it would deserve better explanation, what the exact goal of that is.
Thanks for reminding that sob ![]()
A friend of mine has a daycare, she wants to give access to the CCTV for the parents but only for 10 minutes at a time an only between 8 to 17, because she also leaves there. And after 17 she does not want the parents to be able to access the cameras.
Well, it could be doable…
First step is easy, you can allow new connections with mentioned time parameter only between 8 and 17.
Next is cutting them off after 10 minutes. I didn’t test how much access to connections table scripts have, but if it’s possible to work with it, you could make a script and remove established connections to CCTV older than 10 minutes. But then it depends on what it is. For tcp it would kill the connection reliably. But udp will just continue as new connection. And even with tcp, there’s nothing to prevent user from connecting again right away.
So next step, you would have to handle reconnections. You could use address list and fill it with addresses blocked by previous script. Then a firewall rule could use this list and block new connections from these addresses. And each morning the script would reset the list.
As long as multiple clients would not use shared IP address, it could work. Also anyone with access to different addresses could watch whole day, but that’s probably not very likely to happen.