a collection of scripts for MikroTik RouterOS
Find a file
2020-04-03 17:29:08 +02:00
certs add certificate 'DigiCert ECC Secure Server CA' 2020-03-20 12:07:11 +01:00
doc add doc/upload-backup.md 2020-03-27 22:12:49 +01:00
.gitignore ignore all html files 2019-01-02 16:26:32 +01:00
accesslist-duplicates.capsman add doc/accesslist-duplicates.md 2020-03-27 22:12:49 +01:00
accesslist-duplicates.local add doc/accesslist-duplicates.md 2020-03-27 22:12:49 +01:00
accesslist-duplicates.template add doc/accesslist-duplicates.md 2020-03-27 22:12:49 +01:00
bridge-port-to-default add doc/bridge-port.md 2020-03-27 22:12:49 +01:00
bridge-port-toggle add doc/bridge-port.md 2020-03-27 22:12:49 +01:00
capsman-download-packages add doc/capsman-download-packages.md 2020-03-27 22:12:49 +01:00
capsman-rolling-upgrade capsman-rolling-upgrade: use $LogPrintExit 2020-04-03 17:26:35 +02:00
certificate-renew-issued add doc/certificate-renew-issued.md 2020-03-27 22:12:49 +01:00
check-certificates check-certificates: warn about missing chain 2020-04-03 14:36:32 +02:00
check-health check-health: use $LogPrintExit 2020-04-03 17:29:08 +02:00
check-lte-firmware-upgrade check-lte-firmware-upgrade: use $LogPrintExit 2020-04-03 17:19:34 +02:00
check-routeros-update add doc/check-routeros-update.md 2020-03-27 22:12:49 +01:00
cloud-backup add doc/cloud-backup.md 2020-03-27 22:12:49 +01:00
collect-wireless-mac.capsman add doc/collect-wireless-mac.md 2020-03-27 22:12:49 +01:00
collect-wireless-mac.local add doc/collect-wireless-mac.md 2020-03-27 22:12:49 +01:00
collect-wireless-mac.template add doc/collect-wireless-mac.md 2020-03-27 22:12:49 +01:00
CONTRIBUTIONS.md add navigation links for initial commands page 2020-03-31 14:34:01 +02:00
daily-psk.capsman add doc/daily-psk.md 2020-03-27 22:12:49 +01:00
daily-psk.local add doc/daily-psk.md 2020-03-27 22:12:49 +01:00
daily-psk.template add doc/daily-psk.md 2020-03-27 22:12:49 +01:00
dhcp-lease-comment.capsman add doc/dhcp-lease-comment.md 2020-03-27 22:12:49 +01:00
dhcp-lease-comment.local add doc/dhcp-lease-comment.md 2020-03-27 22:12:49 +01:00
dhcp-lease-comment.template add doc/dhcp-lease-comment.md 2020-03-27 22:12:49 +01:00
dhcp-to-dns add doc/dhcp-to-dns.md 2020-03-27 22:12:49 +01:00
email-backup add doc/email-backup.md 2020-03-27 22:12:49 +01:00
global-config ask for GitHub and GitLab stars 2020-03-27 22:19:33 +01:00
global-config-overlay ask for GitHub and GitLab stars 2020-03-27 22:19:33 +01:00
global-config.changes ask for GitHub and GitLab stars 2020-03-27 22:19:33 +01:00
global-functions global-functions: $SendTelegram: use $LogPrintExit 2020-04-03 16:59:10 +02:00
global-wait add doc/global-wait.md 2020-03-27 22:12:49 +01:00
gps-track gps-track: use $LogPrintExit 2020-04-03 17:16:42 +02:00
hotspot-to-wpa add doc/hotspot-to-wpa.md 2020-03-27 22:12:49 +01:00
INITIAL-COMMANDS.md completely replace script-updates with $ScriptInstallUpdate 2020-03-23 14:01:20 +01:00
ip-addr-bridge add doc/ip-addr-bridge.md 2020-03-27 22:12:49 +01:00
ipv6-update add doc/ipv6-update.md 2020-03-27 22:12:49 +01:00
learn-mac-based-vlan update copyright for 2020 2020-01-01 17:00:39 +01:00
lease-script add doc/lease-script.md 2020-03-27 22:12:49 +01:00
leds-day-mode add doc/leds-mode.md 2020-03-27 22:12:49 +01:00
leds-night-mode add doc/leds-mode.md 2020-03-27 22:12:49 +01:00
leds-toggle-mode add doc/leds-mode.md 2020-03-27 22:12:49 +01:00
Makefile Makefile: update links for generated html 2019-01-02 16:22:14 +01:00
manage-umts update copyright for 2020 2020-01-01 17:00:39 +01:00
mode-button-event add doc/mode-button.md 2020-03-27 22:12:49 +01:00
mode-button-scheduler mode-button-scheduler: use $LogPrintExit 2020-04-03 17:23:33 +02:00
netwatch-notify add doc/netwatch-notify.md 2020-03-27 22:12:49 +01:00
netwatch-syslog add doc/netwatch-syslog.md 2020-03-27 22:12:49 +01:00
packages-update packages-update: use $LogPrintExit 2020-04-03 17:22:03 +02:00
ppp-on-up add doc/ppp-on-up.md 2020-03-27 22:12:49 +01:00
README.md add links GitHub batches 2020-03-30 16:30:25 +02:00
rotate-ntp add doc/rotate-ntp.md 2020-03-27 22:12:49 +01:00
script-updates script-updates: fix syntax error 2020-03-31 12:51:37 +02:00
sms-action add doc/sms-action.md 2020-03-27 22:12:49 +01:00
sms-forward sms-forward: use $LogPrintExit 2020-04-03 17:20:56 +02:00
ssh-keys-import add doc/ssh-keys-import.md 2020-03-27 22:12:49 +01:00
super-mario-theme add doc/super-mario-theme.md 2020-03-27 22:12:49 +01:00
unattended-lte-firmware-upgrade add doc/unattended-lte-firmware-upgrade.md 2020-03-27 22:12:49 +01:00
update-gre-address update-gre-address: use $LogPrintExit 2020-04-03 17:18:05 +02:00
update-tunnelbroker update-tunnelbroker: check status of certificate download 2020-04-03 14:29:31 +02:00
upload-backup add doc/upload-backup.md 2020-03-27 22:12:49 +01:00

