No Description

Christian Hesse da581dedbf add navigation links for initial commands page 1 day ago
certs 8a88743e9f add certificate 'DigiCert ECC Secure Server CA' 1 week ago
doc c32a727b6e add doc/upload-backup.md 4 days ago
.gitignore 7f7a9d8c89 ignore all html files 1 year ago
CONTRIBUTIONS.md da581dedbf add navigation links for initial commands page 1 day ago
INITIAL-COMMANDS.md 5f46ef7635 completely replace script-updates with $ScriptInstallUpdate 1 week ago
Makefile dfa750a7f5 Makefile: update links for generated html 1 year ago
README.md 4d0b3b0780 add links GitHub batches 2 days ago
accesslist-duplicates.capsman b2f81f7cad add doc/accesslist-duplicates.md 4 days ago
accesslist-duplicates.local b2f81f7cad add doc/accesslist-duplicates.md 4 days ago
accesslist-duplicates.template b2f81f7cad add doc/accesslist-duplicates.md 4 days ago
bridge-port-to-default 60a21e11b0 add doc/bridge-port.md 4 days ago
bridge-port-toggle 60a21e11b0 add doc/bridge-port.md 4 days ago
capsman-download-packages 74d192cf53 add doc/capsman-download-packages.md 4 days ago
capsman-rolling-upgrade 77c1f6fd63 add doc/capsman-rolling-upgrade.md 4 days ago
certificate-renew-issued d08a342f06 add doc/certificate-renew-issued.md 4 days ago
check-certificates e962fe9189 add doc/check-certificates.md 4 days ago
check-health ff867d1b6b add doc/check-health.md 4 days ago
check-lte-firmware-upgrade 969ae57fc2 add doc/check-lte-firmware-upgrade.md 4 days ago
check-routeros-update c1dcc28028 add doc/check-routeros-update.md 4 days ago
cloud-backup d1bba48cc7 add doc/cloud-backup.md 4 days ago
collect-wireless-mac.capsman 79e7b3229f add doc/collect-wireless-mac.md 4 days ago
collect-wireless-mac.local 79e7b3229f add doc/collect-wireless-mac.md 4 days ago
collect-wireless-mac.template 79e7b3229f add doc/collect-wireless-mac.md 4 days ago
daily-psk.capsman e949e527f6 add doc/daily-psk.md 4 days ago
daily-psk.local e949e527f6 add doc/daily-psk.md 4 days ago
daily-psk.template e949e527f6 add doc/daily-psk.md 4 days ago
dhcp-lease-comment.capsman c9b7139859 add doc/dhcp-lease-comment.md 4 days ago
dhcp-lease-comment.local c9b7139859 add doc/dhcp-lease-comment.md 4 days ago
dhcp-lease-comment.template c9b7139859 add doc/dhcp-lease-comment.md 4 days ago
dhcp-to-dns e0346bf60e add doc/dhcp-to-dns.md 4 days ago
email-backup 8b724a9b5a add doc/email-backup.md 4 days ago
global-config 2363f75e7f ask for GitHub and GitLab stars 4 days ago
global-config-overlay 2363f75e7f ask for GitHub and GitLab stars 4 days ago
global-config.changes 2363f75e7f ask for GitHub and GitLab stars 4 days ago
global-functions a598cca2da global-functions: $SendTelegram: always return a value 1 day ago
global-wait 2e0e83d136 add doc/global-wait.md 4 days ago
gps-track cba9352fc4 add doc/gps-track.md 4 days ago
hotspot-to-wpa 39857405d5 add doc/hotspot-to-wpa.md 4 days ago
ip-addr-bridge b20fcaa94d add doc/ip-addr-bridge.md 4 days ago
ipv6-update 024e9c97a1 add doc/ipv6-update.md 4 days ago
learn-mac-based-vlan afb9839073 update copyright for 2020 3 months ago
lease-script e1377cbd92 add doc/lease-script.md 4 days ago
leds-day-mode 8c3489761e add doc/leds-mode.md 4 days ago
leds-night-mode 8c3489761e add doc/leds-mode.md 4 days ago
leds-toggle-mode 8c3489761e add doc/leds-mode.md 4 days ago
manage-umts afb9839073 update copyright for 2020 3 months ago
mode-button-event 5594ffd69a add doc/mode-button.md 4 days ago
mode-button-scheduler 5594ffd69a add doc/mode-button.md 4 days ago
netwatch-notify f482c565c7 add doc/netwatch-notify.md 4 days ago
netwatch-syslog 222fe8fd54 add doc/netwatch-syslog.md 4 days ago
packages-update d075cce0ef add doc/packages-update.md 4 days ago
ppp-on-up 15995b495f add doc/ppp-on-up.md 4 days ago
rotate-ntp 747af21bea add doc/rotate-ntp.md 4 days ago
script-updates 04460debfc script-updates: fix syntax error 1 day ago
sms-action ed2718da2a add doc/sms-action.md 4 days ago
sms-forward e8bc0a7169 add doc/sms-forward.md 4 days ago
ssh-keys-import 997ef3bf23 add doc/ssh-keys-import.md 4 days ago
super-mario-theme 1e5784225a add doc/super-mario-theme.md 4 days ago
unattended-lte-firmware-upgrade f45dbb3a73 add doc/unattended-lte-firmware-upgrade.md 4 days ago
update-gre-address a2b009502f add doc/update-gre-address.md 4 days ago
update-tunnelbroker 3f6539da4c add doc/update-tunnelbroker.md 4 days ago
upload-backup c32a727b6e add doc/upload-backup.md 4 days ago

README.md

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