Community discussions

 
foxch2
just joined
Topic Author
Posts: 19
Joined: Tue Dec 08, 2015 11:35 am

repository for scripts

Tue Dec 22, 2015 11:35 am

Всем привет
нужна помощь. использую около 30 маршрутизаторов
Есть ли способ распространить скрипты и задачи в планировщик из центра?
не подключаясь на каждый.
Я понимаю, что скрипты на всех маршрутизаторах будут одинаковыми, меня это устраивает.

Hello
need help. I use about 30 routers
Is there a way to distribute scripts and tasks to the scheduler from the centre?
without connecting to each.
I understand that the script on all routers will be identical, it suits me.
 
User avatar
patrikg
Member Candidate
Member Candidate
Posts: 155
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: repository for scripts

Tue Dec 22, 2015 12:46 pm

Have a look at this page to find some scripts, that you can change to
match what you need.

http://wiki.mikrotik.com/wiki/Scripts

http://wiki.mikrotik.com/wiki/Manual:Scripting
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: repository for scripts

Tue Dec 22, 2015 12:52 pm

There isn't a RouterOS proprietary way of doing this.

You can do it by making one of the routers accessible to the others via FTP, and from those other routers, you can then do
/tool fetch url="ftp://user:pass@192.168.88.1/script.rsc" keep-result=yes
:delay 2s
/import file="script.rsc";
However, keep in that that in this fashion, you're potentially vulnerable to man-in-the-middle attacks (which in this case could prove to be fatal, as the attacker creates their own admin username via injected code in the script, and that way completely takes over your router). You'd need to set up a separate device as an HTTPS server (with a valid certificate) to not be.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
ConnectivityEngineer
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Sat Dec 19, 2015 10:57 pm
Location: Ohio, USA
Contact:

Re: repository for scripts

Tue Dec 22, 2015 12:53 pm

The easiest way is to simply setup a shared file location on a webserver

Then run
/tool fetch url=http://yourdomain.com/files/data.txt[code]

Every script I run also has the following at the top


[code]
# Printing local time for Log purposes ...
:local CurrentTime [/system clock get time];
:log warning "Script run at Current Time = $CurrentTime. . ."
What I have done is I actually run a script that fetches a new script which is the one I update to list all the files we want to then get and run.

So first Script grabs a script to fetch any and all scripts I want as well as deletes any scripts we do not want on our systems any longer.


I run the script once per day - and it makes things pretty good.

Now - one other option ~ look into the API and do some magic for PHP
Glenn Kelley | MCTNA, MTCWE, MTCTCE, RHCE, RHCSS
http://Connectivity.Engineer
USA Based 24x7x365 Mikrotik, Juniper, Ubiquiti TAC & WISP / ISP Blind Label Support Call Center
 
foxch2
just joined
Topic Author
Posts: 19
Joined: Tue Dec 08, 2015 11:35 am

Re: repository for scripts

Tue Dec 22, 2015 4:20 pm

There isn't a RouterOS proprietary way of doing this.

You can do it by making one of the routers accessible to the others via FTP, and from those other routers, you can then do
/tool fetch url="ftp://user:pass@192.168.88.1/script.rsc" keep-result=yes
:delay 2s
/import file="script.rsc";
However, keep in that that in this fashion, you're potentially vulnerable to man-in-the-middle attacks (which in this case could prove to be fatal, as the attacker creates their own admin username via injected code in the script, and that way completely takes over your router). You'd need to set up a separate device as an HTTPS server (with a valid certificate) to not be.
I thought in this way
I just didn't know that i can import tasks use this
/import file="script.rsc";

about attacks - all my routers connected to VPN
FTP server is on the internal network and has no access to external network

I'll try it

Who is online

Users browsing this forum: No registered users and 16 guests