RouterOS Scripts

GitHub forks GitHub stars GitHub watchers

RouterOS is the operating system developed by MikroTik for networking tasks. This repository holds a number of scripts to manage RouterOS devices or extend their functionality.

Use at your own risk!

Requirements

Latest version of the scripts require at least RouterOS 6.43 to function properly. The changelog lists the corresponding change as follows:

*) fetch - added "as-value" output format;

Specific scripts may require even newer RouterOS version, for example cloud backup was added in 6.44.

Initial setup

Get me ready!

If you know how things work just copy and paste the initial commands. Remember to edit and rerun global-config-overlay! First time users should take the long way below.

Live presentation

Want to see it in action? I've had a presentation Repository based RouterOS script distribution including demonstation recorded live at MUM Europe 2019 in Vienna.

The long way in detail

The update script does server certificate verification, so first step is to download the certificates. If you intend to download the scripts from a different location (for example from github.com) install the corresponding certificate chain.

[admin@MikroTik] > / tool fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/Let%27s%20Encrypt%20Authority%20X3.pem" dst-path="letsencrypt.pem"
      status: finished
  downloaded: 3KiBC-z pause]
       total: 3KiB
    duration: 1s

Note that the commands above do not verify server certificate, so if you want to be safe download with your workstations's browser and transfer the files to your MikroTik device.

Then we import the certificates.

[admin@MikroTik] > / certificate import file-name=letsencrypt.pem passphrase=""
     certificates-imported: 3
     private-keys-imported: 0
            files-imported: 1
       decryption-failures: 0
  keys-with-no-certificate: 0

For basic verification we rename the certifiactes and print their count. Make sure the certificate count is three.

[admin@MikroTik] > / certificate set name="ISRG-Root-X1" [ find where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" ]
[admin@MikroTik] > / certificate set name="Let-s-Encrypt-Authority-X3" [ find where fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" ]
[admin@MikroTik] > / certificate set name="DST-Root-CA-X3" [ find where fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739" ]
[admin@MikroTik] > / certificate print count-only where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" or fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" or fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739"
3

Always make sure there are no certificates installed you do not know or want!

Actually we do not require the certificate named DST Root CA X3, but as it is used by Let's Encrypt to cross-sign we install it anyway - this makes sure things do not go wrong if the intermediate certificate is replaced. The IdenTrust certificate should be available from their download page. The site is crap and a good example how to not do it.

Now let's download the main scripts and add them in configuration on the fly.

[admin@MikroTik] > :foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={ / system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data"); }

The configuration needs to be tweaked for your needs. Make sure not to send your mails to mail@example.com! Edit global-config-overlay, copy configuration from global-config.

[admin@MikroTik] > / system script edit global-config-overlay source

And finally load configuration and functions and add the scheduler.

[admin@MikroTik] > / system script { run global-config; run global-config-overlay; run global-functions; }
[admin@MikroTik] > / system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }"

Updating scripts

To update existing scripts just run function $ScriptInstallUpdate.

[admin@MikroTik] > $ScriptInstallUpdate

Adding a script

To add a script from the repository run function $ScriptInstallUpdate with a comma separated list of script names.

[admin@MikroTik] > $ScriptInstallUpdate check-certificates,check-routeros-update

Scheduler and events

Most scripts are designed to run regularly from scheduler. We just added check-routeros-update, so let's run it every hour to make sure not to miss an update.

[admin@MikroTik] > / system scheduler add name="check-routeros-update" interval=1h on-event="/ system script run check-routeros-update;"

Some events can run a script. If you want your DHCP hostnames to be available in DNS use dhcp-to-dns with the events from dhcp server. For a regular cleanup add a scheduler entry.

[admin@MikroTik] > $ScriptInstallUpdate dhcp-to-dns,lease-script
[admin@MikroTik] > / ip dhcp-server set lease-script=lease-script [ find ]
[admin@MikroTik] > / system scheduler add name="dhcp-to-dns" interval=5m on-event="/ system script run dhcp-to-dns;"

There's much more to explore... Have fun!

Available Scripts

Contribute

Thanks a lot for past contributions!

Patches, issues and whishlist

Feel free to contact me via e-mail or open an issue at github.

Donate

This project is developed in private spare time and usage is free of charge for you. If you like the scripts and think this is of value for you or your business please consider to donate with PayPal.

donate with PayPal

Thanks a lot for your support!

Upstream

URL: GitHub.com

Mirror: eworm.de GitLab.com


▲ Go back to top