Compare commits

...

2673 commits

Author SHA1 Message Date
Christian Hesse
ce39b79f69 capsman-download-packages: fix parameter for $RmFile
The function can not handle ids, we have to pass a name instead.
2025-03-13 11:50:38 +01:00
Christian Hesse
20bf609c44 check-routeros-update: fix condition for license check
Turns out that `next-renewal-at` is moved forward when renewal failed,
so it never matches the criteria. Just start complaining three weeks
before deadline.
2025-03-13 10:51:39 +01:00
Christian Hesse
b63e0fcb2f netwatch-notify: check matching address type only 2025-03-12 11:26:22 +01:00
Christian Hesse
1555426687 netwatch-notify: increase the timeout even more
This interacts with the number of addresses in the address-list. Having
a lot of addresses there (for exemple from script 'fw-addr-lists' 😜)
makes the 'find' take longer. We have to make sure that 'find' succeeds
before the address times out.

As this does not hurt... Let's just bump to 10 seconds to be safe.
2025-03-12 11:18:18 +01:00
Christian Hesse
97b99316b2 netwatch-notify: increase timeout...
... as a timeout of one second expires immediately. 🤨
2025-03-12 10:31:11 +01:00
Christian Hesse
788400c458 fw-addr-lists: raw.githubusercontent.com requires 'USERTrust RSA Certification Authority' now 2025-03-11 15:51:25 +01:00
Christian Hesse
eb59dd21ca check-routeros-update: check perpetual license...
... as these have to be renewed and can expire.
2025-03-11 15:51:25 +01:00
Christian Hesse
79a4b369cb Merge branch 'fw-addr-lists' into next 2025-03-11 15:51:25 +01:00
Christian Hesse
f0e6cbcfe1 fw-addr-lists: get branch from calculated checksum
The addresses were spread very uneven before.

Let's calculate a checksum, and take the first two characters of that.
The addresses are now spread evenly on 256 branches (0x00 to 0xff).
2025-03-11 15:51:10 +01:00
Christian Hesse
d71ea804b0 fw-addr-lists: two characters for branch
Using one character for IPv4 is ok (1 to 9), but IPv6 global unicase
(2000::/3) results in just two different characters (2 and 3).

So let's use first two characters...
2025-03-11 14:20:50 +01:00
Christian Hesse
e148df9e57 fw-addr-lists: put addresses into "branches"...
... effectively adding another layer and some complexity, but:
The addresses are sorted inside the array, and sorting less addresses in
a branch saves a lot of processing power. So this is a lot faster now...
2025-03-11 14:20:44 +01:00
Christian Hesse
2f55bfaf00 fw-addr-lists: strip cidr for host addresses
This makes sure the addresses match later when we read them from
address-list for renew.
2025-03-11 14:19:10 +01:00
Christian Hesse
ea6de35699 fw-addr-lists: do not clean up
Cleanup is important on renew (so the script does not attempt to re-add),
but we do not care here.
2025-03-11 14:13:55 +01:00
Christian Hesse
fb343c99e3 fw-addr-lists: put timeout into variable 2025-03-06 22:59:31 +01:00
Christian Hesse
7be26a0712 DEBUG: add info on $LogPrintVerbose 2025-03-06 15:59:44 +01:00
Christian Hesse
6d718ec987 fw-addr-lists: use $LogPrintVerbose ...
... to reduce debug output and speed up execution.
2025-03-06 15:59:44 +01:00
Christian Hesse
e341e1c30c global-functions: introduce $LogPrintVerbose ...
... which is a declared function, but has no code, intentionally. It can be
called as a no-op by default.

If you want this output set the function to be the same as $LogPrint:

    :set LogPrintVerbose $LogPrint;
2025-03-06 15:59:11 +01:00
Christian Hesse
b43b1b3955 Merge branch 'checksums' into next 2025-03-06 10:43:15 +01:00
Christian Hesse
1b46a5fd9b global-functions: $ScriptInstallUpdate: checksum only for same source
So ignore if script is fetched from different base or with different
suffix.
2025-03-06 10:43:13 +01:00
Christian Hesse
b13360e4b8 global-functions: $ScriptInstallUpdate: simplify check
This one should suffice...
2025-03-06 10:42:52 +01:00
Christian Hesse
c9de6d8579 global-functions: $ScriptInstallUpdate: put checksum into variable 2025-03-06 10:42:27 +01:00
Christian Hesse
10374afc18 global-functions: $ScriptInstallUpdate: support checksums for CRLF scripts 2025-03-06 10:42:00 +01:00
Christian Hesse
0c1d96f89d global-functions: $ScriptInstallUpdate: get and compare checksums
The file 'checksums.json' is generated when deploying to my web
server... This should speed up the update a lot as it reduces downloads
to a minimum. 🎉😁
2025-03-06 10:41:28 +01:00
Christian Hesse
3ccaafd1b3 global-functions: $ScriptInstallUpdate: move code into block 2025-03-05 01:15:22 +01:00
Christian Hesse
469f783a92 ipv6-update: check for availability of both variables 2025-03-03 09:12:43 +01:00
Christian Hesse
33c02e0609 ipv6-update: ignore if prefix is no longer valid 2025-03-03 09:10:54 +01:00
Christian Hesse
6331505dbe Merge branch 'quote-file-name' into next
This is required with RouterOS 7.18 now...

Well, probably the change was introduced with one of the
beta versions...
2025-02-27 10:52:52 +01:00
Christian Hesse
0c4fb42616 mod/notification-telegram: $GetTelegramChatId: give thead id...
... if message was sent to group's topic.
2025-02-27 10:52:52 +01:00
Christian Hesse
f5189b8bd7 INITIAL-COMMANDS: quote the certificate file name 2025-02-27 10:52:52 +01:00
Christian Hesse
e2fe653035 mod/notification-telegram: $GetTelegramChatId: use last message 2025-02-27 10:52:52 +01:00
Christian Hesse
b11be59b08 README: quote the certificate file name 2025-02-27 10:52:52 +01:00
Christian Hesse
24de060904 Merge branch 'check-certificates' into next 2025-02-27 10:52:19 +01:00
Christian Hesse
14195c51ca check-certificates: try PKCS#12 before PEM...
... as that is more likely to have a private key.

Is that true? 🤨
2025-02-26 18:25:58 +01:00
Christian Hesse
e833dfcf25 check-certificates: simplify return from function...
... and also break earch on success.
2025-02-26 18:05:32 +01:00
Christian Hesse
512c54bd59 check-certificates: ... and even more 2025-02-26 18:05:32 +01:00
Christian Hesse
3d40b4419d check-certificates: add more debug output 2025-02-26 18:03:45 +01:00
Christian Hesse
a6d4e7e82c check-certificates: drop dot from type...
... and add it in file name.
2025-02-26 18:03:17 +01:00
Christian Hesse
f6c2225f68 check-certificates: catch and ignore import error
Hmm... 🤨 When was that runtime error introduced? I *think* it
worked before.
2025-02-26 13:57:51 +01:00
Christian Hesse
53b13b295a mod/notification-telegram: introduce $GetTelegramChatId 2025-02-25 22:37:30 +01:00
Christian Hesse
4eafcaa3ac telegram-chat: say hello when awaiting commands 2025-02-25 22:16:48 +01:00
Christian Hesse
c33eb41c9c global-functions: $DeviceInfo: add license level, re-order 2025-02-25 17:55:26 +01:00
Christian Hesse
78f9687558 Merge branch 'telegram-topics' into next 2025-02-25 17:55:26 +01:00
Christian Hesse
e5de9de391 notify on support for Telegram group topics 2025-02-25 17:55:26 +01:00
Christian Hesse
7928c5f054 telegram-chat: support reply in group's topic 2025-02-25 17:55:26 +01:00
Christian Hesse
757fa60e6f telegram-chat: make $IsReply a boolean...
... and check for correct data type.

We need this for a group with topic feature enabled, as that variable is
set there, but is is an array.
2025-02-25 17:55:26 +01:00
Christian Hesse
a22b62f588 mod/notification-telegram: support sending to group's topic...
... when a group has enabled the "Topics" feature.
2025-02-25 17:55:12 +01:00
Christian Hesse
cad104879c mod/notification-telegram: simplify the queue...
... and pass http-data as a complete sting.
2025-02-24 15:18:53 +01:00
Christian Hesse
58da92e36a global-functions: $WaitForFile: drop the warning on file handling breakage...
... but keep the workaround for now - just to be sure.
2025-02-19 22:21:03 +01:00
Christian Hesse
2c92c78b46 global-functions: $ScriptInstallUpdate: also show commit info 2025-02-17 13:55:44 +01:00
Christian Hesse
75633872aa global-functions: $DeviceInfo: also show commit info 2025-02-17 13:55:36 +01:00
Christian Hesse
dafcc1a0cb global-functions: $RmFile: fix type safeguard
Ups... 🫣
The type is not just literal 'file' - but what ever type the file is,
like 'backup', 'package', 'script', '.conf file', ...

So let's match those types we do *not* want to remove.

Fixes: https://github.com/eworm-de/routeros-scripts/issues/90
2025-02-13 17:58:48 +01:00
Christian Hesse
0199ea8884 global-functions: $ScriptInstallUpdate: show commit id (if available) 2025-02-13 09:50:22 +01:00
Christian Hesse
584e507fd1 global-functions: $DeviceInfo: show commit id (if available) 2025-02-13 09:03:05 +01:00
Christian Hesse
5715bc7b57 mod/scriptrunonce: always give proper return code 2025-02-12 17:40:27 +01:00
Christian Hesse
1c957dbc6d mod/scriptrunonce: resolve nested conditions 2025-02-12 17:40:27 +01:00
Christian Hesse
b7b3b43f3b mod/scriptrunonce: use $FetchHuge 2025-02-12 17:40:27 +01:00
Christian Hesse
df631b987d fw-addr-lists: add a collective list in default configuration 2025-02-12 17:40:27 +01:00
Christian Hesse
c8759381e9 global-functions: $WaitForFile: check that we can get properties
Looks like RouterOS 7.18beta2 brings more breakage. Having a file
available in listing is just the first step now. We also need to make
sure that the file properties are accessible... 🤪

I have seen this taking several tens of seconds at least... 🤪🤪 So
let's just try until we have properties available, or the file vanishes.

Reported as SUP-179200. 🤞
2025-02-12 10:49:38 +01:00
Christian Hesse
d41f758550 introduce DEBUG info 2025-02-12 10:49:34 +01:00
Christian Hesse
e1c561dd91 global-functions: $MkDir: add debug output 2025-02-11 14:56:43 +01:00
Christian Hesse
4d0b4a1ff4 fw-addr-lists: these lists are deprecated and discontinued
Any alternatives around?
2025-02-11 14:30:14 +01:00
Christian Hesse
8af67af462 doc/log-forward: mention ntfy 2025-02-10 15:31:20 +01:00
Christian Hesse
da280586b5 doc/log-forward: add a hint on defaults 2025-02-10 15:31:20 +01:00
Christian Hesse
2e42f7963c mod/notification-ntfy: use empty strings as default...
... which should be fine now that the credentials are not passed with
fetch's properties, but as properly formatted authentication header.
2025-02-10 15:23:50 +01:00
Christian Hesse
fc3beac83b log-forward: make empty string a special meaning 2025-02-10 15:23:50 +01:00
Christian Hesse
fefe11d1e8 Merge branch 'rmdir-rmfile' into next
RouterOS 7.18beta2 comes with some severe issues in file handling,
probably racy conditions. Let's move file (and directory) removal to
functions, so errors can be caught and ignored 🤪 from a central place.
2025-02-10 15:23:50 +01:00
Christian Hesse
b156fc43cf telegram-chat: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
0fea300fea mod/ssh-keys-import: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
6570a84904 check-certificates: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
63db96bdcc capsman-download-packages: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
88ff031368 backup-upload: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
81ba47a07d backup-upload: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
d748b69142 backup-cloud: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
f5f00b70e3 global-functions: $MkDir: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
4760515add global-functions: $FetchHuge: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
d19b90df08 global-functions: $FetchHuge: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
ea8ec6b580 global-functions: $DownloadPackage: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
dbdf295244 global-functions: $CertificateDownload: use $RmFile 2025-02-10 15:23:50 +01:00
Christian Hesse
82020ddd73 global-functions: $RmDir: fail on wrong type 2025-02-10 15:23:50 +01:00
Christian Hesse
a8e5b5226b global-functions: $RmFile: fail on wrong type 2025-02-10 15:23:50 +01:00
Christian Hesse
4bfb591fa0 bump required RouterOS version for all scripts 2025-02-07 17:44:41 +01:00
Christian Hesse
49d9fb1ffd global-functions: $RmDir: add debug output 2025-02-07 17:44:41 +01:00
Christian Hesse
7233dea5bb global-functions: $RmFile: add debug output 2025-02-07 17:44:41 +01:00
Christian Hesse
727495d9c4 global-functions: introduce $RmDir 2025-02-07 17:44:41 +01:00
Christian Hesse
4542c2b19e global-functions: introduce $RmFile 2025-02-07 17:44:41 +01:00
Christian Hesse
0fb5fd0323 global-functions: $MkDir: create directory directly...
... instead of file inside directory. This requires RouterOS 7.15, so
bumping requirement.
2025-02-07 17:44:32 +01:00
Christian Hesse
dbdc3e4718 packages-update: ignore available packages
This was introduced with RouterOS 7.18beta2 to list and install available
packages. We do not want to install all of them. 😝
2025-02-07 17:16:37 +01:00
Christian Hesse
dafd95d44a packages-update: disable random delay for backup 2025-02-06 21:26:39 +01:00
Christian Hesse
7b660d0952 packages-update: move configuration variables up 2025-02-06 21:24:20 +01:00
Christian Hesse
23d38927bc check-health: split off plugins...
... from 'check-health', so the script works on all devices to monitor
CPU and RAM. The supported plugins for sensors in hardware are installed
automatically.
2025-02-05 14:39:59 +01:00
Christian Hesse
84ba3a463a doc/netwatch-dns: warn on different certificate...
... based on indicated server name.

Currently this is true for 8.8.8.8 (GTS Root R1) and dns.google (GTS Root R4).
2025-02-05 10:00:26 +01:00
Christian Hesse
27c92b4382 doc/netwatch-dns: switch exmample to cloudflare-dns.com 2025-02-05 10:00:26 +01:00
Christian Hesse
6501c98c82 certs: dns.google switched to 'GTS Root R4'
Note that 8.8.8.8 is still at 'GTS Root R1'...
2025-02-05 10:00:26 +01:00
Christian Hesse
bfe5f20920 check-health: remove trailing whitespaces 2025-02-04 22:20:18 +01:00
Christian Hesse
3024b246b5 check-health: remove extra line break 2025-02-04 12:03:24 +01:00
Christian Hesse
61f3c26199 doc/check-health: highligh note on bad initial state 2025-02-03 14:36:25 +01:00
Christian Hesse
3ad7ccd3d6 check-certificates: check to characters for star-dot 2025-02-03 10:05:35 +01:00
Christian Hesse
eabe3f6e95 check-certificates: pass real and modified name into function 2025-01-31 21:40:51 +01:00
Christian Hesse
75e5ddec52 check-certificates: do not rename the wrong certificate 2025-01-31 13:09:22 +01:00
Christian Hesse
44d0c852f1 check-certificates: try with "star." for renewal with wildcards 2025-01-31 12:14:05 +01:00
Christian Hesse
0eb91b6bfa update list of contributors 2025-01-30 22:50:07 +01:00
Christian Hesse
87fb70534f certs: support checking ipv4 or ipv6 only
Just run for IPv4 only:

    make NOIPV6=1

... or for IPv6 only:

    make NOIPV4=1
2025-01-30 22:50:07 +01:00
Christian Hesse
fcb5347e33 certs: split checks for dual, ipv4 & ipv6...
... and check both if available.
2025-01-30 22:50:07 +01:00
Miquel Bonastre
aa294b4c67 certs: fix curl false positives...
... when default capath contains system certs

If curl has a default capath (debian 12 capath=/etc/ssl/certs)
it will add those certs and return ok to any valid https url,
defeating the intended use of the cacert option in the Makefile
that validates sites and certs.

To avoid that, adding option "--capath /dev/null" overrides
the default value, if any.

Closes: https://github.com/eworm-de/routeros-scripts/pull/88
2025-01-30 22:49:02 +01:00
Christian Hesse
414c83ef81 global-functions: $ScriptInstallUpdate: resolve more nested conditions
Just like the previous one.
2025-01-30 09:00:02 +01:00
Christian Hesse
8b19e74736 global-functions: $ScriptInstallUpdate: resolve nested conditions...
... and check one after another in a do-block. This uses `:error` as
poor man's continue. 🤪
2025-01-30 09:00:02 +01:00
Christian Hesse
3c8ec5169f Merge branch 'device-mode' into next 2025-01-30 09:00:02 +01:00
Christian Hesse
d921af9a6b update-tunnelbroker: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
9421566352 unattended-lte-firmware-upgrade: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
ef48b8d39e telegram-chat: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
8dc1e1ea6b packages-update: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
3ef4588601 netwatch-dns: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
59c9d0ce4b mod/scriptrunonce: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
378a8978df mod/notification-telegram: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
9f2f54b479 mod/notification-ntfy: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
9a12934202 mod/notification-matrix: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
370e81321f mod/notification-email: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
56e74268b0 mode-button: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
5f1cbe6de5 ipsec-to-dns: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
1ad4d05be8 hotspot-to-wpa-cleanup: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
e29ef31eb8 hotspot-to-wpa: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
bc0227c49b gps-track: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
43f6c0b975 check-routeros-update: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
95b675f67e check-certificates: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
d81a786e82 backup-upload: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
aebc4e37da backup-partition: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
b177e298d7 global-functions: $ScriptInstallUpdate: support checking for device-mode features 2025-01-30 09:00:02 +01:00
Christian Hesse
106a9bddef README: give hint on device mode 2025-01-29 22:20:41 +01:00
Christian Hesse
546e3cdab6 Merge branch 'rsc-eworm-de' into next 2025-01-29 22:20:14 +01:00
Christian Hesse
c04ee5aadf update-tunnelbroker: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
49aef0606b update-gre-address: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
32ac10e6ef unattended-lte-firmware-upgrade: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
e3ca37ad9a telegram-chat: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
dd2854e983 super-mario-theme: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
7addf2e53a sms-forward: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
1f5aea9fca sms-action: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
867e504c94 ppp-on-up: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
90a148a9d8 packages-update: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
3b0ea3a238 ospf-to-leds: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
719079c5c1 news-and-changes: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
563aeb8f71 netwatch-notify: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
299b34883f netwatch-dns: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
ed18444578 mod/ssh-keys-import: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
66ab2a8511 mod/scriptrunonce: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
27144a428a mod/notification-telegram: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
6e7f311269 mod/notification-ntfy: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
6567a94a4f mod/notification-matrix: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
631f63836b mod/notification-email: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
828f68be3c mod/ipcalc: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
078d5368fb mod/inspectvar: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
18fcecd211 mode-button: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
d5a50d824f mod/bridge-port-vlan: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
6920842d15 mod/bridge-port-to: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
b8841a7135 log-forward: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
b75a35417a leds-toggle-mode: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
bf11489d11 leds-night-mode: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
5e60d2e1b7 leds-day-mode: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
5ead61cb62 lease-script: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
71316f7377 ipv6-update: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
02cc581aff ipsec-to-dns: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
453d80a121 ip-addr-bridge: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
9474102c62 hotspot-to-wpa: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
996602bfe9 hotspot-to-wpa-cleanup: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
72db13c0ab gps-track: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
0431b02324 global-wait: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
7be415d0ed global-functions: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
b7923485bd global-config: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
ac62b8f24f global-config-overlay: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
39c5aeda13 fw-addr-lists: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
7b760d9fa4 firmware-upgrade-reboot: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
632d294a98 dhcp-to-dns: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
61dee21776 dhcp-lease-comment: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
96fa76f07d daily-psk.template: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
f8058eaf71 collect-wireless-mac: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
36c87c91ea check-routeros-update: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
7484663b92 check-lte-firmware-upgrade: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
231be730ae check-health: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
1239ac3104 check-certificates: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
1b7458ac95 certificate-renew-issued: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
26dbf5805a capsman-rolling-upgrade: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
b938847030 capsman-download-packages: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
38b5fbab9c backup-upload: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
c70b6a8eb3 backup-partition: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
08ff07d037 backup-email: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
5281b4ba02 backup-cloud: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
1dda59034e accesslist-duplicates: use short url rsc.eworm.de 2025-01-29 14:14:26 +01:00
Christian Hesse
500054535c unattended-lte-firmware-upgrade: require RouterOS 2025-01-29 14:09:06 +01:00
Christian Hesse
a446f31262 fw-addr-lists: use my static mirror 2025-01-24 11:20:31 +01:00
Christian Hesse
d4acc5aa59 BRANCHES: adopt new default url 2025-01-24 11:20:31 +01:00
Christian Hesse
ccf17a438c global-config: download scripts from rsc.eworm.de
Currently AI bots are crawling website all around the world. For a
website hosting git content this adds a lot of extra load and traffic:
The site has lots of sections, repositories have a lot of files,
branches, tags, commit ids, etc...
Multiply that and you have a nearly unlimited number of unique urls. The
bots try to get each and every of these.

To speed up the learing process on their side a swarm of hundreds,
thousands or more ip addresses is active at the same time, ultimately
DDOS'ing the websites, making it inaccessible. 😳🤬

Well, there is one single file all of these AI bots are not interested
in: robots.txt 🤬🤬

On top some use random user agent strings, making filtering impossible.
🤬🤬🤬

For a short term sulution I deploy the repository content as static
files, hopefully making these accessible at least. We will see.
2025-01-24 11:20:24 +01:00
Christian Hesse
e8b1e19b28 fw-addr-lists: spamhaus.org returned to 'GTS Root R4' 2025-01-22 12:33:46 +01:00
Christian Hesse
98791f48fd ppp-on-up: release only bound ipv6 dhcp clients 2025-01-09 13:20:45 +01:00
Christian Hesse
ce2d090e99 packages-update: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
665516b33d check-routeros-update: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
d9693f4d5f backup-upload: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
6c990079a6 backup-partition: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
303c393900 backup-email: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
db508ddcd1 backup-cloud: refuse when running from backup partition 2025-01-06 09:31:38 +01:00
Christian Hesse
9e3729c279 update copyright for 2025 2025-01-02 00:04:06 +01:00
Christian Hesse
b98b245714 global-functions: $WaitForFile: drop the first workaround
This reverts commit 8231c3e833.

Truned out this workaround was not sufficient, see the follow-up in
commit 191cc1b952 for details.

But possibly the second one does it on its own? Reverting this for
a test run.
2024-12-30 20:22:51 +01:00
Christian Hesse
191cc1b952 global-functions: $FetchHuge: another workaround for complete file
Turns out the workaround in $WaitForFile (commit
8231c3e833) is not sufficient. It helps
sometimes, but not always. Possibly depends on CPU speed and bandwidth
of internet connection... Who knows!? 🤪

But! Reading the file goes beyond the known file size. That's suspicious
and indicates this exact issue. So add a delay, and keep reading until
sizes are equal.
2024-12-30 20:09:46 +01:00
Christian Hesse
3ada3055ff fw-addr-lists: spamhaus.org returned to 'ISRG Root X1'
This reverts commit 4d8dce9769.
2024-12-30 19:51:42 +01:00
Christian Hesse
ef3ce7cc6c global-functions: $ParseKeyValueStore: support JSON as input
This used to require a key=value store, separated with commas. An
example for `netwatch-notify` is:

    /tool/netwatch/add comment="notify, name=example.com" host=93.184.215.14;

Now JSON is supported as well, so you could use:

    /tool/netwatch/add comment="{\"notify\":true,\"name\":\"example.com\"}" host=93.184.215.14;

Looks more clumsy here, but may be of help in more complex setups...
2024-12-25 23:04:50 +01:00
Christian Hesse
8212bd6c95 global-functions: $ParseKeyValueStore: properly return boolean values 2024-12-25 23:04:48 +01:00
Christian Hesse
ba39c29648 global-functions: $ParseKeyValueStore: split key and value...
... into separate variables.
2024-12-25 23:04:28 +01:00
Christian Hesse
6bee467550 mod/notification-ntfy: add basic authentication in headers
This makes it a bit easier and straight forward as we pass the
headers anyway.
2024-12-17 13:21:59 +01:00
Christian Hesse
d1b9b1b410 mod/notification-ntfy: support authentication with bearer token
Closes: https://github.com/eworm-de/routeros-scripts/issues/86
2024-12-17 13:21:19 +01:00
Christian Hesse
a7878d664f fw-addr-lists: do not fail on invalid json data 2024-12-17 13:21:19 +01:00
Christian Hesse
b66332eb46 mod/notification-email: $FlushEmailQueue: just return on empty queue 2024-12-17 13:21:14 +01:00
Christian Hesse
8c8c75ca66 mod/notification-email: $FlushEmailQueue: move the check up...
... as this needs to be done before creating a scheduler. 😜

Also remove the scheduler and return.
2024-12-17 11:20:09 +01:00
Christian Hesse
1e2ca3d214 mod/notification-email: $FlushEmailQueue: create scheduler if missing...
... as it is required to be modified several times below.
2024-12-17 11:20:09 +01:00
Christian Hesse
5310673152 mod/notification-email: $FlushEmailQueue: return on purge 2024-12-17 11:20:09 +01:00
Christian Hesse
009a6bd762 mod/notification-email: $FlushEmailQueue: return on success 2024-12-17 11:20:09 +01:00
Christian Hesse
8231c3e833 global-functions: $WaitForFile: delay until "complete"...
Well, turns out that waiting for existence of a file is not sufficient.
Chances are that a file is available just partly, so wait until the size
no longer changes... Let's hope that works as expected. 🤞
2024-12-17 11:20:09 +01:00
Christian Hesse
d70efe910a mode-button: support led toggle without extra script 2024-12-17 11:20:09 +01:00
Christian Hesse
c311e58d99 leds-toggle-mode: toggle in one call...
... and drop the condition.
2024-12-17 11:20:09 +01:00
Christian Hesse
42bcc63d29 mod/notification-email: increase retry interval on failure 2024-12-17 11:20:09 +01:00
Christian Hesse
bceabebf9c mod/notification-email: drop useless safeguard
Guess it was useful back in the day. Now the function exits early if the
queue is empty... So this can never be zero.
2024-12-17 11:19:57 +01:00
Christian Hesse
519cb85e28 Merge branch 'func-exit-error' into next 2024-12-09 11:49:50 +01:00
Christian Hesse
e51191035b mode-button: $ModeButtonScheduler: explicitly name the variable 2024-12-09 11:49:50 +01:00
Christian Hesse
210ef26b93 mod/ssh-keys-import: $SSHKeysImportFile: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
f8a55860af check-routeros-update: pass script name to local function 2024-12-09 11:49:50 +01:00
Christian Hesse
1788c05998 mod/ssh-keys-import: $SSHKeysImport: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
3866ea1923 Merge branch 'exit-error' into next 2024-12-09 11:49:50 +01:00
Christian Hesse
73e0ac75f1 mod/scriptrunonce: $ScriptRunOnce: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
48bcf8ee6e global-functions: $FetchHuge: passing boolean to function is still broken... 🤨 2024-12-09 11:49:50 +01:00
Christian Hesse
ee030740cb update-tunnelbroker: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
4968b79fc1 mod/notification-telegram: $SendTelegram: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
d4ea0e18a7 update-gre-address: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
e89867be15 mod/notification-telegram: $FlushTelegramQueue: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
adbefca0e4 telegram-chat: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
e76ae11b02 mod/notification-ntfy: $SendNtfy: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
a78fe98fd0 sms-forward: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
aac723e2a1 mod/notification-ntfy: $FlushNtfyQueue: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
ede351f47e sms-action: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
de9dee83be mod/notification-matrix: $SendMatrix: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
be05480071 ppp-on-up: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
1994b23e46 mod/notification-matrix: $FlushMatrixQueue: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
81f59f9894 packages-update: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
1927dc505a mod/notification-email: $SendEMail: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
eeb76c227c ospf-to-leds: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
5450618723 mod/notification-email: $FlushEmailQueue: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
bdc15eaefb netwatch-notify: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
34172e4c78 mod/ipcalc: $IPCalc: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
d89a369485 netwatch-dns: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
05cb87f475 mod/inspectvar: $InspectVar: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
b7ce6aee71 mode-button: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
495232b299 mod/bridge-port-vlan: $BridgePortVlan: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
da7a031081 log-forward: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
5db686a15c mod/bridge-port-to: $BridgePortTo: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
177a1e798a lease-script: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
1fe90a6e9a mode-button: $ModeButtonScheduler: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
82de8bd935 ipv6-update: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
5b9031ccca global-functions: $SendNotification: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
a6fd6bd80c ipsec-to-dns: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
8c5bd8f5e2 global-functions: $ScriptInstallUpdate: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
8e12453058 hotspot-to-wpa: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
ff00c27f99 global-functions: $ExitError: give matching message for functions 2024-12-09 11:49:50 +01:00
Christian Hesse
f7b96aa3e9 hotspot-to-wpa-cleanup: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
90cfa83d95 gps-track: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
923a6385bf fw-addr-lists: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
590030d391 firmware-upgrade-reboot: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
c8d423c7d5 dhcp-to-dns: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
87cde2cc2f dhcp-lease-comment: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
f9a6916827 daily-psk.capsman: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
bf322781d1 collect-wireless-mac: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
9d17beef03 check-routeros-update: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
91c8d30655 check-lte-firmware-upgrade: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
451df78dd8 check-health: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
00487f93d4 check-certificates: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
dc7642c1fd certificate-renew-issued: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
172d43288e capsman-rolling-upgrade: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
c909bef613 capsman-download-packages: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
268743ef6b backup-upload: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
95030b9b74 backup-partition: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
2c4053cff5 accesslist-duplicates: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
52b5490bab backup-email: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
36b81fab94 backup-cloud: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
ed6739b8bc global-functions: $ExitError: give script name in message 2024-12-09 11:49:50 +01:00
Christian Hesse
0d69f8952c global-functions: introduce $ExitError...
... as a simple macro to print error message on unintentional error.
2024-12-09 11:49:50 +01:00
Christian Hesse
09e8b1d219 netwatch-dns: explicitly expect type=A...
... which is provided since 7.16beta7 (but require next stable release
7.16 as that is available meanwhile).
2024-11-27 11:56:44 +01:00
Christian Hesse
6548f83ef4 dhcp-to-dns: explicitly expect type=A...
... which is provided since 7.16beta7 (but require next stable release
7.16 as that is available meanwhile).

I had this on my wishlist for a long time, and opened an issue in
March 2023 about it (SUP-111312).

Back then I changed the code to support both, see commit
779b3b8872.
2024-11-27 11:56:44 +01:00
Christian Hesse
e851cd5ad0 mod/ssh-keys-import: require RouterOS 7.16
Actually the requirement bumped with the change in commits:

* 9c945b1a32
  mod/ssh-keys-import: $SSHKeysImportFile: simplify looping lines

* 1f526b3561
  mod/ssh-keys-import: $SSHKeysImport: split with `:deserialize`
2024-11-27 11:56:09 +01:00
Christian Hesse
794525b706 fw-addr-lists: require RouterOS 7.16
Actually the requirement bumped with the change in commit:

* 084c246ef0
  fw-addr-lists: simplify looping lines
2024-11-27 10:00:27 +01:00
Christian Hesse
4d8dce9769 fw-addr-lists: spamhaus.org returned to 'GTS Root R4' 2024-11-22 14:06:22 +01:00
Christian Hesse
08ad4e5194 mode-button: do not act on disabled LED 2024-11-15 23:09:24 +01:00
Christian Hesse
53b6f7720e mode-button: catch runtime errors in executed code 2024-11-15 23:09:24 +01:00
Christian Hesse
1beda3aa7c mode-button: fix the caller parameter to $LogPrint
This is inside a function, so use just $0 here.
2024-11-15 23:01:22 +01:00
Christian Hesse
5b09469cc6 packages-update: drop check for device-mode downgrade...
... as things have been revised and this specific setting was removed.
2024-11-14 21:03:07 +01:00
Christian Hesse
a224fbc424 hotspot-to-wpa-cleanup: revert display of timeout value...
... as the timeout is a time value, and showing "4w00:00:00" (with lots
of zeros) is not any better. 😜

This reverts commit f1533b8962.
2024-11-13 08:59:30 +01:00
Christian Hesse
e5c3aeb5cd hotspot-to-wpa-cleanup: prepare real timeout value in variable...
... to make sure it is not re-calculated for every single lease.
2024-11-13 08:57:05 +01:00
Christian Hesse
ae655646ba hotspot-to-wpa-cleanup: clean up daily only 2024-11-12 18:02:26 +01:00
Christian Hesse
f1533b8962 hotspot-to-wpa-cleanup: use the timeout in message...
... not the actual value.
2024-11-12 17:53:30 +01:00
Christian Hesse
a545d0d39e check-routeros-update: always exit early if up to date...
... and just make the output and log dependent on terminal.
2024-11-12 17:46:02 +01:00
Christian Hesse
04172f0438 check-routeros-update: make invalid version string a warning 2024-11-12 17:42:54 +01:00
Christian Hesse
d97f63fa5a check-routeros-update: add specific message for empty version string 2024-11-12 17:41:54 +01:00
Christian Hesse
6c8fa8e639 check-routeros-update: replace hard-coded version 2024-11-12 17:40:05 +01:00
Christian Hesse
1f526b3561 mod/ssh-keys-import: $SSHKeysImport: split with :deserialize 2024-11-08 09:16:25 +01:00
Christian Hesse
0837391c38 mod/ssh-keys-import: $SSHKeysImportFile: let :deserialize split the fields 2024-11-08 09:16:18 +01:00
Christian Hesse
9c945b1a32 mod/ssh-keys-import: $SSHKeysImportFile: simplify looping lines 2024-11-08 09:15:45 +01:00
Christian Hesse
084c246ef0 fw-addr-lists: simplify looping lines
With `:deserialize` the **record** separator is always a new line. The
property `delimiter=` is a **field** reparator, so you can parse a lines
into an array.

We do not want (or need) that, so use new line as field separator. This
will result in an array with just one element, and we use that.

Also convert the data to line feed explicitly, just to be sure.
2024-11-06 22:42:40 +01:00
Christian Hesse
31dfdf7e62 doc/netwatch-dns: link to 'certificate name from browser' 2024-11-02 21:23:04 +01:00
Christian Hesse
d213369e73 doc/fw-addr-lists: link to 'certificate name from browser' 2024-11-02 21:23:04 +01:00
Christian Hesse
c5740c2328 doc/mod/notification-ntfy: link to 'certificate name from browser' 2024-11-02 21:23:04 +01:00
Christian Hesse
af942d90d3 doc/mod/notification-matrix: link to 'certificate name from browser' 2024-11-02 21:23:04 +01:00
Christian Hesse
3c0852d6b8 introduce CERTIFICATES, guide to find root certificate 2024-11-02 21:23:04 +01:00
Christian Hesse
3506f71071 global-functions: $CertificateAvailable: fail without CommonName 2024-10-30 22:49:48 +01:00
Christian Hesse
a6584170c3 certs: check cert for matrix.org 2024-10-29 15:00:26 +01:00
Christian Hesse
3169270dbd doc/mod/notification-matrix: better document certificate import 2024-10-29 15:00:26 +01:00
Christian Hesse
e803f8b3c0 ipv6-update: create a dynamic address-list entry only
This should make sure that the script runs once after reboot, even if
the prefix does not change.

An existing static entry needs to be removed to make this work!

https://github.com/eworm-de/routeros-scripts/issues/85
2024-10-25 18:20:17 +02:00
Christian Hesse
d022c87651 ipv6-update: ignore if address was acquired
https://github.com/eworm-de/routeros-scripts/issues/85
2024-10-23 21:55:34 +02:00
Christian Hesse
7229c756af fw-addr-lists: spamhaus.org requires 'ISRG Root X1' now 2024-10-23 20:17:44 +02:00
Christian Hesse
07c9576377 packages-update: check for explicit state...
... as all device-mode properties are given since RouterOS 7.14beta4.

Let's assume we do not have to care about RouterOS 7.14beta2 any more...
As older versions will not match the check we can now merge right away.
2024-10-23 20:17:44 +02:00
Christian Hesse
435f70999c backup-partition: drop warning on lock in device-mode
... as switching partitions is possible again in RouterOS 7.17beta4.
2024-10-22 19:32:19 +02:00
Christian Hesse
71c58c6afb doc/netwatch-notify: fix typo(s) 2024-10-10 22:32:46 +02:00
Christian Hesse
f7f50a9d45 doc/netwatch-notify: give an extra example for resolving AAAA records 2024-10-10 22:24:56 +02:00
Christian Hesse
82e3e7a9fc doc/netwatch-notify: always give a host...
... as that is a required property. Any ip address is fine, it is
changed anyway.
2024-10-10 22:20:31 +02:00
Christian Hesse
85a7a16c15 backup-partition: log the warning just once 2024-10-09 14:30:29 +02:00
Christian Hesse
c955c94098 update list of contributors 2024-10-02 14:02:29 +02:00
Christian Hesse
98e62e3eac update list of contributors 2024-10-01 21:42:20 +02:00
Ignacio Serrano
5135e836b8 mod/notification-ntfy: fix ntfy overrides 2024-10-01 20:32:37 +02:00
Christian Hesse
f75e701be3 log-forward: get last message from log...
... not only from matched massages.
2024-09-30 21:51:31 +02:00
Christian Hesse
f2576cf558 packages-update: give warning on lock in device-mode
RouterOS 7.17beta2 introduced some extra security measures, including
some to prevent downgrade attacks for the installation. Detect early
and exit with message and error.

https://help.mikrotik.com/docs/display/ROS/Device-mode
2024-09-30 16:23:50 +02:00
Christian Hesse
1776b8f50b backup-partition: give warning on lock in device-mode
RouterOS 7.17beta2 introduced some extra security measures, including
some to prevent downgrade attacks for the installation. Thus switching
partitions (which can hold quite old installations) is denied by
device-mode now by default. Warn about that...

https://help.mikrotik.com/docs/display/ROS/Device-mode
2024-09-30 16:23:43 +02:00
Christian Hesse
c2c72818de global-functions: $CertificateDownload: add another check...
... that the certificate is really available.

Turns out that mkcert.org ships certificates where OU or whatever
matches - that's not what we want.
2024-09-26 15:24:05 +02:00
Christian Hesse
60aa553219 hotspot-to-wpa-cleanup: only match access-list with mac-address 2024-09-25 11:01:40 +02:00
Christian Hesse
c708832b69 check-routeros-update: use $VersionToNum to calculate bitmask 2024-09-16 11:54:02 +02:00
Christian Hesse
734a80ba82 backup-partition: use $VersionToNum to calculate bitmask 2024-09-13 10:29:06 +02:00
Christian Hesse
41b19b045a global-functions: $VersionToNum: support "zero"...
... to have a clean way to generate bitmasks.

    [admin@mikrotik] > :put [ $VersionToNum 0.255zero0 ]
    16711680
    [admin@mikrotik] > :put 0x00ff0000
    16711680

Once implemented everywhere the internal calculation could be
changed easily.
2024-09-13 10:22:06 +02:00
Christian Hesse
fe52bd4a0a fw-addr-lists: use lists in JSON format for spamhaus.org 2024-09-11 10:49:04 +02:00
Christian Hesse
d23d05f2ea fw-addr-lists: handle JSON format from spamhaus.org
Closes: https://github.com/eworm-de/routeros-scripts/issues/79
2024-09-11 10:48:45 +02:00
Christian Hesse
09dcd51feb netwatch-dns: give warning on CRL use 2024-09-05 09:54:35 +02:00
Christian Hesse
9737bfa46a certs: add poor man's check 😜 2024-09-04 11:55:02 +02:00
Christian Hesse
21fa46fdf6 certs: drop 'Baltimore CyberTrust Root' 2024-08-28 17:59:44 +02:00
Christian Hesse
f4c97559b3 fw-addr-lists: drop edrop.txt, which does no longer exist 2024-08-28 17:56:48 +02:00
Christian Hesse
917be4b425 fw-addr-lists: spamhaus.org requires 'GTS Root R4' now
Fixes: https://github.com/eworm-de/routeros-scripts/issues/78
2024-08-28 17:55:28 +02:00
Christian Hesse
48fd281c1d certs: drop 'DigiCert Global Root CA' 2024-08-27 16:43:35 +02:00
Christian Hesse
90632f223a doc/netwatch-dns: 'DigiCert Global Root G3' for Quad9 2024-08-27 10:59:51 +02:00
Christian Hesse
3e9a7ea75a certs: add 'DigiCert Global Root G3'...
... for quad9.net which can be used for DoH:

$CertificateAvailable "DigiCert Global Root G3";
/ip/dns/set use-doh-server=https://9.9.9.9/dns-query verify-doh-cert=yes;
2024-08-27 09:38:13 +02:00
Christian Hesse
f17502d3d0 check-routeros-update: support switching to stable channel...
... with a feature update in testing channel.
2024-08-20 11:08:05 +02:00
Christian Hesse
d360cc05be netwatch-dns: disable DoH if time not sync...
... as it is possible that time is off, DNS via DoH fails (cert invalid),
and finally syncing time fails due to failing DNS.
2024-08-19 15:10:37 +02:00
Christian Hesse
f952ea73e6 INITIAL-COMMANDS: match the certificate file name from Let's Encrypt website...
... and our README. 😜
2024-08-19 15:10:16 +02:00
Christian Hesse
342d459436 README: match the certificate file name from Let's Encrypt website...
... so import from manually downloaded and transferred file works
out of the box as well.
2024-08-19 15:06:32 +02:00
Christian Hesse
c28574b8f4 README: make the QR code a link 2024-08-19 10:35:37 +02:00
Christian Hesse
32474c751f telegram-chat: drop extra conversion
The JSON parser was actually fixed in RouterOS 7.15beta4, but let's bump
the required version to next stable release instead.
2024-07-25 09:15:41 +02:00
Christian Hesse
a017f24224 daily-psk: drop workaround for old RouterOS 2024-07-25 09:15:41 +02:00
Christian Hesse
209c37664b netwatch-notify: do not switch type when resolving
This requires RouterOS 7.15beta4, but let's bump the required version
to next stable release instead.
2024-07-25 09:15:41 +02:00
Christian Hesse
8f43b802bc INITIAL-COMMANDS: drop command to remove certificate file...
... as this is done automatically with RouterOS 7.15rc1 and later.
2024-07-25 09:11:26 +02:00
Christian Hesse
22d93d0708 README: drop command to remove certificate file...
... as this is done automatically with RouterOS 7.15rc1 and later.

Not bumping the required RouterOS version (badge) here... Worst thing
that can happen is a stale certificate file left on storage.
2024-07-25 09:11:26 +02:00
Christian Hesse
511184a4a7 global-functions: $EitherOr: revert...
... but leave a comment.
2024-07-22 21:14:03 +02:00
Christian Hesse
8ea7805541 global-functions: $EitherOr: pass boolean value
Note that literal "true" or "false" (even without quotes) is converted
to string. So you may have to enclose it in parentheses for a boolean
value:

    > :put [ :typeof [ $EitherOr true false ] ];
    str
    > :put [ :typeof [ $EitherOr (true) (false) ] ];
    bool
2024-07-22 18:28:56 +02:00
Christian Hesse
380b3b3137 Merge branch 'line-breaks' into next 2024-07-16 14:19:17 +02:00
Christian Hesse
6fbafe76ba bump RouterOS requirement for all scripts and modules...
... now that global-functions requires RouterOS 7.14 anyway.
2024-07-16 13:50:22 +02:00
Christian Hesse
075a9bd6c4 mod/ipcalc: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
2b758b83fd mod/inspectvar: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
2fd0d27447 global-functions: $Unix2Dos: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
8f75d542f3 global-functions: $PrettyPrint: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
8074305b92 global-functions: $Dos2Unix: use :tolf 2024-07-16 13:50:22 +02:00
Christian Hesse
f2ca62aed0 global-functions: $ScriptInstallUpdate: support storing with CRLF
Adding this in `global-config-overlay` make the scripts being stored
with CRLF line breaks:

    :global ScriptUpdatesCRLF true;

Handle with care, I do not recommend it. Thus it's just a hidden
setting.
2024-07-16 13:50:22 +02:00
Christian Hesse
a26f78329a ppp-on-up: support scripts with CRLF line breaks 2024-07-16 13:50:22 +02:00
Christian Hesse
ee928605df news-and-changes: support scripts with CRLF line breaks 2024-07-16 13:50:22 +02:00
Christian Hesse
7cf0c5b205 capsman-download-packages: support scripts with CRLF line breaks 2024-07-16 13:50:22 +02:00
Christian Hesse
68f61ae622 global-functions: $ScriptInstallUpdate: allow CRLF on device 2024-07-16 13:50:22 +02:00
Christian Hesse
2d42fed621 global-functions: $ScriptInstallUpdate: forcibly convert to LF...
... to make sure we do not have unintended CRLF line breaks.
2024-07-16 13:50:22 +02:00
Christian Hesse
0101b56bff README: use :tocrlf to convert global-config-overlay 2024-07-16 13:50:22 +02:00
Christian Hesse
f09fa83105 doc/mod/ssh-keys-import: drop hint on older RouterOS 2024-07-16 13:49:54 +02:00
Christian Hesse
3fd1896ad6 capsman-download-packages: support running several scripts...
... as it is possible to have more than just one providing
the functionality.
2024-07-11 08:57:09 +02:00
Christian Hesse
78dfc568c1 capsman-{download-packages,rolling-upgrade}: run matching script
It is possible to run old and new CAPsMAN on one system simultaneously
(... since RouterOS 7.13?). Thus it may make sense to have both variants
of these scripts installed, and we have to make sure to run the correct
one.
2024-07-11 08:45:53 +02:00
Christian Hesse
35d3c058b8 update list of contributors 2024-07-10 11:02:53 +02:00
Christian Hesse
25135b64e5 backup-partition: check that target is inactive 2024-07-08 10:05:11 +02:00
Christian Hesse
235737c232 backup-partition: check the fallback partition actually exists...
... and use its id for actions.
2024-07-08 10:04:57 +02:00
Christian Hesse
1bc6f9c45c backup-partition: rename variable 2024-07-05 15:19:11 +02:00
Christian Hesse
64bc9f73f7 packages-update: run backups before package download
This reduces memory pressure, especially on device with very limited RAM
like mAP with its 64 MB.
2024-07-04 15:31:43 +02:00
Christian Hesse
eab9b28cd2 global-functions: $MkDir: enable tmpfs if disabled 2024-07-04 15:31:43 +02:00
Christian Hesse
ce1b635eb2 global-functions: $GetMacVendor: cert 'GTS Root R4' 2024-07-02 21:29:14 +02:00
Christian Hesse
f3f7d3edc0 check-certificates: limit scope for $CertNew...
... into block where certificate is replaced.

This should unbreak renewing with a certificate updated in place.
2024-06-25 07:58:10 +02:00
Christian Hesse
cdb553d39b global-functions: $CertificateDownload: try fallback to mkcert.org
There's a nice API that allows to download certificate by exact common
name. Let's use that, as a fallback at least.

https://mkcert.org/
2024-06-21 16:04:05 +02:00
Christian Hesse
b35c7b6703 Merge branch 'root-certificates' into next 2024-06-21 15:57:04 +02:00
Christian Hesse
1a6812ef79 notify on changes regarding certificates 2024-06-21 15:57:04 +02:00
Christian Hesse
c4e8d01de1 certs: DigiCert TLS Hybrid ECC SHA384 2020 CA1 -> DigiCert Global Root CA
This is used by Cloudflare DNS Quard9 (9.9.9.9).

$CertificateAvailable "DigiCert Global Root CA";
/ip/dns/set use-doh-server=https://9.9.9.9/dns-query verify-doh-cert=yes;
2024-06-21 15:57:04 +02:00
Christian Hesse
a05efdc07f certs: DigiCert Global G2 TLS RSA SHA256 2020 CA1 -> DigiCert Global Root G2
This is used by Cloudflare DNS (1.1.1.1).

$CertificateAvailable "DigiCert Global Root G2";
/ip/dns/set use-doh-server=https://1.1.1.1/dns-query verify-doh-cert=yes;
2024-06-21 15:57:04 +02:00
Christian Hesse
588dacb5af certs: Go Daddy Secure Certificate Authority - G2 -> Go Daddy Root Certificate Authority - G2 2024-06-21 15:57:04 +02:00
Christian Hesse
0ae3d31c58 certs: GTS CA 1C3 / GTS CA 1P5 -> GTS Root R1 2024-06-21 15:57:04 +02:00
Christian Hesse
a744508d4f certs: Starfield Secure Certificate Authority - G2 -> Starfield Root Certificate Authority - G2 2024-06-21 15:57:04 +02:00
Christian Hesse
7553870f2a certs: Cloudflare Inc ECC CA-3 -> Baltimore CyberTrust Root 2024-06-21 15:57:04 +02:00
Christian Hesse
944e125ef9 certs: Certum Domain Validation CA SHA2 -> Certum Trusted Network CA 2024-06-21 15:57:04 +02:00
Christian Hesse
b875d64724 certs: GlobalSign Atlas R3 DV TLS CA 2022 Q3 -> GlobalSign 2024-06-21 15:57:04 +02:00
Christian Hesse
3f51ebc125 certs: R3 / R10 -> ISRG Root X1 2024-06-21 15:57:04 +02:00
Christian Hesse
d1693a241b certs: E1 / E5 -> ISRG Root X2
In the beginning of Let's Encrypt their root certificate ISRG Root X1
was not widely trusted, at least some older and/or mobile platforms were
missing that certificate in their root certificate store.
At that time Let's Encrypt was using an alternative chain of trust,
where a certificate was cross-signed with DST Root CA X3.

To make sure a valid chain of trust is available under all circumstances
a set of all certificates had to be supplied: both root vertificates
ISRG Root X1 & DST Root CA X3, and an intermediate certificate.
This was still true after DST Root CA X3 expired, as it could still be
used as a root anchor and was shipped by Let's Encrypt when requested. 🤪

This time is finally over, and we have a clean chain for trust ending in
ISRG Root X1 (or ISRG Root X2).
Well, actually it is the other way round... Let's Encrypt signs with
different tantamount intermediate certificates. There is not only E5, but
also E6 - and we can not know beforehand which one is used on renew.

So let's jetzt drop the intermediate certificates now, and rely on root
certificates only. We are perfectly fine with this these days.

Follow-up commits will do the same for *all* certificates.

The certificate is downloaded with:

    curl -d '["ISRG Root X2"]' https://mkcert.org/generate/ | grep -v '^$' > certs/ISRG-Root-X2.pem
2024-06-21 15:55:45 +02:00
Christian Hesse
35f4ec0b1d doc/mod/notification-matrix: drop certificate hint...
... as matrix.org switched to Let's Encrypt with ISRG Root X2.
2024-06-20 10:45:03 +02:00
Christian Hesse
76dd069fa6 Let's Encrypt changed their intermediate certificates
https://letsencrypt.org/2024/03/19/new-intermediate-certificates
https://letsencrypt.org/certificates/

But let's keep the old ones around for now, as some sites are still
using the old intermediate.
2024-06-19 09:29:23 +02:00
Christian Hesse
d01362dbaa unattended-lte-firmware-upgrade: check on valid version first 2024-06-11 21:14:05 +02:00
Christian Hesse
1e1c9be945 unattended-lte-firmware-upgrade: drop the AT reset
The AT command to reset is specific to modem. So this worked for some
only... Let's just drop it, and update the log message.
2024-06-11 21:09:06 +02:00
Christian Hesse
2166f262c8 unattended-lte-firmware-upgrade: omit just another once 2024-06-11 21:07:17 +02:00
Christian Hesse
9c899f871d backup-cloud: remove trailing spaces
How did I produce these!? 😳
2024-06-10 18:11:37 +02:00
netravnen
c2dd9de9b1 unattended-lte-firmware-upgrade: omit once
Omit `once` from the `/interface/lte/firmware-upgrade` command to make
sure it does acutally return a valid result.

Fixes #69
2024-06-10 12:20:24 +02:00
netravnen
0a085e6610 check-lte-firmware-upgrade: omit once
Omit `once` from the `/interface/lte/firmware-upgrade` command to make
sure it does acutally return a valid result.
2024-06-10 12:20:24 +02:00
Christian Hesse
cd4ac2c088 backup-cloud: log note on previous connection errors 2024-06-05 15:05:43 +02:00
Christian Hesse
e35ba4b06c global-functions: $CleanName: no exception for dash...
... as we still want to deduplicate it when it is inside the input
string. This also unbreak certificate import for "Go Daddy Secure
Certificate Authority - G2" (and more)...
2024-06-01 23:06:24 +02:00
Christian Hesse
a97820d12a telegram-chat: drop extra parenthesis 2024-05-25 19:55:13 +02:00
Christian Hesse
d664856326 telegram-chat: convert the message (command) to string
RouterOS 7.15beta4 fixed a bug in JSON parser:

*) console - do not convert string to array in ":deserialize" command;

Before that change commands with a comma caused very crazy issues. Let's
convert the message to a string. This does not give exactly the expected
result, but mitigates telegram-chat to explode.

A command like...

    /ip/address/print proplist=address,network;

... is converted to...

    /ip/address/print proplist=address;network;

... and results in:

    Columns: ADDRESS
    # ADDRESS
    0 10.0.0.1/24
    1 127.0.0.1/8
    bad command name network (line 1 column 36)
2024-05-24 20:30:55 +02:00
Christian Hesse
96ea39b7cd Merge branch 'backup-partition' into next 2024-05-23 12:52:33 +02:00
Christian Hesse
33a495beb7 backup-partition: news on support for copy-over 2024-05-23 12:27:23 +02:00
Christian Hesse
0a46fb536f doc/backup-upload: fix link for backup-partition 2024-05-23 12:11:41 +02:00
Christian Hesse
affa118161 backup-partition: support copy before feature update 2024-05-23 12:11:41 +02:00
Christian Hesse
16831aa1e8 doc/backup-email: fix link for backup-partition 2024-05-23 12:11:41 +02:00
Christian Hesse
6cbe13a135 backup-partition: move code to a local function 2024-05-23 12:11:41 +02:00
Christian Hesse
c26e44ae46 doc/backup-cloud: fix link for backup-partition 2024-05-23 12:11:41 +02:00
Christian Hesse
51331ea2ac backup-partition: support RouterOS copy-over...
... when run interactively from CLI.
2024-05-23 12:11:41 +02:00
Christian Hesse
787ae4440c daily-psk: quote ssid and passphrase 2024-05-15 15:54:12 +02:00
Christian Hesse
169c1ab6e1 daily-psk: decrease indention in notification 2024-05-15 15:52:28 +02:00
Christian Hesse
ca7a592dfd daily-psk: adopt syntax changes
RouterOS 7.15beta8 came with this change:

*) wifi - show inherited properties with "print" command (replaces "actual-configuration") and added "print config" for showing only configured values;

While the old code is bad syntax with RouterOS 7.15, the new code is
valid for older RouterOS, but produces different (and more or less
unexpected) results. 🥴

Let's use the new code, and add a check on the RouterOS version.
With old RouterOS this now sends the notification even if the interface
is disabled.
2024-05-15 15:52:28 +02:00
Christian Hesse
545fb5583a global-functions: $IsTimeSync: initialize with uptime...
... to make sure the warning is not issued too early.
2024-05-15 15:52:28 +02:00
Christian Hesse
c87a7519fe fw-addr-lists: add 'strongips' list from blocklist.de 2024-05-14 11:36:58 +02:00
Christian Hesse
2745597b93 global-functions: $IsTimeSync: add (one time) warning on failed ntp sync 2024-05-08 14:25:31 +02:00
Christian Hesse
fb7170f312 global-functions: $IsTimeSync: log just once 2024-05-08 12:30:13 +02:00
Christian Hesse
eae8dbbb37 global-functions: $WaitForFile: drop extra conversion 2024-04-29 23:02:48 +02:00
Christian Hesse
517ed7bf8c global-functions: $WaitForFile: respect minimum delay 2024-04-29 23:02:48 +02:00
Christian Hesse
52ec6b7ea1 global-functions: $WaitForFile: use fewer steps 2024-04-29 23:02:48 +02:00
Christian Hesse
6ba1faca4c telegram-chat: shorten the message 2024-04-29 23:02:48 +02:00
Christian Hesse
40f13b6ca4 mod/notification-telegram: format percentage italic 2024-04-29 23:02:48 +02:00
Christian Hesse
0fd1e506ba mod/notification-telegram: format date & time italic 2024-04-29 23:02:48 +02:00
Christian Hesse
f8856ae742 mod/notification-telegram: support excluding characters from escaping...
... to support formatting in plain text.

Handle with care, this can break the request if done wrong!
2024-04-29 23:02:48 +02:00
Christian Hesse
4b6cd7ba29 mod/notification-telegram: use proper variable naming...
... in local escaping function.
2024-04-29 23:02:48 +02:00
Christian Hesse
d6e315580b mod/notification-telegram: capitalize Telegram in message 2024-04-29 23:02:48 +02:00
Christian Hesse
e7cdb2d7f4 mod/notification-matrix: format date & time italic 2024-04-29 23:02:48 +02:00
Christian Hesse
755db5d66d global-functions: $CleanName: do not start with a dash 2024-04-29 23:02:48 +02:00
Christian Hesse
b0f58696f3 mod/ssh-keys-import: remove temporary directory 2024-04-29 23:02:48 +02:00
Christian Hesse
f1ad808734 mod/ssh-keys-import: create directory later 2024-04-29 23:02:48 +02:00
Christian Hesse
4006d07222 global-functions: $FetchHuge: remove temporary directory 2024-04-29 23:02:48 +02:00
Christian Hesse
57ebcfb41c backup-cloud: retry on error...
Let's see if brute force helps. 🤪
2024-04-29 23:02:48 +02:00
Christian Hesse
5f1656b7ce backup-cloud: clean up and simplify code 2024-04-29 18:03:40 +02:00
Christian Hesse
505074e6d3 backup-cloud: no early exit...
... as we want to make sure the directory (and its content) is removed.
2024-04-29 18:03:40 +02:00
Christian Hesse
b3b7643661 backup-upload: no early exit... 2024-04-29 18:03:40 +02:00
Christian Hesse
db1faf1091 backup-upload: remove temporary directory 2024-04-23 14:22:24 +02:00
Christian Hesse
63786b7814 netwatch-notify: log to debug...
... instead of discarding the message completely.
2024-04-23 10:44:59 +02:00
Christian Hesse
b0e4449e4f README: show fingerprints in output
This is not scrictly necessary, as we filter by fingerprint already...
But it gives better overview and feeling.
2024-04-19 13:17:09 +02:00
Christian Hesse
de8da38a0c README: remove left over certificate file
But use find as RouterOS 7.15rc1 removes it automatically.
2024-04-19 13:17:09 +02:00
Christian Hesse
e42f8843bd INITIAL-COMMANDS: remove the certificate file with find
Required as RouterOS 7.15rc1 removes it automatically.
2024-04-19 13:17:01 +02:00
Christian Hesse
0f2a4aedab global-functions: $CertificateDownload: remove with find...
... to make sure this does not break when the file does no longer
exist. Starting with RouterOS 7.15rc1 the file is automatically
removed on import.
2024-04-19 11:46:17 +02:00
Christian Hesse
b0cd53f813 netwatch-notify: allow to suppress resolve failure 2024-04-19 11:25:18 +02:00
Christian Hesse
ee54956a69 mod/notification-telegram: string protocol for display 2024-04-19 09:09:13 +02:00
Christian Hesse
8cd03167ca mod/notification-matrix: string protocol for display 2024-04-19 09:04:08 +02:00
Christian Hesse
6fd0becf64 global-functions: introduce $ProtocolStrip 2024-04-19 08:59:51 +02:00
Christian Hesse
b50a5b294a mod/notification-matrix: ... and more double escaping 2024-04-18 21:47:50 +02:00
Christian Hesse
3a36db6de8 mod/notification-matrix: fix double escaping
That was introduced with 2a232ad2f5 when
switching to :serialize...
2024-04-18 09:04:34 +02:00
Christian Hesse
8c1543a402 certificate-renew-issued: use single quotes 2024-04-15 09:11:25 +02:00
Christian Hesse
e1781fb805 global-functions: $CertificateDownload: use single quotes 2024-04-15 09:11:25 +02:00
Christian Hesse
7aa5059f6d global-functions: $CertificateAvailable: use single quotes 2024-04-15 09:11:25 +02:00
Christian Hesse
5736ecebc5 gps-track: use custom user agent string 2024-04-15 09:11:25 +02:00
Christian Hesse
d31afc9ec3 gps-track: generate JSON with :serialize 2024-04-15 09:11:25 +02:00
Christian Hesse
2a232ad2f5 mod/notification-matrix: generate JSON with :serialize 2024-04-15 09:11:25 +02:00
Christian Hesse
9dfa11eac5 mod/notification-matrix: use custom user agent string 2024-04-15 09:11:25 +02:00
Christian Hesse
fb865ba114 mod/notification-ntfy: use custom user agent string 2024-04-15 09:11:25 +02:00
Christian Hesse
ca2e5f2a01 mod/notification-ntfy: support basic auth
Closes #59
2024-04-15 09:11:17 +02:00
Christian Hesse
5f76c245b0 global-functions: $ScriptFromTerminal: check multiple invocations...
... and return false.

We can not tell which job is us... So better safe than sorry.
2024-04-11 14:03:43 +02:00
Christian Hesse
6db3355858 global-functions: $ScriptLock: break long lines 2024-04-11 13:41:49 +02:00
Christian Hesse
e53c31e9e6 global-functions: $ScriptLock: degrade message to debug 2024-04-11 13:41:49 +02:00
Christian Hesse
9e4749a5b7 mod/notification-telegram: $SendTelegram: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
9e2b72ccdc mod/notification-ntfy: $SendNtfy: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
a9b9f853ff mod/notification-matrix: $SendMatrix: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
012d259ca1 mod/notification-email: $SendEMail: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
c5a5fb5836 global-functions: $SendNotification: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
3015743b19 global-functions: $HumanReadableNum: indicate binary base...
... and update scripts to match the change.
2024-04-07 22:51:24 +02:00
Christian Hesse
36cf4d028b global-functions: drop $LogPrintExit2 2024-04-07 22:51:24 +02:00
Christian Hesse
009674b5bc bump RouterOS requirement for all scripts and modules...
... now that global-functions requires RouterOS 7.13 anyway.
2024-04-07 22:51:24 +02:00
Christian Hesse
d430d32a30 Merge branch 'fw-addr-lists' into next 2024-04-07 22:51:24 +02:00
Christian Hesse
c4d2ea19dd fw-addr-lists: break long lines 2024-04-07 22:51:24 +02:00
Christian Hesse
19c52ed2a7 fw-addr-lists: show count of active addresses 2024-04-07 22:51:24 +02:00
Christian Hesse
491d85000d fw-addr-lists: human readable numbers for counts 2024-04-07 22:45:54 +02:00
Christian Hesse
70cc1ff53b fw-addr-lists: rework log messages, always include list name 2024-04-07 22:45:34 +02:00
Christian Hesse
af6556bdba fw-addr-lists: add debug message on successful download 2024-04-07 22:44:34 +02:00
Christian Hesse
4b6d0c02f1 fw-addr-lists: try with less regexp matches 2024-04-07 22:21:10 +02:00
Christian Hesse
c3809f240d fw-addr-lists: use $FetchHuge 2024-04-07 22:21:10 +02:00
Christian Hesse
fadc59c562 Merge branch 'FetchHuge' into next 2024-04-06 01:13:27 +02:00
Christian Hesse
402f847db2 global-functions: $FetchHuge: remove file on failed download 2024-04-06 00:47:21 +02:00
Christian Hesse
61ee5cbd6c global-functions: $FetchHuge: make sure to work with clean file names 2024-04-06 00:47:21 +02:00
Christian Hesse
2edf983698 global-functions: $FetchHuge: control check-certificate with parameter 2024-04-06 00:47:16 +02:00
Christian Hesse
ab6fd88558 global-functions: $FetchHuge: use custom user agent string 2024-04-06 00:45:50 +02:00
Christian Hesse
5323052290 global-functions: introduce $FetchHuge 2024-04-06 00:43:39 +02:00
Christian Hesse
86d0f71acb README: update screenshot on lease script setup 2024-04-04 21:15:07 +02:00
Christian Hesse
d86b7dcfcc update list of contributors 2024-04-04 21:13:37 +02:00
netravnen
1d8347d8ea README: add start-time & change interval in scheduler example
Set the interval to once a day, Instead of every 1 hour.

Add start-time to start-up. Thereby introducing randomization based on when
the user last rebooted there device. As the interval is counted based on last
boot time.
2024-04-04 21:13:37 +02:00
Christian Hesse
444f56f9b4 update list of contributors 2024-04-04 19:11:09 +02:00
Christian Hesse
6f68406803 mod/notification-matrix: add new configuration snippet...
... instead of appending to global-config-overlay.
2024-04-02 00:14:39 +02:00
Christian Hesse
e107247c16 Merge branch 'deserialize' into next 2024-04-02 00:08:44 +02:00
Christian Hesse
4db91ec16e global-functions: drop $ParseJson 2024-04-02 00:08:44 +02:00
Christian Hesse
c01a424f4f telegram-chat: read file content...
... instead of getting it. This lifts the size limit, though we are
still limited by Telegram message size.

This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
bb237dcef3 mod/notification-matrix: use :deserialize ...
... instead of $ParseJson. This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
29bcbc4db9 mod/notification-telegram: use :deserialize ...
... instead of $ParseJson. This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
7e5010a608 telegram-chat: use :deserialize ...
... instead of $ParseJson. This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
15ca80fbf7 Merge branch 'aprils-fool' 2024-03-31 23:06:26 +02:00
Christian Hesse
1e47c909f0 news on April's Fool! 🥳 2024-03-31 23:05:33 +02:00
Christian Hesse
bdcf5b3275 news on charge and fees 2024-03-31 21:48:47 +02:00
Christian Hesse
4df1468e25 global-functions: rename $FetchUserAgent -> $FetchUserAgentStr
... to make sure the function does not clash with the variable we had before,
as this causes issue with news and changes notification.
2024-03-29 11:11:17 +01:00
Christian Hesse
bbdc9c65f5 global-functions: $HumanReadableNum: set declared function only 2024-03-27 23:02:38 +01:00
Christian Hesse
acf8e88db2 global-functions: $AlignRight: set declared function only 2024-03-27 23:02:38 +01:00
Christian Hesse
1d816d94f6 global-functions: $FetchUserAgent: set declared function only 2024-03-27 23:02:22 +01:00
Christian Hesse
7212d8bd23 packages-update: do not reboot when scheduled 2024-03-27 22:17:06 +01:00
Christian Hesse
43ecec854f global-functions: $LogPrintOnce: detect and warn on possible crash 2024-03-27 08:32:49 +01:00
Christian Hesse
bd2301a28c global-functions: $LogPrintOnce: indicate action via return 2024-03-26 13:59:03 +01:00
Christian Hesse
9ec8b9c03f fw-addr-lists: one more interation on download failure...
... with even more delay. This script is called with long interval from
scheduler, so should not be an issue.
2024-03-26 08:37:07 +01:00
Christian Hesse
f72aadfc59 telegram-chat: note active state when answering broadcast 2024-03-21 21:11:38 +01:00
Christian Hesse
cc81e55649 telegram-chat: improve readability with symbols 2024-03-21 14:28:23 +01:00
Christian Hesse
6628d9f966 netwatch-notify: pass script name into local functions 2024-03-20 13:59:44 +01:00
Christian Hesse
81f1d9aa99 check-certificates: pass script name into local function 2024-03-20 13:55:55 +01:00
Christian Hesse
6845eb69b3 global-config: put example fw-addr-lists into repository 2024-03-20 13:34:37 +01:00
Christian Hesse
be231ce4f3 global-config: prepare a (commented) address-list for Mikrotik
This is AS51894: https://bgp.he.net/AS51894
2024-03-18 13:46:46 +01:00
Christian Hesse
079249f3d7 check-routeros-update: use custom user agent string 2024-03-18 09:31:40 +01:00
Christian Hesse
cd371b69a6 global-functions: $CertificateDownload: download via clean name...
... and rename certificates in repository.
2024-03-16 23:34:33 +01:00
Christian Hesse
eb7919c1d8 global-functions: generate user agent string in function...
... and add the caller and my shortened url.
2024-03-16 23:10:47 +01:00
Christian Hesse
576a2c97cf global-functions: $LogPrintExit2: add deprecation warning 2024-03-15 14:42:50 +01:00
Christian Hesse
2cf4f333d4 README: add QR code with (shortened) upstream url 2024-03-15 11:26:44 +01:00
Christian Hesse
eb03a4608b global-functions: $ScriptInstallUpdate: use shorter url 2024-03-15 10:05:32 +01:00
Christian Hesse
9b4e5ce369 global-functions: $SymbolByUnicodeName: add these for later use 2024-03-14 22:12:03 +01:00
Christian Hesse
3d4a14d449 netwatch-notify: pass link to notification
This is pass verbatim below the notification text.
2024-03-13 09:02:04 +01:00
Christian Hesse
ccfbabde5e mod/notification-email: clean name for display name 2024-03-12 22:36:29 +01:00
Christian Hesse
c016a6ef47 mod/notification-email: add display name with identity (if not given) 2024-03-12 22:36:29 +01:00
Christian Hesse
44fc69e82d packages-update: drop RouterOS version check...
... and allow all updates again. This requires RouterOS 7.13.
2024-03-12 21:39:38 +01:00
Christian Hesse
b829ec1fc9 mod/ssh-keys-import: do not exit with error 2024-03-12 20:37:57 +01:00
Christian Hesse
0e2e7efdb2 mod/scriptrunonce: do not exit with error 2024-03-12 20:37:57 +01:00
Christian Hesse
c2dc8a0837 mod/notification-matrix: do not exit with error 2024-03-12 20:37:57 +01:00
Christian Hesse
525e4325da mod/bridge-port-vlan: do not exit with error 2024-03-12 20:37:57 +01:00
Christian Hesse
39dd1f2a63 mod/bridge-port-to: do not exit with error 2024-03-12 20:37:57 +01:00
Christian Hesse
ba2df80f07 Merge branch 'LogPrint' into next 2024-03-12 20:37:57 +01:00
Christian Hesse
19802c0b69 global-functions: $LogPrintOnce: drop support for exit
This is not widely adopted or used, so let's just drop it - no
compatibility.
2024-03-12 20:37:57 +01:00
Christian Hesse
242ecef012 update-tunnelbroker: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
76f65c13d7 global-functions: add architecture in user-agent string 2024-03-12 20:37:57 +01:00
Christian Hesse
9a21f4d3e3 update-gre-address: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
1c61547284 global-config: merge loading overlay and snippets 2024-03-12 20:37:57 +01:00
Christian Hesse
19fb5c5801 telegram-chat: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
be1aeccbe5 sms-forward: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
5a487d15c2 sms-action: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
88d4c0aff8 ppp-on-up: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
8444e5f270 packages-update: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
ad65b62c1c ospf-to-leds: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
030105cc2e netwatch-notify: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
8ea24540c4 netwatch-dns: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
e3d55819ee mode-button: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
eedf092930 mod/ssh-keys-import: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
8c62c31604 mod/scriptrunonce: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
699f09c282 mod/notification-telegram: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
fb88521ed5 mod/notification-ntfy: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
279993e965 mod/notification-matrix: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
9b8d3f7970 mod/notification-email: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
bdcf43a6f6 mod/bridge-port-vlan: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
b7983d18c4 mod/bridge-port-to: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
f8c79abd38 log-forward: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
29a72e54dc lease-script: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
1f938efcaf ipv6-update: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
56e39123b9 ipsec-to-dns: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
369af47374 hotspot-to-wpa: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
d93ffb9cb2 hotspot-to-wpa-cleanup: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
5c567604ff gps-track: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
9dd1b768ee global-functions: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
6715696ba1 fw-addr-lists: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
c8e4cb0526 firmware-upgrade-reboot: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
5c775fdb3f dhcp-to-dns: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
5638bdcc2d dhcp-lease-comment: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
4ab8dbd774 daily-psk: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
5016f4d28c collect-wireless-mac: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
a996bdac2a check-routeros-update: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
7f154a178b check-lte-firmware-upgrade: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
463393647f check-health: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
3625808749 check-certificates: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
7c38b9a35c certificate-renew-issued: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
12435ff1c5 capsman-rolling-upgrade: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
e40da1e7e4 capsman-download-packages: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
ca822e1358 backup-upload: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
b879f8fef2 backup-partition: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
4b69144ee4 backup-email: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
ac3b755fdc backup-cloud: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
1feeed145d global-functions: introduce $LogPrint, deprecate $LogPrintExit2 2024-03-12 20:37:57 +01:00
Christian Hesse
a7cb3e520a global-config: support loading snippets
This adds support for loading snippets, which need a name starting with
"global-config-overlay.d/". This allows to split off configuration if
desired.
2024-03-12 20:36:21 +01:00
Christian Hesse
e39e8a0083 backup-upload: pass failure to packages-update 2024-03-12 15:27:15 +01:00
Christian Hesse
51b00181cf backup-partition: pass failure to packages-update 2024-03-12 15:27:15 +01:00
Christian Hesse
5f41bd1c1e backup-email: pass failure to packages-update 2024-03-12 15:27:15 +01:00
Christian Hesse
c82f776632 backup-cloud: pass failure to packages-update 2024-03-12 15:27:15 +01:00
Christian Hesse
3fcdd395fe packages-update: support passing backup failure 2024-03-12 15:27:15 +01:00
Christian Hesse
ffa31c7ad7 packages-update: increate log severity on canceled non-interactive update 2024-03-12 15:27:15 +01:00
Christian Hesse
6fd39bd3c5 Merge branch 'do-with-on-error' into next 2024-03-12 15:27:15 +01:00
Christian Hesse
b86d631486 doc/telegram-chat: show usage of persistent ids 2024-03-12 15:27:15 +01:00
Christian Hesse
f0856c264e update-tunnelbroker: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
a0a2046373 Merge branch 'doc-badges' into next 2024-03-12 15:27:15 +01:00
Christian Hesse
febd13af13 update-gre-address: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
09393d3ef5 check-certificates: handle formatting of self signed cert 2024-03-12 15:27:15 +01:00
Christian Hesse
4061661a20 doc/update-tunnelbroker: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
738dd11929 telegram-chat: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
53ff8fbf97 check-certificates: exit block on failed import 2024-03-12 15:27:15 +01:00
Christian Hesse
a0a964fa18 doc/update-gre-address: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
ac38e16944 sms-forward: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
a7cd7d9500 Merge branch 'drop-wifiwave2' into next 2024-03-12 15:27:15 +01:00
Christian Hesse
11832a7651 doc/unattended-lte-firmware-upgrade: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
e19a48682e sms-action: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
050ccd490e backup-cloud: add a short delay
Not sure it helps, but chances are...
2024-03-12 15:27:15 +01:00
Christian Hesse
83dbcfecd5 news on wifiwave2 EOL 2024-03-12 15:27:15 +01:00
Christian Hesse
2ac18b1cdf doc/telegram-chat: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
1db1a943e2 ppp-on-up: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
955ee8499b backup-cloud: catch error with :execute workaround
Catching a runtime error here fails... So let's try a workaround
with :execute...
2024-03-12 15:27:15 +01:00
Christian Hesse
d513ea61cf hotspot-to-wpa-cleanup: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
8a439ea15c doc/super-mario-theme: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
1012d9fc51 packages-update: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
010bea56dc telegram-chat: error when making directory fails 2024-03-12 15:27:15 +01:00
Christian Hesse
0385c032e2 hotspot-to-wpa: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
3995e85ccf doc/sms-forward: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
850e8db975 ospf-to-leds: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
ed790dea6e mod/notification-email: remove extra spaces 2024-03-12 15:27:15 +01:00
Christian Hesse
074e70ee51 dhcp-lease-comment: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
42d8fed577 doc/sms-action: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
18ed12e3f7 netwatch-notify: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
4e1362aacc mod/inspectvar: remove extra spaces 2024-03-12 15:27:15 +01:00
Christian Hesse
decb8fb17a daily-psk: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
2038480b00 doc/ppp-on-up: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
8fcb8efbea netwatch-dns: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
0d35a18c71 global-wait: drop unused variable 2024-03-12 15:27:15 +01:00
Christian Hesse
b414608329 collect-wireless-mac: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
4ff543e629 doc/packages-update: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
4dd6bdef31 mode-button: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
c462c0b598 Merge branch 'no-error-on-exit' into next 2024-03-12 15:27:15 +01:00
Christian Hesse
e8c5585cc7 capsman-rolling-upgrade: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
6786fbb292 doc/ospf-to-leds: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
52f54baea0 log-forward: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
ada9153636 global-functions: $ScriptLock: fix wording...
... as this does (no longer) abort.
2024-03-12 15:27:15 +01:00
Christian Hesse
34620ba53c capsman-download-packages: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
cdc0db3b81 doc/netwatch-notify: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
6546e7f085 lease-script: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
1e8918fdaa global-functions: $ScriptLock: do not exit from global function 2024-03-12 15:27:15 +01:00
Christian Hesse
9ecc3c4c49 accesslist-duplicates: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
fe83328a57 doc/netwatch-dns: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
6f91c97b7f ipv6-update: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
56e97dd60c global-functions: $DownloadPackage: do not exit from global function 2024-03-12 15:27:15 +01:00
Christian Hesse
d799edfc17 Makefile: drop support for wifiwave2 2024-03-12 15:27:15 +01:00
Christian Hesse
2170505beb doc/mode-button: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
341e84682c ipsec-to-dns: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
4004d713aa sms-forward: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
1934c63512 doc/mod/ssh-keys-import: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
54638924e4 hotspot-to-wpa: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
ec90695e8f packages-update: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
564a288c4c doc/mod/scriptrunonce: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
b622f47d65 hotspot-to-wpa-cleanup: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
c6639518bc lease-script: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
4313de6c68 doc/mod/notification-telegram: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
47b67af226 gps-track: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
3acdebad04 hotspot-to-wpa: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
db211a9804 doc/mod/notification-ntfy: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
c1362f54e5 fw-addr-lists: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
ab0b2e27c3 firmware-upgrade-reboot: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
4a08c09129 doc/mod/notification-matrix: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
894c36fc15 firmware-upgrade-reboot: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
184a769eeb check-routeros-update: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
e2823d8746 doc/mod/notification-email: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
ef5972e9f0 dhcp-to-dns: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
5af8b95444 netwatch-dns: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
732b86bb86 doc/mod/ipcalc: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
0d1c4cece2 dhcp-lease-comment: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
6712cc101d check-health: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
73d56b3d5f doc/mod/inspectvar: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
f79206a9b8 daily-psk: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
7fa03ab70e log-forward: do not exit with error 2024-03-12 15:27:15 +01:00
Christian Hesse
9cd84ddffe doc/mod/bridge-port-vlan: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
4ada2e7678 collect-wireless-mac: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
202096c610 doc/mod/bridge-port-to: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
7110b29cba check-routeros-update: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
b6983c8615 doc/log-forward: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
b78556ca41 check-lte-firmware-upgrade: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
91e94c6e38 doc/leds-mode: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
7bf36fa8a5 check-health: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
fd1cb3131d doc/lease-script: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
b1e37c2734 check-certificates: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
8b5c919d8c doc/ipv6-update: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
78f65ead59 certificate-renew-issued: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
c645ab5100 doc/ipsec-to-dns: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
25c9bff6f3 capsman-rolling-upgrade: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
ac51956c3f doc/ip-addr-bridge: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
03309d4fdb capsman-download-packages: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
b45b7606a9 doc/hotspot-to-wpa: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
8d020a4de8 backup-upload: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
e2f6401a15 doc/gps-track: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
b8bd64bac5 backup-partition: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
8ab1df5960 doc/global-wait: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
3eb8fad5ae backup-email: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
900e868caf doc/fw-addr-lists: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
15c68c5660 backup-cloud: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
2bd2b9b6e3 doc/firmware-upgrade-reboot: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
d0af9d62ea accesslist-duplicates: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
b178e47d6d doc/dhcp-to-dns: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
16b318832a doc/dhcp-lease-comment: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
d1549712ab doc/daily-psk: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
6737c291ca doc/collect-wireless-mac: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
b9b1197c1a doc/check-routeros-update: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
a2afb1d5dc doc/check-lte-firmware-upgrade: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
f68ee9bc00 doc/check-health: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
71ce8709ca doc/check-certificates: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
0c46668e2e doc/certificate-renew-issued: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
50694ec512 doc/capsman-rolling-upgrade: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
9deaed7350 doc/capsman-download-packages: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
a92715ea31 doc/backup-upload: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
acc8cdf8ca doc/backup-partition: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
7b527840b1 doc/backup-email: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
4af1092272 doc/backup-cloud: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
f9fb61ec49 doc/accesslist-duplicates: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
13d0075a48 INITIAL-COMMANDS: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
120d4780fd CONTRIBUTIONS: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
4f3cf3656c BRANCHES: add badges 2024-03-12 15:27:15 +01:00
Christian Hesse
d46156ad92 global-functions: use variable name $ScriptName 2024-03-12 15:27:14 +01:00
Christian Hesse
771ca341b0 Merge branch 'main-function' into next 2024-03-04 21:40:34 +01:00
Christian Hesse
698360f037 update-tunnelbroker: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
ad623f069e update-gre-address: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
6fd745fc0f telegram-chat: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
6b1c6a7119 sms-forward: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
721b6c783b sms-action: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
d6077025b2 ppp-on-up: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
492edb4263 packages-update: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
09ea05d989 ospf-to-leds: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
3c76738915 netwatch-notify: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
458fd1fdcd netwatch-dns: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
400516295e mode-button: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
50e1c45880 log-forward: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
49650d8b14 lease-script: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
d6ea66ccd3 ipv6-update: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
85dbe3a868 ipsec-to-dns: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
a36ec397d6 hotspot-to-wpa: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
2bf02cf085 hotspot-to-wpa-cleanup: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
a0fc6c30ef gps-track: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
480ad0c196 fw-addr-lists: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
cf986caf8d firmware-upgrade-reboot: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
29f544d18d dhcp-to-dns: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
82ec11f2fc dhcp-lease-comment: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
31da6b8bd5 daily-psk: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
e2b87c8634 collect-wireless-mac: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
22eb74cb3a check-routeros-update: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
450ea2fa48 check-lte-firmware-upgrade: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
80180b432d check-health: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
fc3fad5e87 check-certificates: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
2d112c0b33 certificate-renew-issued: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
4cbf9fab74 capsman-rolling-upgrade: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
c2df671d6f capsman-download-packages: move code into function 2024-03-04 17:04:45 +01:00
Christian Hesse
1c26dde356 backup-upload: move code into function 2024-03-04 16:34:01 +01:00
Christian Hesse
0ded98c9e2 backup-partition: move code into function 2024-03-04 16:33:57 +01:00
Christian Hesse
19fb7b61ea backup-email: move code into function 2024-03-04 16:33:54 +01:00
Christian Hesse
33d129496c backup-cloud: move code into function 2024-03-04 16:33:51 +01:00
Christian Hesse
efc2e75f01 accesslist-duplicates: move code into function 2024-03-04 16:33:45 +01:00
Christian Hesse
64aa6ef124 netwatch-notify: check one after another
This can bring an extra delay, but saves a check in most cases.
2024-03-03 20:32:23 +01:00
Christian Hesse
4869d74edf netwatch-notify: handle IPv6 / AAAA resolving 2024-03-02 22:08:40 +01:00
Christian Hesse
50a6914907 netwatch-notify: (mis-)use firewall address-list for lookup...
... and drop the racy code querying dns cache. 😁
2024-03-01 12:30:18 +01:00
Christian Hesse
20d1ad17d7 Merge branch 'fw-addr-lists' into next 2024-02-29 14:22:07 +01:00
Christian Hesse
62790ae091 fw-addr-lists: add support for IPv6 2024-02-29 14:21:58 +01:00
Christian Hesse
0125f102b4 fw-addr-lists: rename variable 2024-02-29 14:21:58 +01:00
Christian Hesse
31966479dc fw-addr-lists: update wording 2024-02-29 14:21:58 +01:00
Christian Hesse
1687e2780f fw-addr-lists: get timeout from loop 2024-02-29 14:21:58 +01:00
Christian Hesse
b9e0ffac1d Merge branch 'netwatch-notify' into next 2024-02-29 14:21:46 +01:00
Christian Hesse
a924de274c netwatch-notify: handle CNAME to multiple records 2024-02-28 23:01:43 +01:00
Christian Hesse
6f29c640e4 netwatch-notify: move check in DNS cache to local function 2024-02-28 23:01:43 +01:00
Christian Hesse
01d2c3ea7e netwatch-notify: try another workaround
The last one did not make it... Perhaps the cache just needs
a moment to settle?
2024-02-28 23:01:43 +01:00
Christian Hesse
93bed1b081 netwatch-notify: work around race condition
This used to crash every now and then with:

> script;error script error: no such item (4)

I guess this is caused by querying the dns cache just exactly when a
record expires. The chance is maximized: The script is started by
scheduler every minute, and the record's ttl is a multiple of a minute.

Let's query records that are not about to expire immediately, and
try again.
2024-02-28 23:01:43 +01:00
Christian Hesse
c2f5272f18 netwatch-notify: restore the check 🥴
This reverts commit 28da1da49e275fef6089a103edf6c158bbff317f.

Chances are that we have to resolve a CNAME, that does not match when
querying the cache.

How to handle CNAME do multiple A records? 🤨
2024-02-28 23:01:43 +01:00
Christian Hesse
45875ad68e netwatch-notify: simplify the check 2024-02-28 23:01:43 +01:00
Christian Hesse
b1199ca50a netwatch-notify: ... and switch state to "unknown" on host update 2024-02-28 23:01:43 +01:00
Christian Hesse
1344694708 netwatch-notify: handle status "down" in its own condition...
... instead of else-branch.

This makes sure to skip hosts that just became "unknown".
(Possible soon!)
2024-02-28 23:01:43 +01:00
Christian Hesse
1c2048628d netwatch-notify: use logical operator, no literal "and"
Just like we do everywhere else.
2024-02-28 23:01:43 +01:00
Christian Hesse
471e0ead05 doc/netwatch-notify: update for multiple records 2024-02-28 23:01:00 +01:00
Christian Hesse
b286cb6803 netwatch-notify: do not update with record in cache
Using `:resolve` we have just one address, but chances are several
records do exist. These end up in cache, so we are happy to find them
there - no need to update then.
2024-02-19 11:03:17 +01:00
Christian Hesse
872abbea7d doc/unattended-lte-firmware-upgrade: more devices supported... 2024-02-08 21:02:06 +01:00
Christian Hesse
860acffbdb unattended-lte-firmware-upgrade: add error handling 2024-02-08 21:02:06 +01:00
Christian Hesse
e83154c9c3 check-lte-firmware-upgrade: give more detailed infos on modem 2024-02-08 20:54:02 +01:00
Christian Hesse
643f15a0b9 introduce BRANCHES info 2024-02-02 21:06:11 +01:00
Christian Hesse
53b09529a8 doc/backup-partition: add warning about RouterOS version 2024-02-02 12:53:45 +01:00
Christian Hesse
c21da0454b backup-partition: make sure to remove the scheduler on failure 2024-02-02 12:53:45 +01:00
Christian Hesse
7b30af90b7 backup-partition: get the actual real name...
... to prevent confusion after restore.
2024-02-02 12:53:45 +01:00
Christian Hesse
0694d9af3e backup-partition: add a scheduler in backup...
... that logs a warning when backup is booted.
2024-02-02 12:53:45 +01:00
Christian Hesse
77ef9b2c95 backup-partition: use plain variable for name 2024-02-02 10:40:59 +01:00
Christian Hesse
ed00c0877f INITIAL-COMMANDS: link initial commands above 2024-02-01 15:39:39 +01:00
Christian Hesse
64e53a7d32 packages-update: schedule reboot at pre-calculated time 2024-01-31 23:16:41 +01:00
Christian Hesse
461f7b6e76 packages-update: move output and logging to local function...
... and pass script name for clean logging.
2024-01-31 23:10:15 +01:00
Christian Hesse
237dcd7261 packages-update: prepare message and mention time zone 2024-01-31 23:10:15 +01:00
Christian Hesse
c1568a33dd backup-upload: use $CleanName 2024-01-31 23:10:15 +01:00
Christian Hesse
d0ff07b3cc backup-email: use $CleanName 2024-01-31 23:10:15 +01:00
Christian Hesse
c5714e5dc8 dhcp-to-dns: use $CleanName 2024-01-31 23:10:15 +01:00
Christian Hesse
821dd02e5e global-functions: $CertificateNameByCN: use $CleanName 2024-01-31 23:10:15 +01:00
Christian Hesse
09988d9892 global-functions: introduce $CleanName 2024-01-31 23:10:15 +01:00
Christian Hesse
b548ffee59 global-functions: $MkDir: drop declaration of unused functions 2024-01-31 23:10:15 +01:00
Christian Hesse
ed28ade712 global-functions: $IsDNSResolving: drop declaration of unused function 2024-01-31 23:10:15 +01:00
Christian Hesse
fb463419fe check-certificates: always quote the certificate name 2024-01-30 15:00:31 +01:00
Christian Hesse
5b6ed4216e global-functions: $ScriptInstallUpdate: warn just once...
... for every script on required RouterOS version.
2024-01-30 07:18:38 +01:00
Christian Hesse
07cdeadf43 log-forward: use $MAX 2024-01-30 07:10:51 +01:00
Christian Hesse
777b2ba7a2 Merge branch 'jobname' into next 2024-01-30 00:52:21 +01:00
Christian Hesse
b679eefcf7 update-tunnelbroker: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
af7031cc56 update-gre-address: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
24b681761b telegram-chat: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
6e54c7c30b sms-forward: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
58748eea3c sms-action: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
791b04bbe4 ppp-on-up: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
322466fd00 packages-update: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
cbdfa98576 ospf-to-leds: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
45fda69d3b netwatch-notify: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
80f587ddb5 netwatch-dns: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
5d40075e44 mode-button: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
4653c94f3f log-forward: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
b4d666ef1d lease-script: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
19e759d8fb ipv6-update: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
aca18f9cc2 ipsec-to-dns: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
79660f10db hotspot-to-wpa-cleanup: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
9cf536f891 hotspot-to-wpa: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
7d47963c7a gps-track: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
8afbd5bff5 global-wait: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
4b791b7769 global-functions: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
afd779c0bb fw-addr-lists: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
c9fcd3419f firmware-upgrade-reboot: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
6c52bd692b dhcp-to-dns: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
492d3a65a7 dhcp-lease-comment: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
3f8d680fe8 daily-psk.capsman: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
02d8455a87 collect-wireless-mac: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
3412ab771f check-routeros-update: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
08bd884810 check-lte-firmware-upgrade: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
5319577035 check-health: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
a43202326b check-certificates: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
60b2186287 certificate-renew-issued: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
dfeb6b6d61 capsman-rolling-upgrade: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
111cb59509 capsman-download-packages: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
b4ac193789 backup-upload: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
994d3ef05a backup-partition: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
26dd16d3b9 backup-email: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
72a03c4dbb backup-cloud: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
1d4f4d0017 accesslist-duplicates: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
35b468b827 Merge branch 'bump' into next 2024-01-30 00:49:29 +01:00
Christian Hesse
5ac89bad04 mod/ssh-keys-import: bump RouterOS version dependency 2024-01-30 00:31:36 +01:00
Christian Hesse
f6f557d80f accesslist-duplicates: bump RouterOS version dependency 2024-01-30 00:31:30 +01:00
Christian Hesse
1bebac2a64 hotspot-to-wpa-cleanup: bump RouterOS version dependency 2024-01-30 00:31:22 +01:00
Christian Hesse
6ad7ca2c1a mod/notification-email: drop support for old property name 2024-01-30 00:30:32 +01:00
Christian Hesse
ccd7e6d1ed README: note on required hardware and limitations by storage 2024-01-30 00:02:08 +01:00
Christian Hesse
693b203457 README: make required software a paragraph 2024-01-30 00:02:08 +01:00
Christian Hesse
2a4e2e0c07 send a warning on storage size 2024-01-30 00:02:08 +01:00
Christian Hesse
62f33d7b19 packages-update: support deferred reboot on auto-update
Closes #56
2024-01-30 00:02:08 +01:00
Christian Hesse
98f26989f5 packages-update: schedule from local function 2024-01-30 00:02:08 +01:00
Christian Hesse
abfc8e9191 telegram-chat: add (and increase) random delay on error
Chances are that two devices schedule the script (nearly) simultaneously.
Causing a lot of failures from fetch. Instead of forcing a retry on
*every* invocating we add (and increase) a random delay, that is
slowly decreasd on success. This should minimize failures...
2024-01-30 00:02:08 +01:00
Christian Hesse
b6367b5df3 telegram-chat: fix concatenation (and retry with delay)
Ups... 😳
2024-01-30 00:02:08 +01:00
Christian Hesse
a1abfedccd global-functions: $RandomDelay: always scale to ms...
... to randomize in friction of unit.

This requires :tonsec from RouterOS 7.12.
2024-01-30 00:02:08 +01:00
Christian Hesse
16898ae997 global-functions: $RandomDelay: allow zero time, return immediately 2024-01-29 22:50:02 +01:00
Christian Hesse
e636d4194c global-functions: $RandomDelay: name the parameters 2024-01-29 22:50:02 +01:00
Christian Hesse
64abe7430a update list of contributors 2024-01-25 09:38:11 +01:00
Christian Hesse
3ca51f4699 INITIAL-COMMANDS: fix existing installation 2024-01-25 09:38:11 +01:00
Christian Hesse
7db94b5f3f doc/check-certificates: initial certificate import 2024-01-24 17:24:23 +01:00
Christian Hesse
7baf69e67c doc/check-certificates: add paragraph 2024-01-24 17:24:23 +01:00
Christian Hesse
468b5a18f3 check-certificates: unbreak certificate download
This was borked with a2749b2760. 😳
2024-01-24 16:13:44 +01:00
Christian Hesse
20c337d6ba INITIAL-COMMANDS: ... but rename the configuration overlay!
This should not ultimately destroy user's configuration.
2024-01-24 15:52:58 +01:00
Christian Hesse
49a83682c3 INITIAL-COMMANDS: remove before adding...
... to make sure it does not fail on (partly) installed scripts. This
should work to fix borked base installation now.
2024-01-24 11:47:26 +01:00
Christian Hesse
f015f5f012 mod/notification-telegram: apply url encoding when sending 2024-01-22 16:10:48 +01:00
Christian Hesse
c2fe7e4cd7 mod/notification-matrix: drop declaration of unused function 2024-01-22 16:08:34 +01:00
Christian Hesse
75a39ffaf1 global-functions: $SymbolByUnicodeName: log warning on missing name 2024-01-20 00:11:22 +01:00
Christian Hesse
86a0700efd global-functions: $SymbolByUnicodeName: name the parameter 2024-01-20 00:09:54 +01:00
Christian Hesse
21cf6d49bb backup-upload: fix the upload symbol...
... which broke with commit 080bef89a9.
2024-01-19 17:08:55 +01:00
Christian Hesse
4b8854946d fw-addr-lists: use prepared user-agent string with fetch 2024-01-19 13:25:22 +01:00
Christian Hesse
a2749b2760 check-certificates: use prepared user-agent string with fetch 2024-01-19 13:23:52 +01:00
Christian Hesse
0ad1a79d67 netwatch-dns: be move verbose on time to settle 2024-01-18 21:07:52 +01:00
Christian Hesse
8a0a4c355b global-functions: log successful loading 2024-01-18 12:53:17 +01:00
Christian Hesse
bb0c82adb3 sms-forward: log warning just once 2024-01-18 10:19:22 +01:00
Christian Hesse
a7619a5119 global-functions: $LogPrintOnce: support exit 2024-01-18 10:19:22 +01:00
Christian Hesse
306269f919 doc/hotspot-to-wpa: reference as WPA only...
... as this works with WPA3 as well. 😜
2024-01-18 10:05:29 +01:00
Christian Hesse
abd1edcdc3 doc/hotspot-to-wpa: fix property name 2024-01-17 14:55:42 +01:00
Christian Hesse
29623a46ea global-functions: $HexToNum: use :tonum 2024-01-16 22:24:50 +01:00
Christian Hesse
be4221264c INITIAL-COMMANDS: set script owner on initial creation 2024-01-16 22:01:04 +01:00
Christian Hesse
60bd9d1abc README: set script owner on initial creation 2024-01-16 22:00:13 +01:00
Christian Hesse
5fd8c8a760 netwatch-dns: check DoH server with fetch
This way we do not have to configure possibly non-functional servers to
check. The query is for doh-check.eworm.de of type TXT, the expected
answer is 'doh-check-OK'.

% dig TXT doh-check.eworm.de +https @1.1.1.1

; <<>> DiG 9.18.21 <<>> TXT doh-check.eworm.de +https @1.1.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42226
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;doh-check.eworm.de.		IN	TXT

;; ANSWER SECTION:
doh-check.eworm.de.	63791	IN	TXT	"doh-check-OK"

;; Query time: 16 msec
;; SERVER: 1.1.1.1#443(1.1.1.1) (HTTPS)
;; WHEN: Mon Jan 15 13:55:36 CET 2024
;; MSG SIZE  rcvd: 72
2024-01-15 14:07:38 +01:00
Christian Hesse
85aeeadcee netwatch-dns: check DoH server functionality...
... and try all servers one after another.
2024-01-11 15:33:03 +01:00
Christian Hesse
80db12a3e9 netwatch-dns: enable DoH certificate verification...
... if a certificate is named in configuration.
2024-01-11 09:22:32 +01:00
Christian Hesse
44a8195c37 doc/netwatch-dns: use new certificate for Cloudflare 2024-01-09 23:01:22 +01:00
Christian Hesse
d6645e8157 certs: add new DigiCert certificates...
... used by Cloudflare.
2024-01-09 23:00:13 +01:00
Christian Hesse
4249ad61df global-functions: $CertificateDownload: move delay up
We still had cases where fetch misbehaves... But this was permanent.
Perhaps we should not touch the certificate too early...
2024-01-08 00:29:18 +01:00
Christian Hesse
8c458592f5 check-lte-firmware-upgrade: unbreak terminal detectiono
This broke with commit 50d7e1fa41b8f8a6a1379de5521798346fd1ae9f... 🫣
2024-01-07 23:13:54 +01:00
Christian Hesse
0760ea9121 check-lte-firmware-upgrade: fail on empty version string 2024-01-05 17:05:34 +01:00
Christian Hesse
9a73fc526f update copyright for 2024 2024-01-01 15:25:25 +01:00
Christian Hesse
777c388b43 global-functions: $GetMacVendor: get new certificate
The service now uses: GTS CA 1P5 -> GTS Root R1
2023-12-22 14:47:54 +01:00
Christian Hesse
1c26d08267 mod/ssh-keys-import: unbreak import from file
Looks like this broke in c3045f3723 where
a non-existent variable name was used.
2023-12-21 11:34:55 +01:00
Christian Hesse
0377064f65 capsman-download-packages: avaiable packages only...
... as things became more complicated with 'wifi-qcom*'.
2023-12-20 12:29:24 +01:00
Christian Hesse
5aaa24b507 capsman-download-packages: use default set for legacy capsman...
... as well - now that 'wireless' package has been split from 'routeros'
guessing kind of broke. It required several attempts and intermittent
errors in logs to get things right.
2023-12-20 12:11:12 +01:00
Christian Hesse
5fdc8d9e65 doc/mode-button: document required type of led 2023-12-14 08:54:04 +01:00
Christian Hesse
f9528f0ac5 fw-addr-lists: warn on possible truncation
... as fetch truncates data at about 64kB, reported in SUP-132297.
2023-12-13 15:57:28 +01:00
Christian Hesse
db5ff00b5a doc/capsman-download-packages: mention package-path 2023-12-05 11:01:14 +01:00
Christian Hesse
69af869572 mention the donation hint... 2023-12-05 00:11:19 +01:00
Christian Hesse
52b8e67309 celebrating 1.000 stars on Github! 2023-12-05 00:11:19 +01:00
Christian Hesse
d3611cebbd mod/notification-email: $NotificationFunctions->"email": support hook for signature
You can compose your own signature by creating a function:

:global NotificationEMailSignature do={
  :global EitherOr;

  :local RouterBoard [ /system/routerboard/get ];
  :return ( \
    [ $EitherOr ($RouterBoard->"board-name") ($RouterBoard->"model") ] . " s/n " . $RouterBoard->"serial-number" . " | " . \
    "RouterOS " . [ /system/package/update/get installed-version ] . " | " . \
    "IP " . [ /ip/cloud/get public-address ]);
}
2023-12-05 00:11:19 +01:00
Christian Hesse
9fb596135e check-certificates: properly renew from template 2023-12-05 00:11:19 +01:00
Christian Hesse
a12ccba29e check-certificates: improve wording 2023-12-05 00:11:19 +01:00
Christian Hesse
8de6995c4b check-certificates: add workaround for broken certificates...
... where the issuer array is borked. Or is this a RouterOS issue?

[eworm@carpo] > $InspectVar [ $ParseKeyValueStore  [ /certificate/get ISRG-Root-X2 issuer ] ]
-type-> array
  -key-> C
    -type-> str
    -value-> US,O=Internet Security Research Group,CN=ISRG Root X2

A good certificate looks like this:

[eworm@carpo] > $InspectVar [ $ParseKeyValueStore  [ /certificate/get [ find where name~"eworm.net" ] issuer ] ]
-type-> array
  -key-> C
    -type-> str
    -value-> US
  -key-> CN
    -type-> str
    -value-> E1
  -key-> O
    -type-> str
    -value-> Let's Encrypt
2023-12-04 13:05:46 +01:00
Christian Hesse
a08df7bdec check-certificates: prevent infinte loop 2023-12-04 13:05:46 +01:00
Christian Hesse
3df99b0ee0 check-certificates: give full certificate chain 2023-12-04 13:05:46 +01:00
Christian Hesse
94607496ae check-certificates: fix typo and syntax 2023-12-04 12:15:10 +01:00
Christian Hesse
e4b10d4b76 mod/notification-email: $QuotedPrintable: also encode question mark
Following the RFC it is not required, but looks like Thunderbird has an
issue here...

https://datatracker.ietf.org/doc/html/rfc2045#section-6.7
2023-12-04 12:08:47 +01:00
Christian Hesse
84368ec6eb mod/notification-email: $QuotedPrintable: minor rework
We have to encode all characters from 0x00 to 0x1f as well...
Also the equal sign is nothing special here, just adding to list.
2023-12-04 12:08:47 +01:00
Christian Hesse
1bb2871e0b global-functions: $FormatLine: use $CharacterMultiply 2023-12-04 12:08:47 +01:00
Christian Hesse
5e2e65b252 global-functions: $AlignRight: use $CharacterMultiply 2023-12-04 12:08:47 +01:00
Christian Hesse
8f24b4c490 global-functions: introduce $CharacterMultiply 2023-12-04 11:22:36 +01:00
Christian Hesse
15e347303b global-functions: $DeviceInfo: add SNMP location and contact 2023-12-04 09:33:24 +01:00
Christian Hesse
aba4770395 fw-addr-lists: support timeout per list
This works with something like this:

    :global FwAddrLists {
      "allow"={
        { url="https://eworm.de/ros/fw-addr-lists/allow";
          cert="E1"; timeout=1w };
      };
      ...
    }

All urls for one named list should have the same timeout! With different
timeout values and identical addresses the behavior is besically undefined,
depending on order.
2023-11-30 13:51:57 +01:00
Christian Hesse
c6bf722e49 global-functions: introduce $MIN 2023-11-30 13:51:57 +01:00
Christian Hesse
495eff48de global-functions: introduce $MAX 2023-11-30 13:51:57 +01:00
Christian Hesse
080bef89a9 global-functions: $SymbolByUnicodeName: rename up-arrow -> arrow-up
... so arrows are grouped in case we add more.
2023-11-30 13:51:57 +01:00
Christian Hesse
4e1d54d733 global-functions: $SymbolForNotification: properly append space to alt text 2023-11-30 13:51:57 +01:00
Christian Hesse
81a86ee043 netwatch-dns: get doh host name from static dns 2023-11-27 18:21:47 +01:00
Christian Hesse
1cc0e3429b global-functions: introduce $AlignRight 2023-11-23 14:41:46 +01:00
Christian Hesse
cae5f425a6 telegram-chat: get rid of '.txt' file extension 2023-11-22 21:20:44 +01:00
Christian Hesse
d1abbede75 backup-email: get rid of '.txt' file extension 2023-11-22 21:18:39 +01:00
Christian Hesse
b75b0bf6be backup-upload: get rid of '.txt' file extension 2023-11-22 21:17:44 +01:00
Christian Hesse
11daef75f0 packages-update: refuse automatic update to RouterOS 7.13
... as migration to wireless or wifi package has to be done. Please
update manually by running:

    /system/package/update/install
2023-11-21 13:14:51 +01:00
Christian Hesse
ab8c9d04ff check-routeros-update: rename scheduler
This was missing for commit f7c72b6ed96e45bf1fbb54c46ce09e1fccc791be...
2023-11-16 13:18:10 +01:00
Christian Hesse
6384f6a239 drop old files left from migration 2023-11-15 15:10:49 +01:00
Christian Hesse
c7e2ff71e6 check-health: decrease indention in messages 2023-11-15 15:07:07 +01:00
Christian Hesse
23c5c461a6 check-health: use $HumanReadableNum for RAM utilization 2023-11-15 15:03:16 +01:00
Christian Hesse
5f457e5c37 backup-upload: build file info in a function 2023-11-15 14:35:18 +01:00
Christian Hesse
4d70b7fea4 backup-upload: give more info on files 2023-11-15 14:35:09 +01:00
Christian Hesse
180d6b8733 backup-cloud: use $HumanReadableNum for file size 2023-11-15 14:34:40 +01:00
Christian Hesse
890cd6c58d global-functions: introduce $HumanReadableNum 2023-11-15 14:34:40 +01:00
Christian Hesse
a4b2da8087 Merge branch 'wifi' into next 2023-11-15 14:34:40 +01:00
Christian Hesse
4c3430fbb6 notify about parted scripts for wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
97383dfbfb hotspot-to-wpa{,-cleanup}: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
fe1f438502 dhcp-lease-comment: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
53103be324 daily-psk: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
d598b2d70e collect-wireless-mac: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
cf4f0c5c93 capsman-rolling-upgrade: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
5eb130f0fc capsman-download-packages: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
ba406ae0fe accesslist-duplicates: support new wifi package 2023-11-15 14:34:40 +01:00
Christian Hesse
448b44cde6 Makefile: support new wifi package...
... introduced with RouterOS 7.13beta1.
2023-11-15 14:34:33 +01:00
Christian Hesse
3aec5d70c6 Merge branch 'scheduler' into next 2023-11-14 22:36:58 +01:00
Christian Hesse
8c8f834179 mod/notification-telegram: rename scheduler 2023-11-14 22:35:38 +01:00
Christian Hesse
75c41501c2 mod/notification-ntfy: rename scheduler 2023-11-14 22:35:23 +01:00
Christian Hesse
5c2454be8b mod/notification-matrix: rename scheduler 2023-11-14 22:35:06 +01:00
Christian Hesse
a5e2282d0f mod/notification-email: rename scheduler 2023-11-14 22:34:45 +01:00
Christian Hesse
f7c72b6ed9 packages-update: rename scheduler 2023-11-14 22:27:15 +01:00
Christian Hesse
4f04fa73fc mode-button: rename scheduler 2023-11-14 22:26:22 +01:00
Christian Hesse
0d530294f5 capsman-rolling-upgrade: update template comment 2023-11-14 17:34:26 +01:00
Christian Hesse
18360f92b3 capsman-download-packages: update template comment 2023-11-14 17:33:46 +01:00
Christian Hesse
690953e4c5 doc/collect-wireless-mac: fix copy-and-paste error 2023-11-14 15:13:12 +01:00
Christian Hesse
64bae1fd1b doc/capsman-download-packages: hint on cleanup 2023-11-14 14:10:02 +01:00
Christian Hesse
dcca53e449 hotspot-to-wpa: drop dead code 2023-11-14 10:41:01 +01:00
Christian Hesse
e36ac19c8b global-functions: drop $Read
... which is no longer required now that RouterOS 7.12beta1
provides /terminal/ask.
2023-11-09 15:42:07 +01:00
Christian Hesse
ebce360a4e doc/accesslist-duplicates: reference stable version 2023-11-09 15:42:07 +01:00
Christian Hesse
5b047223d1 accesslist-duplicates: use /terminal/ask
This was introduced in RouterOS 7.12beta1.
2023-11-09 15:42:07 +01:00
Christian Hesse
2d7efd8d6c mod/notification-matrix: introduce $SetupMatrix{Authenticate,JoinRoom} for setup
Well, now that we have a JSON parser... Let's improve the user
experience a bit.
2023-11-09 15:34:10 +01:00
Christian Hesse
59f8f30389 doc/mod/notification-telegram: end all commands with a semicolon 2023-11-09 15:34:10 +01:00
Christian Hesse
255fc531ad doc/mod/notification-ntfy: end all commands with a semicolon 2023-11-09 15:34:10 +01:00
Christian Hesse
2acc0aba7e doc/mod/notification-matrix: end all commands with a semicolon 2023-11-09 15:34:10 +01:00
Christian Hesse
0f3746c894 doc/mod/notification-email: end all commands with a semicolon 2023-11-09 15:34:10 +01:00
Christian Hesse
3cc41495bc doc/mod/ssh-keys-import: reference stable version 2023-11-09 15:34:10 +01:00
Christian Hesse
98d7eee454 mod/ssh-keys-import: continue import after intermediate failure 2023-11-09 15:34:10 +01:00
Christian Hesse
b22dfbfc94 mod/ssh-keys-import: do not import twice 2023-11-09 15:34:10 +01:00
Christian Hesse
042ff1cfda mod/ssh-keys-import: drop the version check for ed25519 keys...
... now that we require RouterOS 7.12beta1 anyway.
2023-11-09 15:18:09 +01:00
Christian Hesse
1265caca60 mod/ssh-keys-import: calculate fingerprint...
... and store it in key-owner, which is descriptive only.

This requires RouterOS 7.12beta1 for the 'transform' property
for ':convert' command.
2023-11-09 15:08:36 +01:00
Christian Hesse
c3045f3723 mod/ssh-keys-import: parse key into array 2023-11-07 14:31:59 +01:00
Christian Hesse
79f3002a38 README: print name with proplist for certificate verification 2023-11-07 14:31:59 +01:00
Christian Hesse
c2649ae832 README: reference stable version 2023-11-07 13:41:59 +01:00
Christian Hesse
fe2641ae0f global-functions: $ParseDate: drop code for old format...
... and increase required RouterOS.

We should probably wait some time before merging this: Even current
versions have some hidden places with old format:

[admin@MikroTik] > /system/resource/print
                     [...]
                  version: 7.10.2 (stable)
               build-time: Jul/12/2023 09:45:11
                     [...]

(Though this is written with capital letter and fails anyway...)

Something similar goes for `/ip/neighbor`, where format depends on
remote devices. Does anybody need to parse this?
2023-11-07 13:41:59 +01:00
Christian Hesse
4321d8fa54 netwatch-notify: match on word boundary 2023-10-27 22:55:40 +02:00
Christian Hesse
f60c72dc78 netwatch-dns: match on word boundary 2023-10-27 22:55:15 +02:00
Christian Hesse
a407332ea1 dhcp-to-dns: prepare string 'mac in server' 2023-10-27 22:46:47 +02:00
Christian Hesse
a769ed072b dhcp-to-dns: prepare full names for A and CNAME records 2023-10-27 22:34:52 +02:00
Christian Hesse
576364f44a dhcp-to-dns: info on mac address bound multiple time 2023-10-27 14:13:58 +02:00
Christian Hesse
c34599fe46 dhcp-to-dns: warn on duplicate names 2023-10-27 14:13:58 +02:00
Christian Hesse
3474b9a15c dhcp-to-dns: allow multiple records for one mac address
Now that we can have differnt name suffixes via networks it makes sense
to allow multiple records for one mac address.

Also update the wording for messages...
2023-10-27 14:13:58 +02:00
Christian Hesse
72b4851255 global-functions: introduce $LogPrintOnce
This does work just like $LogPrintExit2, except it acts just *once* for
each message, until device is rebooted.
2023-10-27 08:42:32 +02:00
Christian Hesse
dce779250c README: explain sensitive property 2023-10-26 22:15:10 +02:00
Christian Hesse
8f75c17e0b global: switch eworm.de to new certificate chain (E1 / ISRG Root X2)
old chain: R3 / ISRG Root X1
new chain: E1 / ISRG Root X2

No user interaction or migration is required for existing installations
as we install 'E1' and 'ISRG Root X2' for some time already.
2023-10-26 22:15:05 +02:00
Christian Hesse
61834297d7 global-functions: $ParseJson: prevent infinite loop...
... which could happen on corrupted or truncated input.
2023-10-25 08:57:39 +02:00
Christian Hesse
ff35f0c87f check-health: reverse logic for RAM (free -> utilization)...
... to bring it in sync with CPU utilization.

Also make the output more verbose, at least for the warning.

---- ✂️ ----
🗃️📈️ Health warning: RAM utilization

The RAM utilization on MikroTik is at 81%!

total:          64 MiB
used:           52 MiB
free:           11 MiB
---- ✂️ ----
🗃️📉️ Health recovery: RAM utilization

The RAM utilization on MikroTik decreased to 65%.
---- ✂️ ----
2023-10-24 17:03:12 +02:00
Christian Hesse
d4e5194a65 fw-addr-lists: rework the retry logic
... with increasing delay.
2023-10-19 21:17:03 +02:00
Christian Hesse
1f6040178f telegram-chat: rework the retry logic
... with increasing delay.
2023-10-19 21:13:04 +02:00
Christian Hesse
92b4af7b90 log-forward: keep the warning in subject for higher severity 2023-10-19 12:36:19 +02:00
Christian Hesse
b81f3850ae telegram-chat: log when sending notice 2023-10-19 09:19:34 +02:00
Christian Hesse
4c365c131d telegram-chat: drop extra conversion 2023-10-19 08:42:29 +02:00
Christian Hesse
9138c17f8c global-functions: $ParseJson: return array as ... array 😜
No need to assemble the string here, just to split it again later.
2023-10-19 08:42:29 +02:00
Christian Hesse
fffe0a3b50 telegram-chat: retry on fetch failure...
... and exit with a warning.
2023-10-17 21:37:13 +02:00
Christian Hesse
ab44377fb6 accesslist-duplicates: remove extra check
Why did we have that? Possibly for performance? Well, should not be a
problem now.
2023-10-17 14:05:03 +02:00
Christian Hesse
00e8766ce3 accesslist-duplicates: use another named array 2023-10-17 14:05:03 +02:00
Christian Hesse
8bfbc9dd7e accesslist-duplicates: use named array 2023-10-17 14:05:03 +02:00
Christian Hesse
0e83d2e317 daily-psk: use named array 2023-10-17 14:05:03 +02:00
Christian Hesse
286e3d9cf9 global-functions: $ScriptInstallUpdate: use $EitherOr 2023-10-17 14:05:03 +02:00
Christian Hesse
2ab3468700 global-functions: $ScriptInstallUpdate: restore indention
No functional change.
2023-10-17 14:05:03 +02:00
Christian Hesse
382f928568 global-functions: $ScriptInstallUpdate: drop support for scripts from storage
Nobody ever used that, no?
(Well, except me - just before I implemented fetching. 😜)
2023-10-17 14:05:03 +02:00
Christian Hesse
7a1ffb659c global-functions: $ScriptInstallUpdate: rename variable 2023-10-17 14:05:03 +02:00
Christian Hesse
c0a734fa21 global-functions: $ScriptInstallUpdate: use pushpin as bullet 2023-10-17 14:05:03 +02:00
Christian Hesse
cfc8c4f1ea global-functions: $SymbolForNotification: support fallback without symbols 2023-10-17 14:05:03 +02:00
Christian Hesse
d3992c13a0 mod/notification-ntfy: check for root certificate availability
... at least with default server.
2023-10-17 14:05:03 +02:00
Christian Hesse
5932586ee4 introduce mod/notification-ntfy...
... for sending notifications via Ntfy (https://ntfy.sh/).

TODO: use proper formatting once supported in Android app:
https://github.com/binwiederhier/ntfy/issues/889
2023-10-17 14:05:03 +02:00
Christian Hesse
5fbf584d4c sms-forward: pass phone number and message to hook
These are available as $Phone and $Message in hook.
2023-10-17 14:05:03 +02:00
Christian Hesse
f6e65dd68c log-forward: add 'packet' in default filter...
... which is used when logging raw packets from dns and ssh,
and possibly others.
2023-10-17 14:05:03 +02:00
Christian Hesse
24823441c3 log-forward: use colorful bullets to indicate severity 2023-10-17 14:05:03 +02:00
Christian Hesse
ef3b8f8ddd gps-track: http-header-field expects an array 2023-10-17 14:05:03 +02:00
Christian Hesse
1b00f93fc6 global-functions: $ScriptInstallUpdate: http-header-field expects an array 2023-10-17 14:05:03 +02:00
Christian Hesse
da0a37802d global-functions: $CertificateDownload: http-header-field expects an array 2023-10-17 14:05:03 +02:00
Christian Hesse
80c0e47649 Merge branch 'telegram' into next 2023-10-17 14:05:03 +02:00
Christian Hesse
bcc10c8285 telegram-chat: make messages silent...
... at least those not indicating an error.
2023-10-17 14:05:03 +02:00
Christian Hesse
73194b92cf telegram-chat: use $ParseJson for all JSON 2023-10-16 23:43:58 +02:00
Christian Hesse
c0aab0fead global-functions: $ParseJson: properly handle array 2023-10-16 23:43:58 +02:00
Christian Hesse
3b9df48721 global-functions: $ParseJson: prepare elif-workaround 2023-10-16 23:43:58 +02:00
Christian Hesse
140ec1a3a2 global-functions: $ParseJson: use temporary variables 2023-10-16 23:43:58 +02:00
Christian Hesse
fed7f2da46 mod/notification-telegram: drop support for non-fixed width font 2023-10-16 15:27:14 +02:00
Christian Hesse
c9233773b3 telegram-chat: do not act on foreign reply...
... even if active!
2023-10-16 15:27:14 +02:00
Christian Hesse
bc4839f611 telegram-chat: rename variable 2023-10-16 15:27:14 +02:00
Christian Hesse
1b62545d8c telegram-chat: answer question mark with short notice 2023-10-16 15:27:14 +02:00
Christian Hesse
15873e2fdb telegram-chat: restore indention 2023-10-16 15:27:14 +02:00
Christian Hesse
555461c612 telegram-chat: do not nest conditions 2023-10-16 15:27:14 +02:00
Christian Hesse
adca33cc5b telegram-chat: act on reply without delay 2023-10-16 13:11:20 +02:00
Christian Hesse
399d952ac2 telegram-chat: act on reply from self 2023-10-16 13:11:20 +02:00
Christian Hesse
fd1263324d doc/telegram-chat: update screenshots 2023-10-16 13:11:20 +02:00
Christian Hesse
8ecde47a78 mod/notification-telegram: remember ids of sent messages 2023-10-16 11:51:04 +02:00
Christian Hesse
7df4f9e78c global-functions: $ParseJson: handle outher curly brackets 2023-10-16 11:51:04 +02:00
Christian Hesse
bb899b1fb0 global-functions: $ParseJson: drop superfluous substraction 2023-10-16 11:51:04 +02:00
Christian Hesse
080b3cbf9d global-functions: make $ParseJson global 2023-10-16 11:51:04 +02:00
Christian Hesse
8e9734347e telegram-chat: parse (one level of) JSON into array 2023-10-16 11:51:04 +02:00
Christian Hesse
4c51b2fe52 telegram-chat: do not cover existing variable 2023-10-16 11:51:04 +02:00
Christian Hesse
65d05a757b update list of contributors 2023-10-16 11:50:10 +02:00
Christian Hesse
87b136f3a9 mod/notification-email: handle new property name...
... which changed in RouterOS 7.12rc1.
2023-10-06 21:42:00 +02:00
Christian Hesse
702abd2a5d log-forward: add 'raw' in default filter...
... which is used when logging raw packets or commands.
2023-10-05 22:20:32 +02:00
Christian Hesse
fedda2a946 collect-wireless-mac: ignore remote aps...
... which are listed here in station mode.
2023-10-05 22:08:26 +02:00
Christian Hesse
eef0662aa7 netwatch-notify: allow to give different origin for hosts...
... to use differing notification settings.

Add an origin name in netwatch configuration:

    /tool/netwatch/add comment="notify, name=dns-google, origin=netwatch-notify-google" address=8.8.8.8;
    /tool/netwatch/add comment="notify, name=dns-cloudflare, origin=netwatch-notify-cloudflare" address=1.1.1.1;

Then configure the notification settings in `global-config-overlay`:

    :global EmailGeneralToOverride {
      "netwatch-notify-google"="google@example.com";
      "netwatch-notify-cloudflare"="cloudflare@example.com";
    }

I think it is best to handle this as a hidden setting...
Handle with care!
2023-09-29 14:15:41 +02:00
Christian Hesse
4c6c30550f collect-wireless-mac: filter on dns type 2023-09-22 12:29:15 +02:00
Christian Hesse
57c5c3f704 collect-wireless-mac: add CNAME(s) in notification 2023-09-20 12:26:49 +02:00
Christian Hesse
4ddc6be585 global-functions: split off $FormatMultiLines ...
... to format multiple lines from an array.
2023-09-18 07:55:05 +02:00
Christian Hesse
557823c5c1 telegram-chat: create status files with /file/add
We have no content, thus no issues with file size.
2023-09-15 09:54:59 +02:00
Christian Hesse
66ebcf2bbd telegram-chat: use the full command name :execute 2023-09-15 09:54:59 +02:00
Christian Hesse
5349c9b52e global-functions: $EitherOr: properly handle time values 2023-09-15 09:54:59 +02:00
Christian Hesse
2a10f43acc drop dummy scripts used for wifiwave2 migration
This now causes expected warnings on first run of $ScriptInstallUpdate.
2023-09-13 16:08:59 +02:00
Christian Hesse
110bb793b6 check-routeros-update: do not match the channel on neighbor update
While this works for stable, it does not for testing: The testing
channel can have "testing" in the string for rc releases, but also
"development" for beta releases... and possibly more.
Instead match on version string only, with word boundary.
2023-09-13 16:08:59 +02:00
Christian Hesse
46e48497d5 lease-script: match on word boundary 2023-09-13 16:08:59 +02:00
Christian Hesse
8b8bc7cf2d packages-update: match on word boundary 2023-09-13 16:08:59 +02:00
Christian Hesse
5d80b63f36 doc/packages-update: mention and link all backup scripts 2023-09-13 16:08:59 +02:00
Christian Hesse
66813d83a0 packages-update: drop order from message 2023-09-13 16:08:59 +02:00
Christian Hesse
c3f9ad1df7 packages-update: implement backup script order 2023-09-13 01:14:27 +02:00
Christian Hesse
50429a0ad8 fw-addr-lists: no (mixed) capitalization in message 2023-09-06 11:35:02 +02:00
Christian Hesse
57027ceb26 check-routeros-update: show neighbor's identity in message and notification 2023-08-31 09:40:09 +02:00
Christian Hesse
7b47ed7ea5 check-routeros-update: support update from specific neighbor(s)
... by matching the identity property.
2023-08-31 09:40:09 +02:00
Christian Hesse
49d85c6def backup-upload: revert changes, add comment with warning
Turned out that using `/file/add ...` introduced a regression. Accessing
(reading and writing) file contents is limited to 4095 bytes.

This limitation does not exist for `:execute script=... file=...`, so
keep the old code. Also add a comment with warning.
2023-08-30 09:30:25 +02:00
Christian Hesse
ce822a0276 backup-email: revert changes, add comment with warning
Turned out that using `/file/add ...` introduced a regression. Accessing
(reading and writing) file contents is limited to 4095 bytes.

This limitation does not exist for `:execute script=... file=...`, so
keep the old code. Also add a comment with warning.
2023-08-30 09:30:25 +02:00
Christian Hesse
f099c2c9ea backup-upload: check configuration size before writing file 2023-08-30 09:30:25 +02:00
Christian Hesse
1e247542a5 backup-email: check configuration size before writing file 2023-08-30 09:30:25 +02:00
Christian Hesse
f86cf27aa3 backup-upload: detect failure creating config file 2023-08-29 08:58:50 +02:00
Christian Hesse
07c6f5836a backup-email: detect failure creating config file 2023-08-29 08:58:50 +02:00
Christian Hesse
ffc7521a35 backup-email: support indication of failure 2023-08-29 08:58:50 +02:00
Christian Hesse
3c96db5824 backup-email: write config file directly
This functionality was added in RouterOS 7.9beta4...
2023-08-29 08:58:50 +02:00
Christian Hesse
1dd1c5b03c backup-upload: write config file directly
This functionality was added in RouterOS 7.9beta4...
2023-08-29 08:58:50 +02:00
Christian Hesse
16844b935a hotspot-to-wpa-cleanup: show last-seen, not timeout 2023-08-29 08:58:50 +02:00
Christian Hesse
5b5c91da84 hotspot-to-wpa-cleanup: require RouterOS for wifiwave2
RouterOS before version 7.12beta3 had a bug where getting comment from
registration-table is not possible. Require that version at least.

This was fixed in SUP-124500.
2023-08-24 08:35:07 +02:00
Christian Hesse
047c74a4b3 global-functions: prepare user-agent for fetch in global variable 2023-08-18 15:23:20 +02:00
Christian Hesse
53a80c81b1 mod/ssh-keys-import: $SSHKeysImport: add check for key type 2023-08-18 15:23:20 +02:00
Christian Hesse
ad6825571d mod/ssh-keys-import: support ed25519 keys...
... with RouterOS 7.12beta1
2023-08-18 15:23:20 +02:00
Christian Hesse
413be6f504 doc/mod/ssh-keys-import: drop duplicate key type
Stupid copy'n'paste error... 🫣
2023-08-18 15:23:20 +02:00
Christian Hesse
25d40688f7 sms-forward: drop RouterOS version dependency
... as global-functions depend on RouterOS 7.9beta already.
2023-08-18 15:23:20 +02:00
Christian Hesse
c04bf2c9b7 netwatch-notify: drop RouterOS version dependency
... as global-functions depend on RouterOS 7.9beta already.
2023-08-18 15:23:20 +02:00
Christian Hesse
ddd5608b38 mod/ssh-keys-import: drop RouterOS version dependency
... as global-functions depend on RouterOS 7.9beta already.
2023-08-18 15:23:20 +02:00
Christian Hesse
2c3e077b8e Merge branch 'wifiwave2' into next 2023-08-15 11:26:18 +02:00
Christian Hesse
92aca1aac0 news and migration for wifiwave2 2023-08-15 11:26:18 +02:00
Christian Hesse
6552b0c02d hotspot-to-wpa: convert to template, split capsman & wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
8ce1683733 daily-psk: add support for wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
6d76704a97 dhcp-lease-comment: add support for wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
bac4a460f0 collect-wireless-mac: add support for wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
d086e4a05f accesslist-duplicates: add support for wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
d0ab951e3f capsman-download-packages: download a default set for wifiwave2
Well, AX devices can be arm or arm64... So let's just download packages
'routeros' and 'wifiwave2' - crossing fingers... 🤞
2023-08-09 16:30:18 +02:00
Christian Hesse
3cab917a61 capsman-download-packages: no download of missing package for wifiwave2
Sadly the log messages from wifiwave2 do not contain any hint what is
missing... So it's not possible to download missing files.
2023-08-09 16:30:18 +02:00
Christian Hesse
8428ba890d Makefile: support excluding blocks from templates 2023-08-09 16:30:18 +02:00
Christian Hesse
e6964b4348 capsman-rolling-upgrade: convert to template, split capsman & wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
5e3d9d7460 capsman-download-packages: convert to template, split capsman & wifiwave2 2023-08-09 16:30:18 +02:00
Christian Hesse
5ea74968d9 capsman-download-packages: find script by code comment 2023-08-07 22:10:44 +02:00
Christian Hesse
0f787f9b03 Makefile: only regenerate existing scripts from templates 2023-08-07 22:10:44 +02:00
Christian Hesse
14dcea23b2 Makefile: support wifiwave2 in templates 2023-08-07 22:10:44 +02:00
Christian Hesse
b014eb76c6 collect-wireless-mac: move comment up 2023-08-07 22:10:44 +02:00
Christian Hesse
1b947f445b Makefile: drop path rewriting, use pattern to filter 2023-08-07 22:10:44 +02:00
Christian Hesse
c37739c2f6 mod/notification-telegram: introduce $PurgeTelegramQueue
... to purge the queue and remove the scheduler.
2023-08-06 16:35:51 +02:00
Christian Hesse
0aeb34e5e9 mod/notification-matrix: introduce $PurgeMatrixQueue
... to purge the queue and remove the scheduler.
2023-08-06 16:35:51 +02:00
Christian Hesse
9a5d55da0d mod/notification-email: introduce $PurgeEmailQueue
... to purge the queue and remove the scheduler.
2023-08-06 16:35:51 +02:00
Christian Hesse
5b789d298b check-certificates: properly handle in place updates
This worked just kind of... The certification was updated, but script
aborted before the notification was sent.
2023-07-23 22:01:43 +02:00
Christian Hesse
be97de3627 check-routeros-update: also match platform for neighbors 2023-07-15 22:05:47 +02:00
Ben Harris
fbf55292a4 check-routeros-update: match version with date suffix
Neighbor version can have a date suffix. This changes to match only
on the beginning.

Closes: GH-45

Co-authored-by: Christian Hesse <mail@eworm.de>
2023-07-13 08:00:14 +02:00
Christian Hesse
313e026229 netwatch-dns: increase startup delay
In RouterOS 7.9 netwatch itself comes with a (default) startup-delay of five
minutes. Increase our delay to make sure netwatch is active.
2023-06-28 11:29:02 +02:00
Christian Hesse
6247b739a1 netwatch-notify: drop the delay on startup...
... now that in RouterOS 7.9 netwatch itself comes with a startup-delay.
Hosts in state 'unknown' are just ignored.
2023-06-28 11:29:02 +02:00
Christian Hesse
3ed124a013 README: reference stable version 2023-06-28 11:29:02 +02:00
Christian Hesse
08e9634154 global-functions: $MkDir: drop extra block, restore indention
We had this to make the previous commit cleaner. No functional change.
2023-06-28 11:29:02 +02:00
Christian Hesse
5db9a71802 global-functions: $MkDir: drop old code with smb workaround...
... and increase required RouterOS.
2023-06-28 11:29:02 +02:00
Christian Hesse
a030e2f946 Merge branch 'hotspot-to-wpa' into next 2023-06-28 11:26:51 +02:00
Christian Hesse
64ab9eec67 hotspot-to-wpa-cleanup: drop hard-coded timeout, get from comment
This keeps the default of four weeks, though.
2023-06-28 11:26:51 +02:00
Christian Hesse
16a551a0ee hotspot-to-wpa-cleanup: drop hard-coded server name, find by comment 2023-06-28 11:26:51 +02:00
Christian Hesse
0c8bc60648 hotspot-to-wpa: reject for two seconds...
... to make the device send a new DHCP request after.
2023-06-28 11:04:13 +02:00
Christian Hesse
f8a2b88692 hotspot-to-wpa: support non-local users
This has some limitations, though: The password is not known and
additional configuration can not be given in user's comment.
2023-06-28 11:04:13 +02:00
Christian Hesse
5ba34c819a doc/sms-forward: link the RouterOS button to changelog 2023-06-27 17:27:13 +02:00
Christian Hesse
edbb52d4e7 doc/mod/ssh-keys-import: link the RouterOS button to changelog 2023-06-27 17:27:13 +02:00
Christian Hesse
4e411728e6 README: link the RouterOS button to changelog 2023-06-27 17:27:13 +02:00
Christian Hesse
3bdaf6e45d Merge branch 'no-escape-question-mark' into next 2023-06-27 09:14:36 +02:00
Christian Hesse
640b8fd401 global-functions: $IsTimeSync: calculate with uptime, drop scheduler 2023-06-27 09:14:36 +02:00
Christian Hesse
cc5820ed90 update-tunnelbroker: escaping question mark is no longer required 2023-06-27 09:14:36 +02:00
Christian Hesse
0502cf17c9 mod/scriptrunonce: escaping question mark is no longer required 2023-06-27 09:14:36 +02:00
Christian Hesse
a1b896a5d3 mod/notification-email: escaping question mark is no longer required 2023-06-27 09:14:36 +02:00
Christian Hesse
0af1fa4009 global-functions: escaping question mark is no longer required 2023-06-27 09:14:36 +02:00
Christian Hesse
29f0a14b7e global-config: escaping question mark is no longer required 2023-06-27 09:14:36 +02:00
Christian Hesse
ec7adcf78e update-tunnelbroker: rework the retry-loop 2023-06-23 09:49:34 +02:00
Christian Hesse
eb3b4d169e fw-addr-lists: retry to download on failure 2023-06-23 09:49:34 +02:00
Christian Hesse
351c7d31ff mode-button: add dollar sign in scheduler name 2023-06-22 22:45:32 +02:00
Christian Hesse
4a67155d05 packages-update: rename scheduler to match function name 2023-06-22 22:45:32 +02:00
Christian Hesse
6469825398 global-functions: $IsTimeSync: reset ntp client when "waiting"
Every now and then the ntp client stays in status "waiting" forever...
This happens if the server answers, but is not accurate enough. Unlike
with connection failure the address is not rotated. (SUP-120012)

Let's reset it... Should help with a pool address (like pool.ntp.org)
at least.
2023-06-22 22:45:32 +02:00
Christian Hesse
e7d9a94ad8 update list of contributors 2023-06-14 18:29:29 +02:00
Christian Hesse
3358dcb0e7 Merge branch 'fw-addr-lists' into next 2023-06-13 20:28:25 +02:00
Christian Hesse
94b07600ba fw-addr-lists: support domain names in lists 2023-06-13 20:26:55 +02:00
Christian Hesse
458fe7c088 fw-addr-lists: prepare lists from spamhaus.org in config 2023-06-13 20:26:55 +02:00
Christian Hesse
3c61cf57c4 certs: add Cloudflare certificates...
... for later use.
2023-06-13 20:26:55 +02:00
Christian Hesse
53ad7b717d fw-addr-lists: add lists from abuse.ch in config 2023-06-13 20:26:55 +02:00
Christian Hesse
589492621b certs: add GlobalSign certificates...
... for later use.
2023-06-13 20:26:55 +02:00
Christian Hesse
e19e33d0a8 introduce fw-addr-lists 2023-06-13 20:26:55 +02:00
Christian Hesse
196fe1b010 global-functions: $CertificateDownload: add proper version in user agent 2023-06-13 12:53:38 +02:00
Christian Hesse
1e29eeb388 gps-track: add error handling 2023-06-13 09:28:32 +02:00
Christian Hesse
679c971ea6 gps-track: wait to be fully connected 2023-06-13 09:07:57 +02:00
Christian Hesse
db223429b7 Merge branch 'script-lock' into next 2023-06-13 09:07:57 +02:00
Christian Hesse
befa739e11 update-tunnelbroker: lock the script 2023-06-13 09:07:57 +02:00
Christian Hesse
2861610e5a update-gre-address: lock the script 2023-06-13 09:07:57 +02:00
Christian Hesse
cc3a017507 ospf-to-leds: lock the script 2023-06-13 09:07:57 +02:00
Christian Hesse
de750f0559 ipv6-update: lock the script 2023-06-13 09:07:57 +02:00
Christian Hesse
878e1f66f2 ipsec-to-dns: lock the script 2023-06-13 09:07:57 +02:00
Christian Hesse
f375b7fbf7 gps-track: lock the script 2023-06-13 09:00:15 +02:00
Christian Hesse
4176fd058e hotspot-to-wpa: lock the script 2023-06-13 08:58:32 +02:00
Christian Hesse
51ebbd46d9 firmware-upgrade-reboot: lock the script 2023-06-13 08:58:32 +02:00
Christian Hesse
497915b4a2 dhcp-lease-comment: lock the script 2023-06-13 08:58:32 +02:00
Christian Hesse
40f2953dde daily-psk: lock the script 2023-06-13 08:58:32 +02:00
Christian Hesse
d2de9be439 check-lte-firmware-upgrade: lock the script 2023-06-13 08:58:32 +02:00
Christian Hesse
e0714bdfff check-certificates: lock the script 2023-06-13 08:53:03 +02:00
Christian Hesse
4420c79e0c certificate-renew-issued: lock the script 2023-06-13 08:53:03 +02:00
Christian Hesse
1167347ec0 backup-upload: lock the script 2023-06-12 19:04:23 +02:00
Christian Hesse
fa851a7838 backup-partition: lock the script 2023-06-12 19:04:23 +02:00
Christian Hesse
229e116999 backup-email: lock the script 2023-06-12 08:17:36 +02:00
Christian Hesse
4aaa144472 backup-cloud: lock the script 2023-06-12 08:17:36 +02:00
Christian Hesse
2f399f2a48 hotspot-to-wpa: fail on missing context 2023-06-11 23:03:17 +02:00
Christian Hesse
a4354d762f Merge branch 'doc-copy-hint' into next 2023-06-11 22:45:30 +02:00
Christian Hesse
0b8588e6e8 global-config-overlay: link global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
9a1f2deb57 doc/mod/notification-telegram: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
4397869260 global-config-overlay: link 'editing-configuration' in README 2023-06-11 22:45:29 +02:00
Christian Hesse
9ebebcfa52 doc/mod/notification-matrix: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
9ac7cf5fc0 doc/mod/notification-email: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
a0dc721ea3 doc/mod/scriptrunonce: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
c8497d05c5 doc/telegram-chat: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
5c27024bc6 doc/sms-forward: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
b93126bc46 doc/sms-action: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
3fafed250e doc/mode-button: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
601404a5db doc/log-forward: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
4ab1a88a92 doc/ipsec-to-dns: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
8fa04fec15 doc/gps-track: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
a77e0bf0d5 doc/dhcp-to-dns: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
87318fddde doc/daily-psk: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
dea07a7f0b doc/check-routeros-update: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
d4e225f1b7 doc/check-health: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
2ba93f61ac doc/check-certificates: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
e96b2e4853 doc/certificate-renew-issued: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
a65ea3fc26 doc/backup-upload: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
083fa82b13 doc/backup-email: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
5f28e928a1 doc/backup-cloud: hint to copy from global-config 2023-06-11 22:45:29 +02:00
Christian Hesse
964ec39a68 collect-wireless-mac: use 'active-' properties from lease 2023-06-08 21:58:32 +02:00
Christian Hesse
2593f6ba30 dhcp-lease-comment: use 'active-' properties from lease 2023-06-08 21:58:32 +02:00
Christian Hesse
9bfa303038 dhcp-to-dns: use 'active-' properties from lease
Turns out that address for static leases can be an address pool. Of
course that breaks the script as an ip address is expected. Use
'active-address'  instead.

Also let's do the same for 'active-mac-address'...

Fixes GH-43
2023-06-08 21:58:29 +02:00
Christian Hesse
0b04f173c8 check-lte-firmware-upgrade: update formatting of notification 2023-06-07 09:28:51 +02:00
Christian Hesse
d2883e6f43 global-functions: $CertificateDownload: add a delay
For any reason the imported certificate(s) is/are not available for
fetch command immediately. Let's add a delay here... It should not hurt
as certificates are not imported that often.
2023-06-01 21:59:52 +02:00
Christian Hesse
0b8979e5b5 global-functions: $ScriptInstallUpdate: handle scripts with DOS line endings
If the script is converted to DOS line endings (\r\n) on the device it
was no longer handled by $ScriptInstallUpdate. Let's change that...
2023-06-01 21:59:52 +02:00
Christian Hesse
de8c534d41 doc/daily-psk: rename schedulers...
... to match other scripts.
2023-06-01 09:53:33 +02:00
Christian Hesse
95181fbef9 doc/check-certificates: move and rename schedule at startup 2023-06-01 09:53:33 +02:00
Christian Hesse
cfeddde173 doc/check-routeros-update: hint on schedule at startup 2023-06-01 09:53:33 +02:00
Christian Hesse
42c658e1d4 netwatch-dns: reorder variables 2023-06-01 09:53:33 +02:00
Christian Hesse
007d1ff7b8 netwatch-dns: handle status 'up' only 2023-06-01 09:53:33 +02:00
Christian Hesse
f416b0e59d netwatch-notify: ignore status 'unknown' 2023-05-31 15:13:14 +02:00
Christian Hesse
1568df3b4f global-config: end all (array) variables with a semicolon 2023-05-31 11:41:50 +02:00
Christian Hesse
8dc0475108 contrib/logo-color: support settings the background 2023-05-26 11:57:18 +02:00
Christian Hesse
51a7453e6c contrib/notification: update the screenshot procedure 2023-05-26 10:07:37 +02:00
Christian Hesse
73564c74c0 contrib/logo-color: link to doc/mod/notification-telegram 2023-05-25 10:39:16 +02:00
Christian Hesse
80198dcfb5 doc/mod/notification-telegram: show how to set bot's profile photo 2023-05-25 10:39:16 +02:00
Christian Hesse
ccb0e468b4 contrib/logo-color: add screenshots from browser 2023-05-25 10:39:16 +02:00
Christian Hesse
5b869d5191 contrib/notification: fix the font families 2023-05-25 10:39:16 +02:00
Christian Hesse
871f30ad8e contrib/logo-color: fix the font family 2023-05-25 10:39:16 +02:00
Christian Hesse
44e483ecb7 contrib/logo-color: scale up...
... to make BotFather happy, why asks for images with at
least 150x150 pixels.
2023-05-25 10:39:14 +02:00
Christian Hesse
6327348405 check-certificates: split validity output 2023-05-25 10:39:00 +02:00
Christian Hesse
5ae3cb336f add a logo color changer
Generate a colored logo for your notifications!
2023-05-25 10:38:57 +02:00
Christian Hesse
c2e7567c13 logo: rename SVG ids 2023-05-23 11:25:43 +02:00
Christian Hesse
e9b7c7f7ed doc/mod/notification-telegram: describe how to declare functions...
... to use them in own scripts.
2023-05-22 09:52:34 +02:00
Christian Hesse
c0aeee3d3e doc/mod/notification-matrix: describe how to declare functions...
... to use them in own scripts.
2023-05-22 09:52:18 +02:00
Christian Hesse
8284035ad8 doc/mod/notification-email: describe how to declare functions...
... to use them in own scripts.
2023-05-22 09:51:23 +02:00
Christian Hesse
4254b01a32 mod/notification-telegram: fix copy-and-paste error 2023-05-15 21:43:18 +02:00
Christian Hesse
9069f71ee6 daily-psk: use $ParseDate 2023-05-10 20:02:44 +02:00
Christian Hesse
60f863871c global-functions: $ParseDate: handle date in ISO standard format
This was introduced with RouterOS 7.10beta5...

https://xkcd.com/1179/ 😜
2023-05-10 20:02:44 +02:00
Christian Hesse
bafd71344d global-functions: introduce $ParseDate
The extra indention is intended for a later change.
2023-05-10 20:02:44 +02:00
Christian Hesse
e7927e0eee daily-psk: explicitly cast to num 2023-05-10 18:10:31 +02:00
Christian Hesse
d586a5ab19 daily-psk: simplify calculation
Use a named array, and drop the loop...
2023-05-10 18:10:31 +02:00
Christian Hesse
3fe66c8413 update list of contributors 2023-05-02 16:19:44 +02:00
Christian Hesse
1f1e76b822 sms-forward: drop workaround, add required RouterOS 2023-04-26 10:31:23 +02:00
Christian Hesse
c8500dddd0 mod/ssh-keys-import: make ssh-keys-import a module 2023-04-26 10:31:23 +02:00
Christian Hesse
a3a7e5be4b global-config: restore variables still used in ipsec-to-dns (for now) 2023-04-26 10:31:23 +02:00
Christian Hesse
5c7a7723f3 global-config: be more verbose about domain 2023-04-26 10:30:10 +02:00
Christian Hesse
575c77d1a6 mod/bridge-port-to: increase the delay before re-enabling
Looks like two seconds is way too short... NetworkManager act after five
seconds - so let's delay that time at least.

https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html#carrier-wait-timeout
2023-04-25 09:45:46 +02:00
Christian Hesse
9dead9cc33 mod/bridge-port-vlan: increase the delay before re-enabling
Looks like two seconds is way too short... NetworkManager act after five
seconds - so let's delay that time at least.

https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html#carrier-wait-timeout
2023-04-25 09:43:50 +02:00
Christian Hesse
19eb8653af Merge branch 'dhcp-to-dns' into next 2023-04-24 22:26:26 +02:00
Christian Hesse
83e57e6aab Merge branch 'FormatLine' into next 2023-04-24 22:26:26 +02:00
Christian Hesse
ee94024dca dhcp-to-dns: get domain from dhcp server's network definition 2023-04-24 22:26:26 +02:00
Christian Hesse
82b5ae174a mod/ipcalc: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
ac5d84173f dhcp-to-dns: rename variable to not clash with global one 2023-04-24 22:26:26 +02:00
Christian Hesse
944b2f5864 daily-psk: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
79cdefbd1e dhcp-to-dns: handle change of domain 2023-04-24 22:26:26 +02:00
Christian Hesse
b705ceae59 collect-wireless-mac: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
517bb4ede8 dhcp-to-dns: get all values of dns record 2023-04-24 22:26:26 +02:00
Christian Hesse
3f9480f9f2 check-lte-firmware-upgrade: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
4c416cb39e dhcp-to-dns: handle duplicate leases earlier 2023-04-24 22:26:26 +02:00
Christian Hesse
b1cb4cb10f check-health: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
f3876b0637 dhcp-to-dns: handle dns record by comment and type 2023-04-24 22:26:26 +02:00
Christian Hesse
7ed70bdb26 check-certificates: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
bac6a72d51 backup-upload: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
637b5e21da backup-email: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
31553f86a6 backup-cloud: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
fb12aabf3e global-functions: $DeviceInfo: use $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
cb338c76a8 global-functions: introduce $FormatLine 2023-04-24 22:26:26 +02:00
Christian Hesse
fb9feea595 check-certificates: add certificate name in notification subject 2023-04-19 22:05:43 +02:00
Christian Hesse
be0bbe80d9 check-routeros-update: add version in notification subject 2023-04-19 22:05:43 +02:00
Christian Hesse
baf6b3ae17 README: make the screenshot match the example 2023-04-19 08:28:32 +02:00
Christian Hesse
69ea231efc README: make the Telegram QR code a link 2023-04-18 23:14:37 +02:00
Christian Hesse
f7eb123f3d README: add a donate button to badges 2023-04-18 23:14:37 +02:00
Christian Hesse
5324bffd84 README: generate a donate buttom from shields.io 2023-04-18 23:14:37 +02:00
Christian Hesse
b4fbd65f55 README: note about breaking changes 2023-04-17 11:00:52 +02:00
Christian Hesse
f1c634b984 README: add badge to link Telegram group 2023-04-16 22:07:54 +02:00
Christian Hesse
03bf3d67a0 Merge branch 'check-certificates' into next 2023-04-07 23:43:45 +02:00
Christian Hesse
f14788a104 check-certificates: properly escape the name for regex 2023-04-07 23:36:09 +02:00
Christian Hesse
9617095022 check-certificates: try all SANs for download 2023-04-07 23:36:09 +02:00
Christian Hesse
922dde3ff0 check-certificates: make the function return a status 2023-04-07 23:01:32 +02:00
Christian Hesse
46110661e0 check-certificates: do not rename certificates without common-name 2023-04-07 23:01:20 +02:00
Christian Hesse
11093045f3 check-certificates: download and import in a local function 2023-04-07 22:53:33 +02:00
Christian Hesse
4073daa139 check-certificates: include SANs in information 2023-04-07 22:53:33 +02:00
Christian Hesse
f585b6ee32 README: add badge to hint required RouterOS version 2023-04-06 20:33:01 +02:00
Christian Hesse
706e4de6d1 check-certificates: show CommonName only if available 2023-04-06 20:33:01 +02:00
Christian Hesse
a263fcdec2 check-certificates: format information in a local function 2023-04-06 20:33:01 +02:00
Christian Hesse
a1f6bd532b mod/scriptrunonce: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
61e0e052a6 mod/notification-telegram: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
b7cb722b5c mod/notification-matrix: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
9136bf28bd mod/notification-email: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
8edf694b54 mod/ipcalc: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
b6f9094c3d mod/inspectvar: link documentation 2023-04-04 19:24:32 +02:00
Christian Hesse
68364d4a50 doc/check-health: use an unusual interval 2023-03-31 17:45:55 +02:00
Christian Hesse
415c4144f2 global-functions: $VersionToNum: support "alpha" in version string 2023-03-30 20:58:19 +02:00
Christian Hesse
5f374c469a global-functions: $RequiredRouterOS: accept "alpha" in version string 2023-03-30 20:50:55 +02:00
Christian Hesse
779b3b8872 dhcp-to-dns: use better condition
The condition worked, but could match others (AAAA, NXDOMAIN, ...) as
well (though these should not exist).

The problem is that matching with `type=A` does not return any results.
For historical reasons A records have no type, thus can be matched with
`!type`. I opened an issue to fix this... (SUP-111312)

So let's assum `!type` works and `type=A` could become valid...
2023-03-29 15:49:41 +02:00
Christian Hesse
3d0107ed2c contrib/notification.html: add and load the script 2023-03-29 15:35:07 +02:00
Christian Hesse
9d823448f6 contrib/notification.html: fix warnings and errors
Checked with W3C validator: https://validator.w3.org/
2023-03-29 15:30:21 +02:00
Christian Hesse
814fb7197f Merge branch 'mkdir' into next 2023-03-29 12:13:59 +02:00
Christian Hesse
f2e8115272 global-functions: $MkDir: make directory by adding file
This is new functionality in RouterOS 7.9beta4, where new file can be
added with `/file/add ...`. This also creates directories for the full
path.
2023-03-28 15:43:49 +02:00
Christian Hesse
7fdec1abed global-functions: $MkDir: add extra block for indention...
... to make the next commit cleaner. No functional change.
2023-03-28 15:43:35 +02:00
Christian Hesse
d700dbc00e dhcp-to-dns: support host name from dhcp lease comment
The lease comment is supposed to be a human readable string... But we
could allow parsable information.
2023-03-28 12:05:47 +02:00
Christian Hesse
d3ca506394 global-functions: $MkDir: create tmpfs in local function 2023-03-28 12:05:47 +02:00
Christian Hesse
7293306f76 global-functions: $MkDir: return false on error 2023-03-28 12:05:47 +02:00
Christian Hesse
847f0a4564 global-functions: $MkDir: drop unused function 2023-03-28 12:05:47 +02:00
Christian Hesse
40f0d54ea8 dhcp-to-dns: add cname if host name appears for existing record 2023-03-28 11:42:58 +02:00
Christian Hesse
b22a84ed0f doc/dhcp-to-dns: mention A record and optional CNAME record 2023-03-28 11:42:58 +02:00
Christian Hesse
742c239629 sms-forward: check that the interface is running 2023-03-28 11:42:58 +02:00
Christian Hesse
4f722bc2c9 sms-forward: disable workaround for ROS 7.9beta4
The issue has been acknowledged by Mikrotik, but the cause is still
unknown as the sms code did not change since RouterOS 7.6...

Well, looks like the behavior changes again with RouterOS 7.9beta4, and
everything works as expected again. So disable the workaround there.
2023-03-24 20:11:29 +01:00
Christian Hesse
eab87e4d60 sms-forward: add workaround to fix removal of messages
Removal of messages is broken in RouterOS 7.8:

[admin@MikroTik] > /tool/sms/inbox/remove [ find ]
failure: Interface not running!

Of course the interface is running. Toggling the auto-erase setting
fixes this until next boot. So let's add a workaround...

Reported to support (SUP-110828), but not (yet) acknowledged. 🤨
2023-03-23 13:59:55 +01:00
Christian Hesse
0d4ab1fb3e Merge branch 'dhcp-to-dns' into next 2023-03-22 21:53:32 +01:00
Christian Hesse
295ccb570d dhcp-to-dns: update cname record on changed host name 2023-03-22 21:53:32 +01:00
Christian Hesse
b13a53531b dhcp-to-dns: just update the address
The other values *should* be unchanged...
2023-03-22 21:53:32 +01:00
Christian Hesse
c5c235246b dhcp-to-dns: add debug message on duplicate leases 2023-03-22 21:53:32 +01:00
Christian Hesse
8c728bb6ab dhcp-to-dns: do not update records based on host name 2023-03-22 21:53:32 +01:00
Christian Hesse
aac8709881 dhcp-to-dns: always create A record with mac address...
... and an optional CNAME with host name.
2023-03-22 21:53:32 +01:00
Christian Hesse
4a0f395fe1 dhcp-to-dns: split fqdn to host name and domain 2023-03-22 10:42:41 +01:00
Christian Hesse
3396aefac9 lease-script: add script name in order
This makes sure scripts with the same order can not conflict.
2023-03-22 10:13:24 +01:00
Christian Hesse
682a09c94b dhcp-to-dns: match comment on beginning of line 2023-03-22 10:13:24 +01:00
Christian Hesse
3d589def7d dhcp-to-dns: allow the matching separator string in name 2023-03-22 10:13:24 +01:00
Christian Hesse
58a42f4ece ipsec-to-dns: match comment on beginning of line 2023-03-22 09:00:28 +01:00
Christian Hesse
6e8c98e43d ipsec-to-dns: allow the matching separator string in name 2023-03-22 08:58:51 +01:00
Christian Hesse
524c1fc032 README: badge in style flat and with color 2023-03-20 17:36:31 +01:00
Christian Hesse
b66364d716 doc/netwatch-notify: prevent escaping code in hook by creating a script 2023-03-20 13:32:39 +01:00
Christian Hesse
f7962f5d79 doc/netwatch-notify: move hint on notification settings up 2023-03-20 12:35:34 +01:00
Christian Hesse
650c362ed9 netwatch-notify: support note in notification 2023-03-20 12:35:34 +01:00
Christian Hesse
3b5026ea8d drop dummy scripts used for migration
This now causes expected warnings on first run of $ScriptInstallUpdate.
The migration still works, as we keep `global-config.changes` and
`global-functions`.
2023-03-10 09:58:01 +01:00
Christian Hesse
56ae457d77 global-functions: $ScriptInstallUpdate: add proper version in user agent
This allows me to identify what RouterOS versions are run on devices
fetching my scripts, which may helps to decide what incompatible changes
to push.
2023-03-10 09:46:16 +01:00
Christian Hesse
7912091f63 lease-script: make sure not to match self 2023-03-07 22:26:01 +01:00
Christian Hesse
e902e3fdd5 global-functions: $ScriptInstallUpdate: make sure not to match self 2023-03-07 22:26:01 +01:00
Christian Hesse
a832fd04ef rename scripts and add file extension ".rsc"
No functional change for the user... The migration is done
automatically.
2023-03-07 22:26:01 +01:00
Christian Hesse
1e6e0646e2 add the notification generator 2023-03-06 21:07:58 +01:00
Christian Hesse
4ca8f83a52 ... and update the logo in notifications 2023-03-06 21:07:58 +01:00
Christian Hesse
154a036c64 use a new logo 2023-03-06 21:07:58 +01:00
Christian Hesse
d2d913ec19 check-routeros-update: allow to install all updates automatically...
... but with extra hurdle for more awareness of danger.

Let's not send a new notification, intentionally. This feature is
dangerous, and we should not advertise it.
2023-03-06 21:06:48 +01:00
Christian Hesse
a9741336b8 doc/check-routeros-update: update wording and details 2023-03-03 14:08:48 +01:00
Christian Hesse
b0595e53a5 global-functions: $MkDir: drop the compatibility workaround
If you are still running RouterOS 7.6 or older add this in your
global-config-overlay:

    :global ScriptUpdatesUrlSuffix "\?h=routeros-7.7~1";

... and remeber to revert that change once updated.
2023-02-26 22:27:14 +01:00
Christian Hesse
bfd1361f71 telegram-chat: get the uptime just once 2023-02-26 22:19:36 +01:00
Christian Hesse
02b447212d telegram-chat: ignore new messages after reboot
This script supports multiple devices, and sending offset to discard
messages is delayed to third fetch to make sure all devices get the
message.

This can cause trouble, though: Sending a device a reboot command can
make that device reboot multiple times 🥴 or - even worse - make it
enter an infinite boot loop 😳 if it is the only device.

So let's ignore first messages after reboot.
2023-02-26 22:19:36 +01:00
Christian Hesse
5ea892662f telegram-chat: send messages in reply 2023-02-26 22:19:30 +01:00
Christian Hesse
b963761874 mod/notification-telegram: support sending in reply 2023-02-24 12:13:44 +01:00
Christian Hesse
8213c5ed61 netwatch-notify: support sending silent notifications 2023-02-24 12:13:35 +01:00
Christian Hesse
fe0460ef6d INITIAL-COMMANDS: link to new paragraphs 2023-02-17 12:27:47 +01:00
Christian Hesse
da46c42d4a README: add a paragraph for scheduled automatic updates 2023-02-17 12:23:05 +01:00
Christian Hesse
c247fe5a96 README: move configuration down, make it a separate paragraph 2023-02-17 08:05:15 +01:00
Christian Hesse
49e89070a1 packages-update: put reboot into a function
Make the logic even simpler... Let's put the reboot code into a
function. That is volatile, so device does not reboot if it is
rebooted already.
2023-02-16 12:03:46 +01:00
Christian Hesse
7c2ac135e3 packages-update: check version before reboot from scheduler
Chances are that the device was rebooted manually... Do not reboot then.
2023-02-16 11:53:05 +01:00
Christian Hesse
95b8a47b81 telegram-chat: log command with failed syntax validation 2023-02-14 23:01:24 +01:00
Christian Hesse
f1ad240e59 telegram-chat: never decrease the local offset 2023-02-14 23:01:24 +01:00
Christian Hesse
77d26e02d4 telegram-chat: add debug message for handled updates 2023-02-14 23:01:16 +01:00
Christian Hesse
2a7576f4e4 telegram-chat: add updateid in log messages 2023-02-14 21:28:15 +01:00
Christian Hesse
c48509683c check-health: wording: load -> utilization
The load is defined as something different...

https://en.wikipedia.org/wiki/Load_(computing)

So let's update the wording and use 'utilization' instead.

---- ✂️ ----
🧮📈️ Health warning: CPU utilization

The average CPU utilization on MikroTik is at 76%!
---- ✂️ ----
🧮📉️ Health recovery: CPU utilization

The average CPU utilization on MikroTik decreased to 64%.
---- ✂️ ----
2023-02-14 20:24:06 +01:00
Christian Hesse
e50e25c638 doc/check-health: make the voltage limit a separate point 2023-02-13 21:10:35 +01:00
Christian Hesse
b6d2cb44c1 doc/check-health: add line break between screenshots 2023-02-13 21:10:35 +01:00
Christian Hesse
ad75d6e031 README: give hint about converting line endings 2023-02-13 21:10:35 +01:00
Christian Hesse
f5d872a990 global-functions: $PrettyPrint: use $Unix2Dos 2023-02-13 10:36:56 +01:00
Christian Hesse
d54c46ab98 global-functions: introduce $Dos2Unix 2023-02-13 10:36:56 +01:00
Christian Hesse
7d3c4738d0 global-functions: introduce $Unix2Dos 2023-02-13 10:35:27 +01:00
Christian Hesse
62707dc549 ipv6-update: support host addresses in address-list 2023-02-10 11:36:12 +01:00
Christian Hesse
a34d5d7141 ipv6-update: accept a single prefix only 2023-02-09 22:43:09 +01:00
Christian Hesse
769edbcf61 ipv6-update: rename variable 2023-02-09 22:42:36 +01:00
Christian Hesse
c6245b3125 ipv6-update: use identical parameters to find address 2023-02-09 22:10:48 +01:00
Christian Hesse
15fc0b91e9 doc/backup-upload: new option $BackupSendGlobalConfig 2023-02-08 09:44:52 +01:00
Christian Hesse
f2f7d66b2d doc/backup-email: new option $BackupSendGlobalConfig 2023-02-08 09:44:21 +01:00
Christian Hesse
818638d0f4 backup-upload: use :use inside :execute for global-config-overlay 2023-02-08 09:14:02 +01:00
Christian Hesse
b9eaab8e77 backup-email: use :use inside :execute for global-config-overlay
This will add carriage return and line feed, but works around the
limitation of reading just four kilobytes from file.
2023-02-08 09:14:02 +01:00
Christian Hesse
d63db7ea95 global-functions: $ScriptInstallUpdate: use complete property name 2023-02-07 21:20:49 +01:00
Christian Hesse
58a6fac3d9 telegram-chat: use complete property name 2023-02-07 21:19:57 +01:00
Christian Hesse
aee42d31e1 Merge branch 'backup-g-c-o' into next 2023-02-07 21:19:57 +01:00
Christian Hesse
ba730708f5 notify about backup for global-config-overlay 2023-02-07 21:19:57 +01:00
Christian Hesse
5d263ca11e backup-upload: support uploading global-config-overlay 2023-02-07 21:19:57 +01:00
Christian Hesse
0527503c8e backup-email: support sending global-config-overlay 2023-02-07 21:19:57 +01:00
Christian Hesse
48bf54644a global-config: new option to backup global-config-overlay 2023-02-07 20:24:50 +01:00
Christian Hesse
9c066599e8 telegram-chat: handle exceeded file read size 2023-02-04 23:24:44 +01:00
Christian Hesse
600203797b telegram-chat: no need to :put ...
... a simple change to root dir is sufficient.
2023-02-03 22:30:08 +01:00
Christian Hesse
04c26d3d2e telegram-chat: log with severity debug only...
... as failed request are quite common.
2023-02-03 22:01:35 +01:00
Christian Hesse
8a900dce00 telegram-chat: delay confirmation of updates
Several devices can communicate with the same bot, and we want all of
them to receive their updates. However this can be tricky, as...

* ... sometimes internet connection can be unreliable or saturated.
* ... device can be busy with long running command.
* ... the Telegram bot api servers seem to implement what ever kind of
  rate limiting. Anybody can give details?

So let's confirm the update id after third request only. 😁 This gives
delayed devices some extra chances to catch up.
2023-02-03 21:59:26 +01:00
Christian Hesse
4bc5b9cf5f telegram-chat: log warning only when trying to activate 2023-02-03 09:56:30 +01:00
Christian Hesse
9d1cf87489 telegram-chat: handle missing username 2023-02-03 09:53:49 +01:00
Christian Hesse
490a738af1 backup-email: wait for the mail to be sent 2023-02-02 11:52:23 +01:00
Christian Hesse
c47c9a2906 telegram-chat: discard messages without text 2023-02-02 11:30:49 +01:00
Christian Hesse
82003bc7d1 telegram-chat: allow to modify the time to wait for command
For now this is a hidden settings... Do we want this to be documented?
2023-02-02 11:24:45 +01:00
Christian Hesse
978c03131a global-functions: $WaitForFile: use delay instead of iterations 2023-02-02 11:20:14 +01:00
Christian Hesse
b794d98cbb telegram-chat: reply with a hint when untrusted...
... but only when activating via identity.
2023-02-02 10:06:42 +01:00
Christian Hesse
08383daa5c telegram-chat: always reply to origin chat 2023-02-02 10:06:42 +01:00
Christian Hesse
2cb74f0269 mod/notification-telegram: support sending to specific chatid 2023-02-02 09:11:34 +01:00
Christian Hesse
bf1af61d2d doc/telegram-chat: give an example on how to work around command runtime 2023-02-01 17:28:45 +01:00
Christian Hesse
049a029170 doc/telegram-chat: add hint on output size 2023-02-01 14:30:52 +01:00
Christian Hesse
8dd53c80f5 telegram-chat: modify text if no output available 2023-02-01 14:26:28 +01:00
Christian Hesse
b5399099c6 telegram-chat: also give a hint on failed syntax validation
... and drop the warning in log instead.
2023-02-01 11:29:56 +01:00
Christian Hesse
a073835667 telegram-chat: ... and give a hint on failure 2023-02-01 11:29:56 +01:00
Christian Hesse
c2cf05e9e5 telegram-chat: handle error in command... 2023-02-01 11:29:56 +01:00
Christian Hesse
44c30efbcd telegram-chat: give a hint if command is still running 2023-02-01 11:29:56 +01:00
Christian Hesse
7e7987afec doc/telegram-chat: add hint on command runtime 2023-02-01 11:29:56 +01:00
Christian Hesse
8f47bc9836 doc/telegram-chat: warn about changing group id 2023-02-01 11:29:51 +01:00
Christian Hesse
8b488cb82f doc/telegram-chat: allow bots to receive messages in a group 2023-01-31 18:11:22 +01:00
Christian Hesse
63de875129 daily-psk: make qr-code url configurable 2023-01-31 17:27:15 +01:00
Christian Hesse
cbc547332e check-routeros-update: drop check for cap
This becomes complicated with legacy wireless and wifiwave2 package, old
and new CAPsMAN. Let's just drop the check.
2023-01-31 17:27:15 +01:00
Christian Hesse
819c7294c6 introduce telegram-chat
Druvis from Mikrotik produced a video "MikroTik Telegram bot - Chat with
your Router?". He shows his script to chat with a Router via Telegram
bot to send it commands: https://youtu.be/KLX6j3sLRIE

This script is kind of limited and has several issues... 🥴

Let's make it robust, usable, multi-device capable and just fun! 😁

(Sadly Mikrotik has a policy to not allow links in Youtube comments.
Thus my comment with several hints was removed immediately. If anybody
is in contact with Druvis... Please tell him about this script!)
2023-01-31 17:26:51 +01:00
Christian Hesse
f666d2f8ff global-functions: $WaitForFile: allow to give iterations...
... to increase timeout. Every iteration is about 100ms.
2023-01-31 15:18:17 +01:00
Christian Hesse
f62328ee8d check-certificates: handle decryption failures and warn
If a download succeeds at least one of the given passphrases is
expected to decrypt a key in the file.
2023-01-26 21:35:35 +01:00
Christian Hesse
b0d3e3d5f4 global-functions: $LogPrintExit2: always print the message...
... even on error. Not sure why and when this broke.
2023-01-26 21:04:59 +01:00
Christian Hesse
5c3585cd98 update list of contributors 2023-01-24 13:18:17 +01:00
Christian Hesse
555d0e8bfc check-certificates: make the warning time configurable 2023-01-23 17:46:03 +01:00
Christian Hesse
36a8938dea doc/check-certificates: document the renew time 2023-01-23 17:45:22 +01:00
Christian Hesse
f9839647d4 global-functions: $MkDir: catch error on creating tmpfs 2023-01-23 16:21:30 +01:00
Christian Hesse
c8dcd92e6b global-functions: $MkDir: create with reasonable tmpfs-max-size
Giving no tmpfs-max-size breaks with RouterOS 7.8beta2, where a size
limit is enforced.
2023-01-23 16:21:02 +01:00
Christian Hesse
c7498c6397 daily-psk: fixes for CAPsMAN 2023-01-22 12:16:06 +01:00
Christian Hesse
e6c256cd4b check-health: notify about new features 2023-01-20 23:20:53 +01:00
Christian Hesse
e9a426a798 check-health: silently exit without health readings...
... but after checking CPU load and free RAM.
2023-01-20 23:20:53 +01:00
Christian Hesse
6780e1a24c check-health: monitor free RAM
---- ✂️ ----
🗃️📉️ Health warning: free RAM

The available free RAM on MikroTik is at 18% (47MiB)!
---- ✂️ ----
🗃️📈️ Health recovery: free RAM

The available free RAM on MikroTik increased to 65% (168MiB).
---- ✂️ ----
2023-01-20 23:20:53 +01:00
Christian Hesse
75bd14267e check-health: monitor CPU load
---- ✂️ ----
🧮📈️ Health warning: CPU load

The average CPU load on MikroTik is at 76%!
---- ✂️ ----
🧮📉️ Health recovery: CPU load

The average CPU load on MikroTik decreased to 64%.
---- ✂️ ----
2023-01-20 23:13:27 +01:00
Christian Hesse
2694f8d2b1 global-functions: $RequiredRouterOS: check for valid version string 2023-01-20 11:26:53 +01:00
Christian Hesse
9033e16921 global-functions: use new functionality for version check 2023-01-20 11:26:53 +01:00
Christian Hesse
de9dde1b14 global-functions: $ScriptInstallUpdate: add a version check for scripts
New RouterOS releases bring new features, and thus new syntax.
Installing a new script on old RouterOS results in syntax errors. We
want to give clear warning messages, so by adding an extra comment into
the script...

    # requires RouterOS, version=7.8beta3

... installing on unsupported RouterOS version is mitigated.
2023-01-20 11:26:53 +01:00
Christian Hesse
9887ab0849 lease-script: use $Grep 2023-01-20 11:26:53 +01:00
Christian Hesse
b834517baa global-functions: implement $Grep...
... that returns the first line that matches a pattern.
2023-01-20 11:26:53 +01:00
Christian Hesse
072d349473 log-forward: cache the result of $LogForwardFilterLogForwarding
Looks like the function is called for every message to match otherwise. 😳
2023-01-20 11:26:53 +01:00
Christian Hesse
2294ac77a8 doc/log-forward: add tips and tricks 2023-01-20 00:34:27 +01:00
Christian Hesse
cfb31e840c doc/log-forward: add some more details 2023-01-18 11:53:57 +01:00
Christian Hesse
03fb459ea4 ipsec-to-dns: handle "CN=" from peer's id
This was missing in commit bff6689b10 and
cause the dns entry to be delete and re-created over and over again.
2023-01-17 12:34:05 +01:00
Christian Hesse
23e5c01a42 global-functions: $MkDir: no early continue for dir "tmpfs"...
... as we want a RAM disk.
2023-01-12 23:43:38 +01:00
Christian Hesse
aabc6b22fe doc/daily-psk: drop the start-date from scheduler 2023-01-12 23:28:37 +01:00
Christian Hesse
ab306ad3c7 doc/daily-psk: add missing bits for CAPsMAN 2023-01-12 23:26:23 +01:00
Christian Hesse
f67dc0218b global-functions: $ScriptInstallUpdate: handle config version decrease...
... and log a warning.
2023-01-12 15:40:05 +01:00
Christian Hesse
47a657d25c mod/notification-*: support extra text (or emojis 🚀) in notification tags 2023-01-12 15:40:05 +01:00
Christian Hesse
c8e22f33c2 mod/notification-email: split off generation of subject 2023-01-11 12:28:31 +01:00
Christian Hesse
a953a8fa59 mod/notification-email: move $QuotedPrintable (from global-functions)
This is used for e-mail only...
2023-01-11 12:28:31 +01:00
Christian Hesse
329bef94df log-forward: do not declare unused function 2023-01-11 12:28:31 +01:00
Christian Hesse
868557a24a log-forward: generate filter in mod/notification-email 2023-01-11 12:28:31 +01:00
Christian Hesse
34ed387343 use arrows with emoji representation
We had...

  ◀ Go back to main README
  ▲ Go back to top

... and switch to...

  ⬅️ Go back to main README
  ⬆️ Go back to top
2023-01-11 12:28:31 +01:00
Christian Hesse
a38272e15e README: install custom script from routeros-scripts-custom 2023-01-11 12:28:31 +01:00
Christian Hesse
f211a8d099 README: add linked custom scripts & modules 2023-01-10 21:21:58 +01:00
Christian Hesse
80671e3803 doc/sms-forward: take care of harmful commands in hooks 2023-01-10 08:58:33 +01:00
Christian Hesse
1ea613e8a0 update list of contributors 2023-01-10 08:58:33 +01:00
Anatoly Bubenkov
ea09a18d3f sms-forward: support hooks 2023-01-10 08:58:33 +01:00
Christian Hesse
88b34cfb39 doc/sms-forward: reorder configuration 2023-01-09 15:35:57 +01:00
Anatoly Bubenkov
03ca9464df .gitignore: ignore folder settings file 2023-01-02 23:49:26 +01:00
Christian Hesse
84be9123ef .gitignore: ignore files created by patch command 2023-01-02 23:49:26 +01:00
Christian Hesse
b730264d80 .gitignore: add comments 2023-01-02 23:49:26 +01:00
Christian Hesse
d1caf2bf10 backup-upload: keep floppy emoji for failure 2023-01-02 23:49:26 +01:00
Christian Hesse
4f931db1c3 backup-cloud: keep floppy emoji for failure 2023-01-02 23:49:26 +01:00
Christian Hesse
2f774f723d update copyright for 2023 2023-01-02 23:49:26 +01:00
Christian Hesse
9983a69188 README: RouterOS v7 path syntax
Missed one in b6ddc5968e7a3393bb6e9b0c0ccf96379efc62b4...
2022-12-19 09:49:45 +01:00
Christian Hesse
a3e2822a0a backup-upload: switch path to tmpfs 2022-12-13 21:50:32 +01:00
Christian Hesse
d3351bcf18 backup-email: switch path to tmpfs 2022-12-13 21:50:32 +01:00
Christian Hesse
f8258b90a7 backup-upload: create directory later 2022-12-13 21:50:32 +01:00
Christian Hesse
8b2571dc49 backup-email: create directory later 2022-12-13 21:50:32 +01:00
Christian Hesse
16bfe4de7e global-functions: $MkDir: create a tmpfs (RAM disk)...
... if the path starts with "tmpfs/". This helps to mitigate flash wear.
2022-12-13 21:50:32 +01:00
Christian Hesse
1579330864 global-functions: $MkDir: create directories recursively 2022-12-13 21:25:07 +01:00
Christian Hesse
58f769ac00 global-functions: $MkDir: rename internal variable 2022-12-13 10:37:56 +01:00
Christian Hesse
446d5c89fc global-functions: $MkDir: fail if non-directory path exists 2022-12-13 10:31:41 +01:00
Christian Hesse
9c42263988 global-functions: check RouterOS version before loading modules 2022-12-12 15:16:36 +01:00
Christian Hesse
7f7c3a7a70 global-functions: $SymbolByUnicodeName: append variation selector-16...
... to specify that the preceding character should be displayed with emoji
presentation.

https://unicode-table.com/en/FE0F/
2022-12-06 16:41:14 +01:00
Christian Hesse
8854d03ea2 global-functions: introduce $IsMacLocallyAdministered...
... and use it in $GetMacVendor.
2022-11-29 17:07:40 +01:00
Christian Hesse
0ad94b042d netwatch-notify: support type https-get
... which was introduced in RouterOS 7.7beta8.
2022-11-25 08:39:07 +01:00
Christian Hesse
ad85f22540 global-functions: $IsTimeSync: no cloud on x86 2022-11-22 22:24:59 +01:00
Christian Hesse
ef7360453f global-functions: $IsTimeSync: no cloud with CHR free license 2022-11-22 22:23:51 +01:00
Christian Hesse
a7bdebbfb0 doc/mod/notification-email: mention correct time 2022-11-22 21:49:34 +01:00
Christian Hesse
89c0fde465 mod/notification-email: put status in scheduler comment 2022-11-22 21:28:45 +01:00
Christian Hesse
03d1927067 mod/notification-email: set scheduler interval earlier
... to make sure the checks are not re-run every second.
2022-11-22 21:28:26 +01:00
Christian Hesse
ab3047ee82 mod/notification-email: reference scheduler from variable 2022-11-22 21:27:51 +01:00
Christian Hesse
c2a29da9f2 global-functions: $ScriptLock: use shorter random string
... but with all characters from alphabet with $GetRandom20CharAlNum.
2022-11-22 19:05:29 +01:00
Christian Hesse
3c4595e82b global-functions: $MkDir: use shorter random string
... but with all characters from alphabet with $GetRandom20CharAlNum.
2022-11-22 19:05:02 +01:00
Christian Hesse
514d241969 README: link to Github pull requests 2022-11-17 23:02:02 +01:00
Christian Hesse
6f79eb996a mod/notification-email: make sure the scheduler interval is never zero 2022-11-17 22:34:08 +01:00
Christian Hesse
b517b26517 mod/notification-email: check that attachment exists 2022-11-17 22:18:16 +01:00
Christian Hesse
71d1f2a781 mod/notification-email: convert to array earlier 2022-11-17 22:13:02 +01:00
Christian Hesse
9f02f04334 mod/notification-email: fix typo 2022-11-17 22:10:52 +01:00
Christian Hesse
7594345da8 README: copy *relevant* configuration only 2022-10-31 21:45:36 +01:00
Christian Hesse
6822e71564 netwatch-notify: cache the result
If this script runs from terminal this will not change... 😜
So cache the result.

Co-authored-by: Michael Gisbers <michael@gisbers.de>
2022-10-21 15:00:42 +02:00
Michael Gisbers
a0163aa487 netwatch-notify: always show messages when run from terminal
Co-authored-by: Christian Hesse <mail@eworm.de>
2022-10-21 15:00:41 +02:00
Christian Hesse
c3da4ed696 netwatch-notify: stop flooding the log after down notification
This will now log all messages before notification, and every two hours
(or scheduler interval * 120) after.
2022-10-21 15:00:39 +02:00
Christian Hesse
a1ef912ec7 Merge branch 'notifications' into next
These are generated with my 'RouterOS-Scripts Notification Generator':
https://eworm.de/ros/notification/
2022-10-20 11:37:35 +02:00
Christian Hesse
aef88e313b doc/sms-forward: update notification
---- ✂️ ----
📨 SMS Forwarding from 7277

Received this message by MikroTik from 7277:

On oct/17/2022 13:44:10 GMT -0 type class-0:
Welcome to our network!
---- ✂️ ----
2022-10-20 11:37:09 +02:00
Christian Hesse
ee7836263f doc/netwatch-notify: update notifications
---- ✂️ ----
 Netwatch Notify: example.com down

The host 'example.com' (93.184.216.34) is down since oct/19/2022 16:27:03.
---- ✂️ ----
 Netwatch Notify: example.com up

The host 'example.com' (93.184.216.34) is up since oct/19/2022 17:03:00.
It was down for 6 checks since oct/19/2022 16:27:03.
---- ✂️ ----
2022-10-20 11:37:05 +02:00
Christian Hesse
4f8a2bd8e2 doc/log-forward: update notification
---- ✂️ ----
⚠️ Log Forwarding

The log on MikroTik contains these 3 messages after 6d23:55:18 uptime.

 ● 13:24:02 script;error backup-cloud: Failed uploading backup for MikroTik to cloud!
 ● 13:24:17 system;info;account user admin logged in from 192.168.88.177 via ssh
 ● 13:24:57 system;info;account user admin logged out from 192.168.88.177 via ssh
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
694f4e2894 doc/daily-psk: update notification
---- ✂️ ----
📅 daily PSK Guest-Wifi

This is the daily PSK on MikroTik:

SSID: Guest-Wifi
PSK:  S3cr3tStr1ng
Date: oct/18/2022

A client device specific rule must not exist!

🔗 https://www.eworm.de/cgi-bin/cqrlogo-wifi.cgi?scale=8&level=1&ssid=Guest-Wifi&pass=S3cr3tStr1ng
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
dddbd3da27 doc/collect-wireless-mac: update notification
---- ✂️ ----
📱 48:F1:7F:D0:E5:4E connected to Wifi

A device with unknown MAC address connected to Wifi on MikroTik.

Controller: MikroTik
Interface:  wl5-wifi
SSID:       Wifi
MAC:        48:F1:7F:D0:E5:4E
Vendor:     Intel Corporate
Hostname:   host-523c8e0e
Address:    192.168.20.254
DNS name:   host-523c8e0e.dhcp.MikroTik.example.com
Date:       oct/20/2022 09:21:56
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
6940f851b0 doc/check-routeros-update: update notification
---- ✂️ ----
 RouterOS update

A new RouterOS version 7.6 is available for MikroTik.

Hostname:       MikroTik
Board name:     CHR
Architecture:   x86_64
RouterOS:
    Channel:    stable
    Installed:  7.5
    Available:  7.6
RouterOS-Scripts:
    Version:    85

🔗 https://mikrotik.com/download/changelogs/stable-release-tree
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
863cf9cae0 doc/check-lte-firmware-upgrade: update notification
---- ✂️ ----
 LTE firmware upgrade

A new firmware version R11e-LTE6_V033 is available for LTE interface lte on MikroTik.

Interface: MikroTik R11e-LTE6
Installed: R11e-LTE6_V027
Available: R11e-LTE6_V033
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
692ed21262 doc/check-health: update notifications
---- ✂️ ----
📉 Health warning: voltage

The voltage on MikroTik jumped more than 10%.

old value: 16.2V
new value: 12.4V
---- ✂️ ----
🔥 Health warning: temperature

The temperature on MikroTik is above threshold: 51°C
---- ✂️ ----
 Health recovery: temperature

The temperature on MikroTik dropped below threshold: 47°C
---- ✂️ ----
 Health warning: psu1-state

The power supply unit 'psu1-state' on MikroTik failed!
---- ✂️ ----
 Health recovery: psu1-state

The power supply unit 'psu1-state' on MikroTik recovered!
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
fadf4d5008 doc/check-certificates: update notification
---- ✂️ ----
🔏 Certificate renewed

A certificate on MikroTik has been renewed.

Name:        example.com
CommonName:  example.com
Private key: available
Fingerprint: cc54cdd01fcd7698ecb71213874be776906eb33d26cd57754d168632f14c4c8b
Issuer:      R3
Validity:    sep/08/2022 03:50:56 to dec/07/2022 03:50:55
Expires in:  8w 3d 12:03:30
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
98844d85d5 doc/backup-upload: update notification
---- ✂️ ----
💾⬆️ Backup & Config upload

Backup and config export upload for MikroTik.

Hostname:       MikroTik
Board name:     CHR
Architecture:   x86_64
RouterOS:
    Channel:    stable
    Installed:  7.6
RouterOS-Scripts:
    Version:    85

Backup file:    MikroTik_example_com.backup
Config file:    MikroTik_example_com.rsc
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
3733e0a919 doc/backup-cloud: update notification
---- ✂️ ----
💾☁️ Cloud backup

Uploaded backup for MikroTik to cloud.

Hostname:       MikroTik
Board name:     CHR
Architecture:   x86_64
RouterOS:
    Channel:    stable
    Installed:  7.6
RouterOS-Scripts:
    Version:    85

Name:           cloud-20221020-092419
Size:           370767 B (362 KiB)
Download key:   LLDBfPcWXxmSetWilqeJX5V
---- ✂️ ----
2022-10-20 11:28:09 +02:00
Christian Hesse
8c89fb0a4e README: update notification
---- ✂️ ----
📌 News and configuration changes

The configuration version on MikroTik increased to 85, current configuration may need modification. Please review and update global-config-overlay, then re-run global-config.

Changes:
 ● Support for e-mail notifications moved to a module. It is installed automatically if required.
 ● Dropped 'netwatch-syslog', filtering in firewall is advised.
---- ✂️ ----
2022-10-20 10:01:04 +02:00
Christian Hesse
4106b199bf mod/notification-telegram: drop 'Telegram' from wording 2022-10-19 22:46:23 +02:00
Christian Hesse
fe87e9551d firmware-upgrade-reboot: update wording, give version 2022-10-19 11:57:52 +02:00
Christian Hesse
bff6689b10 ipsec-to-dns: strip "CN=" from peer's id 2022-10-19 08:54:11 +02:00
Christian Hesse
621154ab83 ipsec-to-dns: remove debug output
Oops... 😳

This sneaked in with initial commit 862417b8d3
("add 'ipsec-to-dns'").
2022-10-19 08:45:40 +02:00
Christian Hesse
2f8e8b7448 update-gre-address: strip "CN=" from peer's id
The prefix "CN=" is now added in RouterOS 7.6... Let's match with and
without the prefix in comment.
2022-10-18 22:43:42 +02:00
Christian Hesse
640cb81119 netwatch-notify: fix the count...
This broke in commit 6f772e92a6
("netwatch-notify: rename array element") where not only the array
element but also the option was renamed.
2022-10-14 22:39:21 +02:00
Christian Hesse
493d534706 update-tunnelbroker: drop extra detection, use response from update
Why hammer on another service? The tunnelbroker response contains the
address we need. So send the update every time, and use that
information.
2022-10-09 23:56:53 +02:00
Christian Hesse
e7995fa06b update-tunnelbroker: get public address from website
This is a good condidate:

https://showipv6.de/

We can drop the cloud code, which seems to be unreliable in somd
situations.
2022-10-09 23:56:53 +02:00
Christian Hesse
c95cbdbc1e doc/update-tunnelbroker: give more hints on expected config 2022-10-09 00:00:50 +02:00
Christian Hesse
16e93018ef update-tunnelbroker: work around timing issue
Looks like fetch command has a timing issue with the tunnelbroker
endpoint... We have to try several times to work around this.
Consider the update failed on third error.
2022-10-08 23:06:22 +02:00
Christian Hesse
ebaa9b617d update-tunnelbroker: add error handling for fetch command 2022-10-08 22:38:31 +02:00
Christian Hesse
dd22dfd26d backup-email: check if dependency for sending e-mail is installed 2022-09-29 10:31:54 +02:00
Christian Hesse
10182949ea global-functions: $ScriptInstallUpdate: disable notification only...
... if requested, but keep output and logs.
2022-09-28 09:17:32 +02:00
Christian Hesse
b18ca62dbd global-functions: $ScriptInstallUpdate: drop dead code... 2022-09-28 09:17:12 +02:00
Christian Hesse
5120aa096f global-functions: $ScriptInstallUpdate: drop code for permission workaround
This is no longer used as 'netwatch-syslog' is gone.
2022-09-25 22:18:44 +02:00
Christian Hesse
10bf3c758f drop 'learn-mac-based-vlan' and 'manage-umts'
This was undocumented and scripts did never catch up with general
quality expectations, for example global-config and global functions
were not used.
If you need the code get it from git history. 😜
2022-09-25 22:18:44 +02:00
Christian Hesse
bfe2cbf575 drop 'netwatch-syslog'
To filter in firewall you should use something like this:

/ip/firewall/filter/add action=reject chain=output out-interface-list=WAN port=514 protocol=udp reject-with=icmp-admin-prohibited;
/ip/firewall/filter/add action=reject chain=forward out-interface-list=WAN port=514 protocol=udp reject-with=icmp-admin-prohibited;
2022-09-25 22:18:44 +02:00
Christian Hesse
eccc187014 introduce 'mod/notification-email', split off from global-functions 2022-09-25 22:10:05 +02:00
Christian Hesse
562c565fcf global-functions: $FlushEmailQueue: do not flush if sending 2022-09-25 18:44:14 +02:00
Christian Hesse
a05b8c1881 Makefile: add a clean target 2022-09-25 18:44:14 +02:00
Christian Hesse
fb9aca90f0 unattended-lte-firmware-upgrade: increase delay before extra reset 2022-09-21 16:36:54 +02:00
Christian Hesse
493e4fc8c1 netwatch-notify: use a counter for resolve failures
This should relax the error message a bit as it is not triggered
on first failure.
2022-09-20 22:49:04 +02:00
Christian Hesse
84b5e77860 global-functions: $GetMacVendor: detect locally administered addresses
https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local_(U/L_bit)
2022-09-20 09:30:33 +02:00
Christian Hesse
c33e813f20 mod/notification-matrix: $FlushMatrixQueue: use $0 for scheduler name 2022-09-15 22:25:59 +02:00
Christian Hesse
47e4f292cb mod/notification-telegram: $FlushTelegramQueue: use $0 for scheduler name 2022-09-15 22:25:59 +02:00
Christian Hesse
3f92edb5c1 global-functions: $FlushEmailQueue: use $0 for scheduler name 2022-09-15 22:25:59 +02:00
Christian Hesse
f245751339 global-functions: $FlushEmailQueue: do not flush with resolver issues
Flushing the mail queue with resolver issues can flood the log with
messages like:

e-mail;error Error sending e-mail <=?utf-8?Q?[MikroTik] =F0=9F=92=BE=E2=98=81 Cloud backup?=>: DNS resolve failed

Try to avoid this...
2022-09-15 22:03:19 +02:00
Christian Hesse
220dd8f892 netwatch-dns: support downloading / importing certificate 2022-09-13 20:28:52 +02:00
Christian Hesse
3988c70290 doc/netwatch-dns: fix example command...
This broke with:

 * doc/netwatch-dns: giving hostname in comment is not required
   9853943a36
2022-09-13 15:18:28 +02:00
Christian Hesse
e927c6b08b global-functions: $GetMacVendor: switched to Let's Encrypt (R3)
So let's check for the correct one, and drop the other.
2022-09-13 15:18:28 +02:00
Christian Hesse
a1af9577ca global-functions: $ScriptInstallUpdate: prepare for future certificate chain 2022-09-09 14:02:02 +02:00
Christian Hesse
e228c73984 Merge branch 'netwatch-notify' into next 2022-09-08 09:27:17 +02:00
Christian Hesse
5aff4019fe netwatch-notify: do not (yet) notify if parent is up recently
Monitoring a VPN (or similar) may be tricky: This used to send notifications
if the physical connection recovered, but the VPN and/or its routing did not
yet. Let's work around and send notification only if the parent is up
for at least three checks.
2022-09-07 22:20:52 +02:00
Christian Hesse
a6645b3e75 netwatch-notify: add new array element to count up-checks 2022-09-07 22:02:46 +02:00
Christian Hesse
6f772e92a6 netwatch-notify: rename array element 2022-09-07 21:54:57 +02:00
Christian Hesse
95274e0d23 netwatch-notify: rename variable 2022-09-07 21:54:14 +02:00
Christian Hesse
8f32887a1a global-functions: introduce $GetRandom20CharAlNum 2022-09-07 12:28:45 +02:00
Christian Hesse
ff0b05ea20 global-functions: $GetRandom20CharHex: add optional parameter for length 2022-09-07 12:22:45 +02:00
Christian Hesse
a7f8aa95d0 netwatch-notify: show dns name (resolve option) in message 2022-09-07 11:21:15 +02:00
Christian Hesse
e820323e78 global-config: add earth symbol in hello-world message for mode button 2022-08-25 12:57:40 +02:00
Christian Hesse
8f7a0c2a06 global-functions: $SymbolByUnicodeName: add 'earth' 2022-08-25 12:51:07 +02:00
Christian Hesse
a7ec92e358 optimize all svg files...
... and also update all version numbers to match current release.
2022-08-22 17:16:17 +02:00
Christian Hesse
50a115f23a cleanup dummy script from rotate-ntp removal 2022-08-19 08:35:52 +02:00
Christian Hesse
c126a5a86b check-health: increase default temperature deviation
Some devices (with bad temperature sensort?) still product a flood of
notifications... Try to avoid that.
2022-08-15 21:31:13 +02:00
Christian Hesse
83372d8b07 logo: optimize the svg file 2022-08-15 17:22:27 +02:00
Christian Hesse
c9a7421d6c update list of contributors 2022-08-05 22:58:55 +02:00
Michael Gisbers
28be6d097d global-functions: $GetRandomNumber: use :rndnum
This is available in RouterOS 7.x...

Signed-off-by: Christian Hesse <mail@eworm.de>
2022-08-05 22:58:55 +02:00
Michael Gisbers
0562198c55 global-functions: $GetRandom20CharHex: use :rndstr
This is available in RouterOS 7.x...

Signed-off-by: Christian Hesse <mail@eworm.de>
2022-08-05 22:58:55 +02:00
Christian Hesse
e31a99a301 unattended-lte-firmware-upgrade: try without extra reset
Testing with R11e-LTE6 I can see the interface being reset by the
upgrade. So the extra reset is no longer required? Trying without.
2022-08-05 22:58:54 +02:00
Christian Hesse
50d7e1fa41 check-lte-firmware-upgrade: use $0 for $ScriptFromTerminal 2022-08-04 00:16:35 +02:00
Christian Hesse
50178e2a3c capsman-download-packages: use proper array syntax 2022-07-21 14:04:44 +02:00
Christian Hesse
82f27268b3 global-functions: $IsTimeSync: cache a positive result
The functions do not rely on perfectly synced time. About the right time
is fine, that should make sure certificates are valid and mails are sent
with reasonable headers. So cache the result if system is fine for later
use.
2022-07-21 14:04:44 +02:00
Christian Hesse
329e606b93 global-functions: $IsTimeSync: drop the extra condition...
... as ddns is not required to be enabled. The public address is
available anyway, but not set in DNS.
2022-07-21 14:04:44 +02:00
Christian Hesse
ed7b48061a global-functions: $IsTimeSync: drop old code
In RouterOS 7.x the ntp client and server are bundled and unique and
can not be unavailable.
Also it does no longer have a 'last-adjustment' property...
2022-07-21 14:03:11 +02:00
Christian Hesse
518cc24108 global-functions: $IsFullyConnected: remove trailing space 2022-07-21 13:21:51 +02:00
Christian Hesse
ce03f44769 check-routeros-update: use a better check for valid version
Currently the latest version in long-term branch is 0.0... And the
script is sending downgrade notifications. 😝
Obviously that is not a valid version... With this changen a version
has to be 7.0 and above to be considered valid.
2022-07-18 23:46:49 +02:00
Christian Hesse
b67b9ec1c1 Merge branch 'empty-array' into next 2022-07-13 11:57:47 +02:00
Christian Hesse
6fa1525700 sms-forward: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:35:46 +02:00
Christian Hesse
d6337fcc97 netwatch-notify: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:35:32 +02:00
Christian Hesse
8a85a258fc netwatch-dns: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:35:18 +02:00
Christian Hesse
f34c353b5f mod/notification-telegram: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:35:03 +02:00
Christian Hesse
7f85e69713 mod/notification-matrix: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:34:51 +02:00
Christian Hesse
34ea276469 mod/bridge-port-vlan: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:34:37 +02:00
Christian Hesse
8436a18919 mod/bridge-port-to: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:34:25 +02:00
Christian Hesse
164ebe8c8a log-forward: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:33:58 +02:00
Christian Hesse
49147c83ca lease-script: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:33:38 +02:00
Christian Hesse
9a89cd5407 global-functions: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:32:44 +02:00
Christian Hesse
99a8148d17 daily-psk: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:32:23 +02:00
Christian Hesse
2d30f4e462 check-lte-firmware-upgrade: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:32:11 +02:00
Christian Hesse
eae9a7b956 check-health: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:31:44 +02:00
Christian Hesse
3006e96598 backup-email: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:31:29 +02:00
Christian Hesse
073f432204 accesslist-duplicates: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:30:06 +02:00
Christian Hesse
5b2ea9b1a4 ... and another one 2022-07-11 17:18:18 +02:00
Christian Hesse
deacda8630 give a heart for contributions ❤️ 2022-07-11 17:16:25 +02:00
Christian Hesse
f9442ceaa2 update list of contributors 2022-07-11 16:22:18 +02:00
Christian Hesse
876f8a0f82 netwatch-dns: properly check for disabled state
The property 'disabled' can be undefined, which evaluates to
enabled - but is not matched by 'disabled=no'.
2022-07-11 10:41:51 +02:00
Christian Hesse
cb20b8c380 daily-psk: properly check for disabled state
The property 'disabled' can be undefined, which evaluates to
enabled - but is not matched by 'disabled=no'.
2022-07-11 10:41:51 +02:00
Christian Hesse
0ed68824fd check-routeros-update: drop check for package...
... as wireless package is bundled with the system with RouterOS 7.x.
2022-07-11 10:41:37 +02:00
Christian Hesse
61598c81e9 update list of contributors 2022-07-08 08:30:25 +02:00
Christian Hesse
bbe8c02b5b README: show a sample news and changes notification 2022-07-07 14:21:41 +02:00
Christian Hesse
a1606402d1 global-config: new setting to disable news and change notifications...
... and also drop the version from global-config and
global-config-overlay.
2022-07-06 21:46:52 +02:00
Christian Hesse
68ae4fca0d global-config-overlay: update wording 2022-07-06 12:26:58 +02:00
Christian Hesse
99feceda38 Merge branch 'netwatch' into next 2022-07-06 11:42:47 +02:00
Christian Hesse
447e1d99f9 netwatch-dns: break long lines 2022-07-06 11:37:02 +02:00
Christian Hesse
3a7bb1e239 netwatch-notify: break long lines 2022-07-06 11:37:02 +02:00
Christian Hesse
8e6eff30db netwatch-notify: also support the name from property 2022-07-06 11:37:02 +02:00
Christian Hesse
5767fceb39 netwatch-notify: quote the host/service name 2022-07-06 11:37:02 +02:00
Christian Hesse
e8f5f9217c netwatch-notify: properly handle services (http-get & tcp-conn) 2022-07-06 11:37:02 +02:00
Christian Hesse
f50d155500 netwatch-notify: $NetwatchNotifyHook: rename variable: $Type -> $State 2022-07-06 11:37:02 +02:00
Christian Hesse
a7c9444545 netwatch-notify: rename variable: $HostName -> $Name 2022-07-06 11:37:02 +02:00
Christian Hesse
19103cd345 netwatch-notify: rename parameter: hostname -> name
Starting with RouterOS 7.4 the netwatch tool has been extended, it can
now do tcp and http probes. Rename the parameter for reasonable naming
with services.
2022-07-06 11:37:02 +02:00
Christian Hesse
5a02c32d7d netwatch-notify: properly check for disabled state
Looks like checking for 'disabled=no' fails with net netwatch
in RouterOS 7.4...
2022-07-06 11:37:02 +02:00
Christian Hesse
0a45e25562 doc/netwatch-dns: use default address for quad-nine 2022-07-05 13:29:39 +02:00
Christian Hesse
9853943a36 doc/netwatch-dns: giving hostname in comment is not required 2022-07-05 13:16:47 +02:00
Christian Hesse
597277dbe7 mod/ipcalc: use $PrettyPrint 2022-07-05 12:43:57 +02:00
Christian Hesse
150feac400 mod/inspectvar: use $PrettyPrint 2022-07-05 12:43:57 +02:00
Christian Hesse
eda75f0bbc global-functions: introduce function $PrettyPrint
... to add trailing carriage return when printing to terminal:

[admin@MikroTik] > $PrettyPrint [ $DeviceInfo ]
Hostname:       MikroTik
Board name:     hAP ac^2
Architecture:   arm
Model:          RouterBOARD D52G-5HacD2HnD-TC
Serial number:  8A2A09A221A1
RouterOS:
    Channel:    testing
    Installed:  7.4rc1
RouterOS-Scripts:
    Current:    81
2022-07-05 12:43:57 +02:00
Christian Hesse
b0992da03d mod/ipcalc: remove empty line 2022-07-05 12:28:50 +02:00
Christian Hesse
3434ea9d79 mod/bridge-port-to: re-enable interfaces by id 2022-06-30 08:59:27 +02:00
Christian Hesse
e27a0166ba mod/bridge-port-vlan: re-enable interfaces by id 2022-06-30 08:59:08 +02:00
Christian Hesse
f26fb7c05f mod/bridge-port-to: do not act on missing interface
Happens on broken configuration or early boot...
2022-06-29 12:53:50 +02:00
Christian Hesse
ba34ee5cda mod/bridge-port-vlan: do not act on missing interface
Happens on broken configuration or early boot...
2022-06-29 12:53:02 +02:00
Christian Hesse
6fdf115dcf README: How to remove a script... 2022-06-28 21:55:30 +02:00
Christian Hesse
fcd6e61849 global-functions: $ScriptInstallUpdate: remove script on failure when installing 2022-06-28 21:40:00 +02:00
Christian Hesse
8b6f830fe8 mod/notification-telegram: only flush queue if fully connected
The fetch command is not as reliable as it should be... Chances were that
notifications were sent multiple times if stuck in background.
Let's flush only if fully connected - and hope this fixes it.
2022-06-20 11:29:49 +02:00
Christian Hesse
cf59e7c1a2 mod/notification-matrix: only flush queue if fully connected
The fetch command is not as reliable as it should be... Chances were that
notifications were sent multiple times if stuck in background.
Let's flush only if fully connected - and hope this fixes it.
2022-06-20 11:29:49 +02:00
Christian Hesse
d8d7ace5e5 global-functions: introduce function $IsFullyConnected 2022-06-20 11:29:49 +02:00
Christian Hesse
b1ad89b1b5 global-functions: rename internal function: $TimeIsSync -> $IsTimeSync 2022-06-20 11:29:49 +02:00
Christian Hesse
9aa82316c8 global-functions: rename internal function: $DNSIsResolving -> $IsDNSResolving 2022-06-20 11:29:49 +02:00
Christian Hesse
0ee38a4303 global-functions: rename internal function: $DefaultRouteIsReachable -> $IsDefaultRouteReachable 2022-06-20 11:29:49 +02:00
Christian Hesse
f628ef73fd global-functions: $WaitTimeSync: drop declaration of unused function 2022-06-17 00:04:24 +02:00
Christian Hesse
3002990319 fix typos: 'at lease' -> 'at least' 2022-06-16 23:56:36 +02:00
Christian Hesse
b3de1fad34 drop script 'rotate-ntp'
For RouterOS 6.x a separate package 'ntp' exists. This adds server
functionality, but allows ip addresses for the client only. I added the
script 'rotate-ntp' to update addresses from names...

Now with RouterOS 7.x there's no extra package and the limitation does
no longer exist. So let's just drop the script.

This adds migration code, that...
 * removes the script from configuration
 * removes a scheduler from configuration
 * sets the configured ntp pool name for ntp client
2022-06-15 16:39:49 +02:00
Christian Hesse
66b7fccd30 mod/bridge-port-to: log when re-enabling interfaces 2022-06-15 16:39:49 +02:00
Christian Hesse
1e894289ea mod/bridge-port-vlan: log when re-enabling interfaces 2022-06-15 16:39:49 +02:00
Christian Hesse
5dc23dd267 mod/bridge-port-to: move reenable to correct level 2022-06-15 10:01:48 +02:00
Christian Hesse
5b3b3e182b mod/bridge-port-vlan: move reenable to correct level 2022-06-15 10:01:48 +02:00
Christian Hesse
e9f00df290 global-config-overlay: fix $GlobalConfigVersion...
Looks like I missed this in commit 5e481a768b.
😳
2022-06-14 21:26:09 +02:00
Christian Hesse
dafeeabdb4 rotate-ntp: update message to indicate resolve failed again 2022-06-10 11:22:46 +02:00
Christian Hesse
c7087ac4fe rotate-ntp: do not flood the log on weak connection 2022-06-10 11:22:46 +02:00
Christian Hesse
782bbb2c90 doc/mod/bridge-port-to: fix scheduler name 2022-06-10 11:22:46 +02:00
Christian Hesse
e9780d9b4e log-forward: fix the pattern excluding mail errors
This looked smart, but did not work... 🤪
Unicode characters have to be in place to make $QuotedPrintable have an
effect. So fix it... We have duplicate pattern if symbols are disabled,
but that does not hurt.
2022-06-08 21:05:08 +02:00
Christian Hesse
aa7e9adbd7 doc/mod/notification-telegram: how to use the function 2022-06-05 22:50:57 +02:00
Christian Hesse
648ce9c3bd doc/mod/notification-matrix: how to use the function 2022-06-05 22:50:23 +02:00
Christian Hesse
f0f05be8a9 log-forward: inform about rate limit in notification 2022-06-02 11:14:36 +02:00
Christian Hesse
09d88ad91c mod/bridge-port-vlan: show vlan name in log message 2022-06-02 11:14:36 +02:00
Christian Hesse
9942918580 mod/bridge-port-vlan: re-enable interfaces with longer delay...
... and in one go to limit the overall runtime.

Looks like IPv6 addresses are not flushed if the link down does not last
long enough (~ 2 seconds on linux). This results on stale addresses
after switching the vlan, which breaks connectivity.
2022-06-02 11:14:36 +02:00
Christian Hesse
3d8ca10a91 mod/bridge-port-to: re-enable interfaces with longer delay...
... and in one go to limit the overall runtime.

Looks like IPv6 addresses are not flushed if the link down does not last
long enough (~ 2 seconds on linux). This results on stale addresses
after switching bridge, which breaks connectivity.
2022-06-02 11:14:36 +02:00
Christian Hesse
61c9b29ec3 log-forward: use warning-sign for severity warning and up 2022-06-02 11:14:36 +02:00
Christian Hesse
89f4c91ccf log-forward: change symbol for notification 2022-05-20 08:33:22 +02:00
Christian Hesse
3139b14c67 global-functions: $FlushEmailQueue: return if time is not synced
The local system time is used in the mail header. We do not want the
mails to be sent in the past, so return early (and thus wait for time
being synced).
2022-05-17 21:11:03 +02:00
Christian Hesse
8c31a06b39 mod/bridge-port-to: add interface down and up
This helps the client to detect the change.
2022-05-16 22:48:26 +02:00
Christian Hesse
4e7c1df7ee mod/bridge-port-vlan: add interface down and up
This helps the client to detect the change.
2022-05-16 22:27:01 +02:00
Christian Hesse
194f14cc13 mod/bridge-port-vlan: remove left over comment 2022-05-16 22:26:23 +02:00
Christian Hesse
0e73f85c11 log-forward: do *not* wait to be fully connected
Let's forward logs as early as possible.

All notification functions are expected to handle notifications with
queues, so nothing is lost. Just the opposite: Logs being rotated before
forwarding becomes less likely.
2022-05-16 12:42:38 +02:00
Christian Hesse
5e481a768b notify about freeze of routeros-v7 branch 2022-05-12 11:05:10 +02:00
Christian Hesse
df547b87a4 Merge branch 'ros-v7-path-syntax' into next 2022-05-12 11:04:43 +02:00
Christian Hesse
12655bd58a Merge branch 'doc' into ros-v7-path-syntax 2022-05-12 11:04:12 +02:00
Christian Hesse
09d926ed2f doc/update-tunnelbroker: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
f759a9a52e doc/update-gre-address: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
347cb4f3b6 doc/unattended-lte-firmware-upgrade: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
c2637ee72c doc/super-mario-theme: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
4ca43dcde3 doc/ssh-keys-import: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
06509f6af4 doc/sms-forward: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
25d11f798d doc/sms-action: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
45232019f4 doc/rotate-ntp: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
d9d2d67a4e doc/ppp-on-up: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
eb014b26b2 doc/packages-update: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
47b6f8941a doc/ospf-to-leds: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
6f76a41962 doc/netwatch-syslog: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
7561c719d1 doc/netwatch-notify: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
9ef2718c6d doc/netwatch-dns: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
2ed561d13b doc/mode-button: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
95a75b3fa1 doc/mod/scriptrunonce: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
76127ed53c doc/mod/notification-matrix: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
344ae8a55d doc/mod/ipcalc.d/ipcalc: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
f00ff997a4 doc/mod/inspectvar: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
21416c42ef doc/mod/bridge-port-vlan: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
e88a547f60 doc/mod/bridge-port-to: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
c5044e10ce doc/log-forward: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
36ec2e1595 doc/leds-mode: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
e25f13fe17 doc/lease-script: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
77ef9c0919 doc/ip-addr-bridge: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
ad6dc85320 doc/ipv6-update: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
ea619c8efc doc/ipsec-to-dns: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
d68958dd77 doc/hotspot-to-wpa: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
060d12d273 doc/gps-track: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
3e1802a1a0 doc/global-wait: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
474c4f7a62 doc/firmware-upgrade-reboot: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
7aea231940 doc/dhcp-to-dns: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
d9201aa29a doc/dhcp-lease-comment: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
2f52057e84 doc/daily-psk: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
847892c09f doc/collect-wireless-mac: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
15035cd70d doc/check-routeros-update: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
578ef72c89 doc/check-lte-firmware-upgrade: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
6086064129 doc/check-health: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
c52f69b98d doc/check-certificates: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
c483136689 doc/certificate-renew-issued: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
b3ec0f7fb9 doc/capsman-rolling-upgrade: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
fe88af2d5f doc/capsman-download-packages: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
fedf74300d doc/backup-upload: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
d4df7467b3 doc/backup-partition: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
81b0ed6675 doc/backup-email: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
71680aa1b8 doc/backup-cloud: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
6c2a7faedd doc/accesslist-duplicates: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
44c7d56858 INITIAL-COMMANDS: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
b6ddc5968e README: RouterOS v7 path syntax 2022-05-12 11:04:00 +02:00
Christian Hesse
48f0a2d211 Merge branch 'scripts' into ros-v7-path-syntax 2022-05-12 11:03:06 +02:00
Christian Hesse
a71a3d5466 update-tunnelbroker: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
67bd3a32a8 update-gre-address: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
2cd0fb88fa unattended-lte-firmware-upgrade: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
c35eec0f22 ssh-keys-import: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
fbc6852687 sms-forward: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
735df85b45 rotate-ntp: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
b90585f690 ppp-on-up: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
ba0bb3d2d4 packages-update: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
008046d569 ospf-to-leds: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
c18821deb5 netwatch-syslog: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
b368ee9902 netwatch-notify: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0696c6ca88 netwatch-dns: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0e466c3b81 mode-button: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
2f46495be1 mod/scriptrunonce: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
20b5ca4918 mod/notification-telegram: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
50a139248f mod/notification-matrix: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
9bd9f4b4ba mod/bridge-port-vlan: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
158aea4756 mod/bridge-port-to: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
8c53487370 manage-umts: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
1c56809cd4 log-forward: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
efc3e997ef leds-{day,night,toggle}-mode: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
7d5418718c lease-script: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
2ab87f5143 learn-mac-based-vlan: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0fec08c0cd ip-addr-bridge: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
3befc38d21 ipv6-update: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
7979fb0108 ipsec-to-dns: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
c1d406fd4a hotspot-to-wpa-cleanup: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
b8f753d8b8 hotspot-to-wpa: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
270e608d56 gps-track: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
294aff9c02 firmware-upgrade-reboot: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
f5f41a8aa7 dhcp-to-dns: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
a01b9b9347 dhcp-lease-comment: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
71053fec40 daily-psk: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
8af4db9f53 collect-wireless-mac: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
4837b4747e check-routeros-update: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
602933baec check-lte-firmware-upgrade: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
af8a24b959 check-health: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
3ed153520e check-certificates: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0f3166d427 certificate-renew-issued: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
f17342ed6e capsman-rolling-upgrade: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
ac4eb87be6 capsman-download-packages: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
219fd994d7 backup-upload: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
21c4520d17 backup-partition: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
dffd634885 backup-email: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
18a0bee80f backup-cloud: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
ab410466dc accesslist-duplicates: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
d98d69a8c9 Makefile: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
0ccebc39c7 global-functions: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
b996f00dd5 global-config.changes: RouterOS v7 path syntax 2022-05-10 16:03:19 +02:00
Christian Hesse
1cac1c1b05 global-config: RouterOS v7 path syntax 2022-05-10 16:03:19 +02:00
Christian Hesse
93ec9afe55 cleanup dummy scripts from backup scripts renames 2022-05-06 14:31:32 +02:00
Christian Hesse
6784f82593 doc/check-routeros-update: link changelog and forum 2022-05-06 08:26:00 +02:00
Christian Hesse
c4008b91cd doc/check-routeros-update: give warning about possible breakage 2022-05-06 08:20:53 +02:00
Christian Hesse
a4ebc18af7 doc/check-routeros-update: mention neighbor discovery 2022-05-06 08:20:34 +02:00
Christian Hesse
ecde864263 README: installing custom scripts & modules 2022-05-05 10:42:03 +02:00
Christian Hesse
7189a3bbe5 global-wait: do not claim to be a backup script...
Probalby a copy and paste issue?
2022-05-04 21:11:26 +02:00
Christian Hesse
e9575ead7a update list of contributors 2022-05-02 12:05:11 +02:00
PackElend
56c5da8ed4 doc/lease-script: reflect actual action of the script 2022-05-02 11:50:44 +02:00
Christian Hesse
f417bcbcd4 global-functions: $LogPrintExit2: handle empty name 2022-04-28 11:04:34 +02:00
Christian Hesse
e74bec7e5b global-functions: catch runtime error when loading modules 2022-04-28 10:19:07 +02:00
Christian Hesse
7c8e230521 global-functions: validate syntax of modules 2022-04-28 10:19:07 +02:00
Christian Hesse
9bc2123ee5 global-functions: set $0 with script name
Now that we have some active code at the bottom...
2022-04-28 10:18:51 +02:00
Christian Hesse
a36aa441ed global-functions: $DefaultRouteIsReachable: update properties for ROS 7.x 2022-04-26 16:41:15 +02:00
Christian Hesse
a058c9e1ed global-functions: $ScriptInstallUpdate: support giving comment...
... for new scripts. This allows to have extra settings from the
beginning, for example:

$ScriptInstallUpdate script1,script2 "base-url=https://example.com/your/custom/repository/"
2022-04-26 16:41:15 +02:00
Christian Hesse
3f8d3acd60 hotspot-to-wpa: create template if missing 2022-04-26 14:26:17 +02:00
Christian Hesse
c132d28408 hotspot-to-wpa: move code for marker up 2022-04-26 14:19:50 +02:00
Christian Hesse
57fab95290 capsman-download-packages: break long lines 2022-04-07 09:23:42 +02:00
Christian Hesse
9dbc56457b capsman-download-packages: try to warn about missing logs 2022-04-07 09:23:42 +02:00
Christian Hesse
0786111c5c hotspot-to-wpa: allow login page to load
Depending on configuration the VLAN is changed on the SSID currently
serving the hotspot. So give the login page (with success status) a
moment to load before kicking the device.
2022-03-31 10:43:21 +02:00
Christian Hesse
71b69fc189 introduce backup-partition 2022-03-30 18:24:14 +02:00
Christian Hesse
2aa93a0671 check-lte-firmware-upgrade: rework code and its logic 2022-03-30 17:24:16 +02:00
Christian Hesse
d952e7e6c7 check-lte-firmware-upgrade: support starting unattended firmware upgrade...
... from terminal if script is installed.
2022-03-28 12:39:46 +02:00
Christian Hesse
5aecc9f1a3 check-lte-firmware-upgrade: be more verbose 2022-03-28 12:39:46 +02:00
Christian Hesse
7bd40b34f1 check-lte-firmware-upgrade: fix command for ROS 7.x 2022-03-28 11:42:16 +02:00
Christian Hesse
c4a5f8787a capsman-download-packages: get info from log
Relying on older packages in local storage may be problematic due to
size constraints. Let's check the log for required packages.
2022-03-25 11:23:00 +01:00
Christian Hesse
122f90b693 firmware-upgrade-reboot: ignore firmware downgrade 2022-03-08 22:47:26 +01:00
Christian Hesse
cbb2f067e6 accesslist-duplicates: use global $Read 2022-03-08 22:30:01 +01:00
Christian Hesse
07cc38e973 global-functions: (re-)introduce global $Read
... to interactively read input from user on terminal.
2022-03-08 22:28:48 +01:00
Christian Hesse
c1fa0f3579 hotspot-to-wpa: support ignoring specific hotspot 2022-03-07 22:27:29 +01:00
Christian Hesse
df0d826999 hotspot-to-wpa: initialize variables earlier 2022-03-07 22:27:29 +01:00
Christian Hesse
c9b6cee83f global-functions: $FlushEmailQueue: delay if "in-progress"...
Something else is sending a mail... Let's wait and hope the status is
not confused.
2022-03-01 12:47:23 +01:00
Michael Gisbers
c35485454c doc/mod/notification-matrix: add verbose steps for setup
Modified-by: Christian Hesse <mail@eworm.de>
2022-03-01 12:38:54 +01:00
Christian Hesse
a00e912bb5 global-functions: $DeviceInfo: firmware only if upgrade pending 2022-02-24 12:04:19 +01:00
Christian Hesse
8c0bd18bbb doc/check-routeros-update: update versions in screenshot 2022-02-24 11:50:06 +01:00
Christian Hesse
2c47bdabf0 doc/backup-upload: update versions in screenshot 2022-02-24 11:49:47 +01:00
Christian Hesse
544647fc34 doc/backup-cloud: update versions in screenshot 2022-02-24 11:49:15 +01:00
Christian Hesse
c72702cc51 doc/backup-cloud: break long line 2022-02-23 23:31:29 +01:00
Christian Hesse
a754932211 doc/backup-upload: warn about possible issue 2022-02-23 12:43:29 +01:00
Christian Hesse
a78b2bfcde doc/backup-cloud: warn about possible issue 2022-02-23 12:43:29 +01:00
Christian Hesse
ef6f9efb10 doc/backup-upload: mention used option show-sensitive 2022-02-23 10:19:45 +01:00
Christian Hesse
6e7f6ff8b4 doc/backup-email: mention used option show-sensitive 2022-02-23 10:19:04 +01:00
Christian Hesse
0ab99fcdbb INITIAL-COMMANDS: give another delay before fetch 2022-02-23 09:24:10 +01:00
Christian Hesse
c872c18d76 doc/log-forward: remove extra character
Looks like copy'n'paste error...
2022-02-22 22:41:59 +01:00
Christian Hesse
d50f6ffb79 doc/mod/scriptrunonce: document optional configuration 2022-02-22 22:31:49 +01:00
Christian Hesse
8e401bf498 update list of contributors 2022-02-22 22:15:08 +01:00
Christian Hesse
343ee27820 Merge branch 'doc/mod' into next 2022-02-21 12:54:01 +01:00
Christian Hesse
d74aac8f6a doc/mod: notify about new documentation 2022-02-21 12:53:26 +01:00
Christian Hesse
26e471122f add doc/mod/scriptrunonce 2022-02-21 12:53:26 +01:00
Christian Hesse
e9953c3612 add doc/mod/ipcalc 2022-02-20 23:40:22 +01:00
Christian Hesse
002315035c add doc/mod/inspectvar 2022-02-20 23:40:22 +01:00
Christian Hesse
07fc5c898a add doc/mod/notification-matrix 2022-02-20 23:40:22 +01:00
Christian Hesse
e6a686187c add doc/mod/notification-telegram 2022-02-20 23:40:22 +01:00
Christian Hesse
886cd67edb Makefile: match all *.md files, incl. doc/mod/ 2022-02-20 23:38:21 +01:00
Christian Hesse
6f27553f15 doc/check-routeros-update: mention e-mail, matrix and telegram 2022-02-20 23:38:21 +01:00
Christian Hesse
fd36241be6 doc/mod: put hints into block quote, update info icon, fix links 2022-02-12 13:51:31 +01:00
Christian Hesse
cd2a7dcf8c doc: use another info icon: 🛈 -> ℹ️ 2022-02-12 13:09:37 +01:00
Christian Hesse
f0b0951968 doc/early-errors: no site structure, hint only 2022-02-11 23:55:06 +01:00
Christian Hesse
9e91ed56aa doc: put hints into block quote 2022-02-11 23:38:28 +01:00
Christian Hesse
4b16dc06c4 INITIAL-COMMANDS: put hint into block quote 2022-02-11 23:38:28 +01:00
Christian Hesse
a5e421faeb README: put hint into block quote 2022-02-11 23:35:20 +01:00
Christian Hesse
3f8e835233 firmware-upgrade-reboot: add a delay before reboot
Looks like my timing was too good... Upgrade and reboot happened too
fast, so device reported:

system;error;critical router was rebooted without proper shutdown

Let's try something smart... Delay the reboot by the amount of uptime,
and hope all devices - slow and powerful - are happy.
2022-02-11 00:19:41 +01:00
Christian Hesse
674398b342 global-functions: $DownloadPackage: handle special cases
This is a RouterOS v7 only change!

* Revert commit 1e6931c8e3 (but keep the
  cherry-picked one in branch routeros-v6).

* Drop special case 'routeros-$arch', which no longer exists.

* Update package name 'system' to 'routeros'. This should be the correct
  name, and is expected by CAPsMAN. No idea why package-name property
  for the file is different...
2022-02-10 12:30:06 +01:00
Christian Hesse
4d26dd07c3 capsman-download-packages: wireless package does no longer exist
This is a RouterOS v7 only change!
2022-02-10 12:29:31 +01:00
Christian Hesse
7b48b25c27 global-functions: $MkDir: do not act without directory 2022-02-10 11:05:21 +01:00
Christian Hesse
a50d9d30e3 update list of contributors
Thanks a lot and please enjoy firmware-upgrade-reboot! 😊
2022-02-10 09:07:38 +01:00
Christian Hesse
3c358980cb introduce firmware-upgrade-reboot 2022-02-10 09:07:32 +01:00
Christian Hesse
a47f5723cc netwatch-dns: flush cache on configuration change 2022-02-10 08:41:12 +01:00
Christian Hesse
0b46c508dc netwatch-notify: nest conditions
The logic here was right, but RouterOS runs the checks simultaneously.
This caused delays even if no resolving was needed.

Nesting the checks fixes this.
2022-02-10 08:41:12 +01:00
Christian Hesse
c6e581d4f9 netwatch-notify: allow to suppress notification on host down 2022-02-10 08:41:12 +01:00
Christian Hesse
42c203291a doc/netwatch-notify: add sections 2022-02-08 17:40:55 +01:00
Christian Hesse
dd19aea362 doc/packages-update: link backup-cloud 2022-02-08 17:35:53 +01:00
Christian Hesse
27a81bcbca packages-update: use correct syntax 2022-01-30 22:06:37 +01:00
Christian Hesse
dfe995be27 check-routeros-update: use correct syntax 2022-01-30 22:05:58 +01:00
Christian Hesse
5e32105e7e global-functions: $ScriptInstallUpdate: quote names in log output 2022-01-20 22:13:56 +01:00
Christian Hesse
b4a5d824a2 global-functions: $ScriptInstallUpdate: give final url in debug output 2022-01-20 22:13:56 +01:00
Christian Hesse
1e6931c8e3 global-functions: $DownloadPackage: handle special case with name
For RouterOS 6.x bundled package version and architecture are swapped.

Closes: #21
2022-01-17 20:50:52 +01:00
Christian Hesse
51cd11c803 global-functions: $DownloadPackage: give url in debug output 2022-01-17 20:15:24 +01:00
Christian Hesse
db4afe28f0 Merge branch 'routeros-v7' into next 2022-01-14 16:54:30 +01:00
Christian Hesse
5135a41332 global: notify about merging 'routeros-v7' into 'main' 2022-01-14 09:31:07 +01:00
Christian Hesse
25704812b2 doc/capsman-download-packages: only bundle is available now 2022-01-14 09:20:09 +01:00
Christian Hesse
93770d40a8 check-health: adopt new data structure for ROS 7.x
The PSU state has an empty string for type... Thus matching on name.
2022-01-14 09:20:09 +01:00
Christian Hesse
0ecabfecf7 rotate-ntp: syntax for ROS 7.x
The property name changed in RouterOS v7...
2022-01-14 09:20:09 +01:00
Christian Hesse
7e5652e0c5 ospf-to-leds: get state from count of neighbors
The state property is gone in RouterOS v7...
2022-01-14 09:20:09 +01:00
Christian Hesse
768afd84c6 backup-upload: export with show-sensitive
This is available (and required) with RouterOS 7.1rc1.
2022-01-14 09:20:09 +01:00
Christian Hesse
35d10f80f5 backup-email: export with show-sensitive
This is available (and required) with RouterOS 7.1rc1.
2022-01-14 09:20:09 +01:00
Christian Hesse
cdd607037e README: drop hint on branch 'routeros-v7' 2022-01-14 09:20:09 +01:00
Christian Hesse
d03b6d9374 global-functions: bump the required version for RouterOS 7.x
... but keep a warning when running RouterOS v6.
2022-01-14 09:20:09 +01:00
Christian Hesse
1089b7e7f9 README: install correct global-config-overlay for RouterOS v6 2022-01-14 08:03:53 +01:00
Christian Hesse
31653a84ca INITIAL-COMMANDS: silence the certificate download 2022-01-14 07:49:04 +01:00
Christian Hesse
491f53a8ce hotspot-to-wpa: support settings from template 2022-01-07 15:28:08 +01:00
Christian Hesse
97f35dcf0e Merge branch 'backup' into next 2022-01-06 10:23:03 +01:00
Christian Hesse
ed0135c613 Migrate configuration and send notification on renames 2022-01-06 08:19:58 +01:00
Christian Hesse
e77b39e933 rename script upload-backup -> backup-upload 2022-01-06 08:19:58 +01:00
Christian Hesse
95b17ab9a1 rename script email-backup -> backup-email 2022-01-06 08:19:58 +01:00
Christian Hesse
8c39f41ffc rename script cloud-backup -> backup-cloud 2022-01-06 08:19:58 +01:00
Christian Hesse
57c80dc2a4 introduce netwatch-dns 2022-01-03 10:00:16 +01:00
Christian Hesse
cd3fde59d7 netwatch-notify: give netwatch some time to settle 2022-01-03 10:00:16 +01:00
Christian Hesse
491ecdb812 netwatch-notify: initialize after lock 2022-01-03 10:00:16 +01:00
Christian Hesse
7f0a8cdfcd netwatch-notify: better match notify-entries 2022-01-03 10:00:16 +01:00
Christian Hesse
45ffb7e552 add AVIF logo 2022-01-03 10:00:16 +01:00
Christian Hesse
772b675001 doc/accesslist-duplicates: convert screenshot to AVIF 2022-01-03 10:00:16 +01:00
Christian Hesse
8f79c4de79 README: convert screenshots to AVIF 2022-01-03 10:00:16 +01:00
Christian Hesse
6eddaf9b87 README: convert Telegram group qr code to AVIF 2022-01-03 10:00:16 +01:00
Christian Hesse
95e9820718 update copyright for 2022 2022-01-01 21:38:15 +01:00
Christian Hesse
2e183da47f README: add Telegram icon in qr code 2021-12-30 23:50:21 +01:00
Christian Hesse
9348bd5039 README: add a qr code to join Telegram group 2021-12-30 23:50:21 +01:00
Christian Hesse
500d0679ed global-functions: $RequiredRouterOS: fix warning
Passing a boolean does not work... Handle as string.
2021-12-20 15:31:34 +01:00
Christian Hesse
ee57ddf595 log-forward: fix forwarding first message
Pulling the power cable results in log message on next boot:

dec/16 18:28:28 system,error,critical router rebooted without proper shutdown, probably power outage

This was not forwarded as it had the numeric id 0, which is not greater
than the zero we initialized with. Now initialized with -1 when no log
has been forwarded to fix this.
2021-12-17 11:48:25 +01:00
Christian Hesse
b936970c19 INITIAL-COMMANDS: adopt changes, no need to run global-config-overlay 2021-12-16 22:26:29 +01:00
Christian Hesse
9a0321d40d doc/ssh-keys-import: number keys, do not overwrite on same comment 2021-12-16 22:26:29 +01:00
Christian Hesse
4a5c55ca2b doc/ssh-keys-import: handle RSA keys only
Sadly RouterOS does not (yet) support ed25519 keys...
2021-12-16 22:26:25 +01:00
Christian Hesse
28ff5e2aab update list of contributors 2021-12-16 11:34:11 +01:00
Christian Hesse
bf078867a7 update list of contributors 2021-12-15 20:24:41 +01:00
Christian Hesse
229a7d18c9 global-functions: $DownloadPackage: make directory first
The fetch command creates the directory itself, however using $MkDir
gives better error message when creating directory fails.
2021-12-14 00:10:30 +01:00
Christian Hesse
5846b85e28 global-functions: $MkDir: log error 2021-12-14 00:07:22 +01:00
Christian Hesse
e111832462 global-functions: $NotificationFunctions->"email": do not declare unused function 2021-12-14 00:06:10 +01:00
Christian Hesse
0fab371d1a global-functions: $DeviceInfo: show license level if available
This now shows license level for CHR.

The property is named different for Routerboards. As these have the
license bundled to hardware anyway we do not show it there.
2021-12-13 22:25:55 +01:00
Christian Hesse
40dea01670 README: changes for RouterOS v6 2021-12-13 11:36:03 +01:00
Christian Hesse
6dede0c49b global-functions: $ScriptLock: simplify cleanup code 2021-12-10 07:34:09 +01:00
Christian Hesse
a46fd48187 global-functions: $ScriptLock: remove ticket in a loop
This was not required with RouterOS v6, but for any reason removing a
ticket may fail with RouterOS v7 in very rare cases. So remove in a
loop...
2021-12-09 22:48:30 +01:00
Christian Hesse
b423e6ed0f global-functions: $ScriptLock: cleanup in dedicated function 2021-12-09 22:48:30 +01:00
Christian Hesse
327740d255 mod/ipcalc: introduce $IPCalcReturn 2021-12-09 20:55:15 +01:00
Christian Hesse
004621a327 mod/inspectvar: truncate value if too long 2021-12-09 20:50:51 +01:00
Christian Hesse
b872615e89 mod/inspectvar: introduce $InspectVarReturn 2021-12-09 16:25:49 +01:00
Christian Hesse
cdcab4599a global-functions: $ScriptLock: initialize earlier 2021-12-09 12:52:03 +01:00
Christian Hesse
9c87b5a222 global-functions: $ScriptLock: initialize empty array on cleanup 2021-12-09 12:52:03 +01:00
Christian Hesse
7b770b2fb8 upload-backup: drop warning on RouterOS v7...
... now that we have it in global-functions.
2021-12-07 23:03:30 +01:00
Christian Hesse
899085e831 email-backup: drop warning on RouterOS v7...
... now that we have it in global-functions.
2021-12-07 23:02:50 +01:00
Christian Hesse
a98965d727 global-functions: give a hint on RouterOS v7 2021-12-07 23:01:01 +01:00
Christian Hesse
1f5cc39b3c global-config: load overlay automatically 2021-12-07 21:58:03 +01:00
Christian Hesse
8f8130775f check-routeros-update: lock against multiple invocation 2021-12-07 15:40:14 +01:00
Christian Hesse
dab04fd63e README: changes for RouterOS v7 2021-12-07 11:11:19 +01:00
Christian Hesse
95062a3dbc doc/netwatch-notify: add missing empty line 2021-12-02 22:59:13 +01:00
Christian Hesse
5b786e10c8 global-functions: $DeviceInfo: add current firmware
(I would like to show a note if the upgrade is pending... But did not
find a way to get that information. Is there?)
2021-11-22 09:57:57 +01:00
Christian Hesse
15d8652c29 accesslist-duplicates: read more than a single digit
With RouterOS 6.x a print always starts with numeric id zero, then
counts up. This is no longer true with RouterOS 7.x...
Thus we have to handle two or more digits in input.
2021-11-19 20:18:39 +01:00
Christian Hesse
868879ec8d README: no capitals here... 2021-11-18 10:27:44 +01:00
Christian Hesse
2625cc09a5 check-health: support hard lower limit for voltage
... to detect slow decrease of voltage, for example with UPS.
2021-11-16 22:21:37 +01:00
Christian Hesse
d87c50cf68 check-health: indicate voltage increase or decrease 2021-11-16 22:21:37 +01:00
Christian Hesse
185fe2c730 reintroduce global-wait 2021-11-16 22:21:37 +01:00
Christian Hesse
3b997d3087 global-functions: drop deprecated function $LogPrintExit
... which has been replaced by $LogPrintExit2 some time ago.
2021-11-16 22:21:22 +01:00
Christian Hesse
8fc88c73f8 shorten modules directory name (global-functions.d -> mod) 2021-11-15 22:18:10 +01:00
Christian Hesse
f484e45b6a bridge-port-to-default -> global-functions.d/bridge-port-to 2021-11-15 22:18:10 +01:00
Christian Hesse
b6215ba958 add global-functions.d/bridge-port-vlan 2021-11-12 16:09:35 +01:00
Christian Hesse
a9f81c7a14 doc: move notification images to script-specific directories 2021-11-11 22:50:30 +01:00
Christian Hesse
8a941fcd8d hotspot-to-wpa: drop support for tx limits
... if you need to limit bandwidth use queues instead.
2021-11-03 15:21:01 +01:00
Christian Hesse
99a95d310e global-functions: $NotificationFunctions->"email": check for valid settings
No need to queue mails if 'address' and 'from' are not specified...
2021-10-01 20:39:59 +02:00
Christian Hesse
f780b205a9 global-functions: $DeviceInfo: do not fail on non-RouterBoard with ROS 7.x 2021-10-01 09:00:36 +02:00
Christian Hesse
4ebe2628b0 global-functions.d/notification-telegram: fix calculation on cut off 2021-09-28 16:26:26 +02:00
Christian Hesse
72d50aa13f doc/accesslist-duplicates: use real screenshot 2021-09-22 10:33:21 +02:00
Christian Hesse
0d09121d68 README: add a note about date and time 2021-09-21 21:53:51 +02:00
Christian Hesse
4bdfcf1643 README: use real screenshots...
... and make sure copy-and-paste with code does not fail.

Also end all commands with a semicolon for Github copy button.
2021-09-21 21:42:26 +02:00
Christian Hesse
7952a6afac hotspot-to-wpa-cleanup: match dhcp server name
... as we do not want the hotspot's lease to become static.
2021-09-21 21:26:13 +02:00
Christian Hesse
9295d06fe2 global-functions.d/inspectvar: add $InspectVar...
to inspect variables. This is useful for variables with (nested) arrays,
for example inspecting $NetwatchNotify (from netwatch-notify):

[admin@Mikrotik] > $InspectVar $NetwatchNotify
-type-> array
  -key-> quad-one
    -type-> array
      -key-> count
        -type-> num
        -value-> 0
      -key-> notified
        -type-> bool
        -value-> false
      -key-> parent
        -type-> nothing
      -key-> resolve-failed
        -type-> nothing
      -key-> since
        -type-> nothing
  -key-> example.com
    -type-> array
      -key-> count
        -type-> num
        -value-> 0
      -key-> notified
        -type-> bool
        -value-> false
      -key-> parent
        -type-> str
        -value-> quad-one
      -key-> resolve-failed
        -type-> nothing
      -key-> since
        -type-> nothing
2021-09-21 21:26:13 +02:00
Christian Hesse
ce78d7d9e9 global-functions: notify about move of $IPCalc and $ScriptRunOnce to modules
Just install with...

$ScriptInstallUpdate global-functions.d/ipcalc

... and/or...

$ScriptInstallUpdate global-functions.d/scriptrunonce

... and use the functions as before.
2021-09-21 21:26:13 +02:00
Christian Hesse
012db05a93 global-functions: move $ScriptRunOnce to optional module 2021-09-21 21:26:13 +02:00
Christian Hesse
8b05d25487 global-functions: move $IPCalc to optional module 2021-09-21 21:26:13 +02:00
Christian Hesse
5391045bd5 upload-backup: warn on missing sensitive information with ROS 7.x 2021-09-21 21:26:13 +02:00
Christian Hesse
1bacfaf12b email-backup: warn on missing sensitive information with ROS 7.x 2021-09-21 21:26:13 +02:00
Christian Hesse
15e60da7f0 certs: drop old chain GTS CA 1O1 / GlobalSign 2021-09-21 21:26:09 +02:00
Christian Hesse
44d2f04e0e certs: add new chain GTS CA 1C3 / GTS Root R1
This is used by Google DNS (8.8.8.8).

$CertificateAvailable "GTS CA 1C3"
/ip dns set use-doh-server=https://8.8.8.8/dns-query verify-doh-cert=yes
2021-09-20 20:56:55 +02:00
Christian Hesse
ec7c88a780 certs: drop old intermediate cert DigiCert ECC Secure Server CA 2021-09-20 20:54:11 +02:00
Christian Hesse
a3798ff656 certs: add new intermediate cert DigiCert TLS Hybrid ECC SHA384 2020 CA1
This is used by Cloudflare DNS (1.1.1.1) and Quard9 (9.9.9.9).

$CertificateAvailable "DigiCert TLS Hybrid ECC SHA384 2020 CA1"
/ip dns set use-doh-server=https://1.1.1.1/dns-query verify-doh-cert=yes

$CertificateAvailable "DigiCert TLS Hybrid ECC SHA384 2020 CA1"
/ip dns set use-doh-server=https://9.9.9.9/dns-query verify-doh-cert=yes
2021-09-20 20:52:03 +02:00
Christian Hesse
70f9c7926b global-functions*: syntax for ROS 7.x
Strings with escape sequence have to be enclosed in parentheses. Looks
like RouterOS 7.x is stricter here...
2021-09-08 14:33:02 +02:00
Christian Hesse
150c228197 global-functions: $CertificateAvailable: drop version check 2021-09-02 08:55:34 +02:00
Christian Hesse
832e899cda global-functions: $RequiredRouterOS: allow to use without warning 2021-09-01 14:05:55 +02:00
Christian Hesse
ae8e22941e global-functions: $ScriptLock: handle array by index
This should mitigate race conditions while rewriting the array.
2021-08-31 21:40:42 +02:00
Christian Hesse
d356d6f57c global-functions: $ScriptLock: do not store but calculate job count
This should mitigate some more race conditions.
2021-08-31 21:40:42 +02:00
Christian Hesse
6b04fff3eb lease-script: move debug output up 2021-08-30 16:03:29 +02:00
Christian Hesse
73dfb0c8ee check-health: use $ScriptLock 2021-08-27 11:21:56 +02:00
Christian Hesse
7afce17f70 netwatch-notify: use $ScriptLock 2021-08-27 11:20:57 +02:00
Christian Hesse
d556e97a46 dhcp-to-dns: check for existence of address
Chances are that $LeaseVal is an array with just an id - no idea why this
happens. So do not check for array but existence of address.
2021-08-26 11:12:39 +02:00
Christian Hesse
772e66b622 global-functions.d/notification-telegram: for syntax for ROS 7.x
Strings with escape sequence have to be enclosed in parentheses. Looks
like RouterOS 7.x is stricter here...
2021-08-25 00:35:08 +02:00
Christian Hesse
d4896f2585 update list of contributors 2021-08-16 12:39:53 +02:00
Christian Hesse
4269bc9548 global-functions: $ScriptLock: check for successful removal of ticket
The script is already locked, so there is no second script to remove a
ticket at the same time. However a new script can add a new ticket and
overwrite the removal... Thus check for successful removal anyway.
2021-07-25 23:19:54 +02:00
Christian Hesse
8e2c783068 lease-script: drop differentiation of assign / deassign...
... not that we have early locking.
2021-07-15 12:47:05 +02:00
Christian Hesse
9509371690 lease-script: use $ScriptLock
There were still ways to produce errors from lease scripts...
Let's lock earlier, this should fix it.
2021-07-15 11:45:35 +02:00
Christian Hesse
698c795eee update list of contributors 2021-07-15 11:25:46 +02:00
Ben Harris
9fba3dd8df global-functions: $ScriptLock: fix off-by-one check...
... for stale job tickets

Signed-off-by: Christian Hesse <mail@eworm.de>
2021-07-15 10:17:25 +02:00
Christian Hesse
29ececda9b collect-wireless-mac: check for existence of mac address
Chance are that $RegVal is an array with just an id - no idea why this
happens. So do not check for array but existence of mac address.
2021-07-11 22:30:00 +02:00
Christian Hesse
483506b189 global-functions: introduce $ScriptRunOnce 2021-07-10 23:18:04 +02:00
Christian Hesse
d1ef710093 global-functions: $ScriptInstallUpdate: add error handling for changelog 2021-07-09 22:04:15 +02:00
Christian Hesse
574c50908b global-functions.d/notification-telegram: subject in bold & underline
This makes the subject visually delimited.
2021-07-09 21:21:30 +02:00
Christian Hesse
dc7fc0d385 finally remove old scripts 2021-07-09 12:46:03 +02:00
Christian Hesse
b864db1e38 global-functions: $ScriptInstallUpdate: add error handling for migration 2021-07-09 12:46:03 +02:00
Christian Hesse
f694e1e54d global-functions: $ScriptInstallUpdate: drop unused variable
This was a left-over from re-run message.
2021-07-09 12:46:03 +02:00
Christian Hesse
81cba72bec global-functions: $ScriptInstallUpdate: drop the migration pattern 2021-07-09 12:46:03 +02:00
Christian Hesse
d80a7efb7c doc/netwatch-notify: hint on escaping, with example 2021-07-09 12:46:03 +02:00
Christian Hesse
bccb7c3452 netwatch-notify: implement pre-down hook 2021-07-09 12:46:03 +02:00
Christian Hesse
12d34e4a7c collect-wireless-mac: remove 'unknown' from message and comment
This was true, but the mac address is no longer unknown after it was
added to address list in comment.
2021-07-09 10:40:13 +02:00
Christian Hesse
4192d30d7e global-functions: $ScriptLock: drop variable, just return 2021-07-09 10:40:13 +02:00
Christian Hesse
a4e548eb80 global-functions: $ScriptLock: make ticket management more reliable 2021-07-08 21:03:31 +02:00
Christian Hesse
6c9f733d96 lease-script: add the order in log 2021-07-08 21:03:31 +02:00
Christian Hesse
6bf8cd5fac lease-script: implement script order
The order may be important: `collect-wireless-mac` can add a dns name
in notification, thus `dhcp-to-dns` should run first.
2021-07-08 21:03:31 +02:00
Christian Hesse
623fd707c4 lease-script: modify the tag 2021-07-08 16:09:03 +02:00
Christian Hesse
c5d49b37f3 netwatch-notify: run hook from a function 2021-07-08 13:38:21 +02:00
Christian Hesse
87ce4a86b7 netwatch-notify: add error handling for hooks
We already had syntax validation, but a script with valid synctax can
still fail to run...
2021-07-08 13:02:57 +02:00
Christian Hesse
1eb337d87f doc/lease-script: hint on script installation/execution order 2021-07-07 00:33:36 +02:00
Christian Hesse
d7170bf138 doc/lease-script: fix link 2021-07-07 00:33:36 +02:00
Christian Hesse
e5674dec24 collect-wireless-mac: use $EitherOr and simplify code 2021-07-07 00:33:34 +02:00
Christian Hesse
c982cde0bd collect-wireless-mac: do not fail on missing dns record 2021-07-07 00:32:50 +02:00
Christian Hesse
5083ffd12f collect-wireless-mac: rework, more use of arrays 2021-07-06 21:41:33 +02:00
Christian Hesse
92a97b12ca ospf-to-leds: do not flood but log properly 2021-07-06 21:41:33 +02:00
Christian Hesse
fcc0d1551a doc/netwatch-notify: hint on checking specific isp 2021-07-05 15:00:47 +02:00
Michael Gisbers
d5edcbd3b6 check-routeros-update: allow update for cap
If CAPsMAN is running on a device with just 16MB flash downloading the
packages is not possible (or at least lost at reboot). So allow a CAP to
update with opt-in.
2021-07-01 22:56:18 +02:00
Christian Hesse
877e95d4be collect-wireless-mac: properly handle vanished device 2021-07-01 22:52:38 +02:00
Christian Hesse
5f357fd242 dhcp-to-dns: fix static lease that lost bound status 2021-07-01 22:52:38 +02:00
Christian Hesse
23daea2354 dhcp-to-dns: properly handle vanished lease 2021-07-01 22:52:38 +02:00
Christian Hesse
9c9fb46e4a lease-script: do not run too many instances of scripts
Every instance of the scripts does all the work. If one script is running
and a second script is waiting we do not have to start a third one.
2021-07-01 22:52:38 +02:00
Christian Hesse
5f2bc87b22 lease-script: drop the delay magic...
... as this should be handled by $ScriptLock in lease scripts now.
2021-07-01 22:52:38 +02:00
Christian Hesse
08b1b72fa9 hotspot-to-wpa-cleanup: lock script (and wait) 2021-07-01 22:52:38 +02:00
Christian Hesse
64b53d2322 dhcp-to-dns: lock script (and wait) 2021-07-01 22:52:38 +02:00
Christian Hesse
df43f61018 collect-wireless-mac: wait when locking script 2021-07-01 22:52:38 +02:00
Christian Hesse
3f893a327d Merge branch 'ScriptLock' into next 2021-07-01 22:52:23 +02:00
Christian Hesse
aad91d90ea global-functions: $ScriptLock: use hex string for ticket
Does not matter what the ticket looks like, but using hex string it is
not converted to number.
2021-07-01 22:37:03 +02:00
Christian Hesse
0b4c1861cf global-functions: $ScriptLock: use a limit on lock...
... to make sure it does not lock forever.
2021-07-01 22:37:03 +02:00
Christian Hesse
7de3457f44 global-functions: $ScriptLock: allow to wait for lock 2021-06-30 21:28:27 +02:00
Christian Hesse
5d30886e59 global-functions: $ScriptLock: rework with tickets
Getting the order right is not easy... We use a global variable to store
"tickets" in an array. Based on that scripts know their order.
2021-06-30 21:28:27 +02:00
Christian Hesse
b2d0ed1240 global-functions: $ScriptLock: check if script is running 2021-06-30 21:18:38 +02:00
Christian Hesse
e13e3cfe34 global-functions: $ScriptLock: check if script exists 2021-06-30 21:16:17 +02:00
Christian Hesse
301ad4b3e5 global-functions: $ScriptLock: allow to return...
... with true instead of breaking with error.
2021-06-30 11:13:50 +02:00
Christian Hesse
89f8dc7120 global-functions: $LogPrintExit2: allow origin-specific debug
Add something like this in global-config-overlay:

:global PrintDebugOverride {
  "dhcp-to-dns"=true;
}
2021-06-30 11:12:12 +02:00
Christian Hesse
679917390b global-functions: $GetRandomNumber: use $HexToNum 2021-06-28 21:33:13 +02:00
Christian Hesse
cfc400b3d5 global-functions: $GetRandom20CharHex: do not remove otp...
... as it is instantly invalid anyway.
2021-06-28 21:33:13 +02:00
Christian Hesse
7f2314d999 doc/notifications: change stroke color
This makes the stroke visible on black background.
2021-06-25 10:06:24 +02:00
Christian Hesse
407a379f1d lease-script: do not run in parallel on simultaneous deassign 2021-06-24 22:28:08 +02:00
Christian Hesse
855399b2bc global-functions: $RandomDelay: allow to specify unit in second argument 2021-06-24 22:28:08 +02:00
Christian Hesse
39b7bddf49 ppp-on-up: use $LogPrintExit2
This will never print to terminal, nevertheless we want proper
log with script name in prefix.
2021-06-23 15:15:19 +02:00
Christian Hesse
f26b3da342 lease-script: use $LogPrintExit2
This will never print to terminal, nevertheless we want proper
log with script name in prefix.
2021-06-23 15:15:19 +02:00
Christian Hesse
cd0398acf9 ipv6-update: use $LogPrintExit2
This will never print to terminal, nevertheless we want proper
log with script name in prefix.
2021-06-23 15:15:19 +02:00
Christian Hesse
1a404195d5 hotspot-to-wpa: add optional cleanup script 2021-06-23 15:15:16 +02:00
Christian Hesse
f5b1f9cb97 celebrating the 1.000th commit - hooray! 2021-06-23 15:14:38 +02:00
Christian Hesse
64496d76c2 notify about tag in scripts 2021-06-23 10:26:49 +02:00
Christian Hesse
037d287e5b ppp-on-up: add error handling 2021-06-23 10:26:49 +02:00
Christian Hesse
aad2e062e5 ppp-on-up: use 'provides' to find ppp-on-up scripts 2021-06-23 10:21:34 +02:00
Christian Hesse
96a92bb30c lease-script: add error handling 2021-06-23 08:38:44 +02:00
Christian Hesse
2041390f55 lease-script: use 'provides' to find lease scripts 2021-06-23 08:38:44 +02:00
Christian Hesse
420986fdfc packages-update: use 'provides' to find backup scripts 2021-06-23 08:38:44 +02:00
Christian Hesse
06a0f42039 update list of contributors 2021-06-23 08:38:17 +02:00
Christian Hesse
7fb4fdfca2 global-functions: $MkDir: abuse smb share to create directory
The smb feature is provided by system package... So we have it anyway.
It gives some benefits compared to abusing fetch:

* It is faster!
* No need to alter, enable and restore a service! (The share is created disabled.)
* Firewall rules can not break this.
* No temporary file is created.
* Less code!

Let's hope we do not introduce new breakage.

Closes #14
2021-06-21 22:58:17 +02:00
Christian Hesse
c0b954abbb doc/netwatch-notify: hint on checking internet connectivity 2021-06-21 09:15:05 +02:00
Christian Hesse
bad6f5a7cc doc: add sample notifications 2021-06-21 08:54:04 +02:00
Christian Hesse
a3efb67ed1 doc/check-health: no capital character here 2021-06-18 11:23:58 +02:00
Christian Hesse
a1fc02e667 Makefile: generate html files for documentation 2021-06-18 11:23:58 +02:00
Christian Hesse
e375494d00 email-backup: remove attachment when sent 2021-06-17 15:06:35 +02:00
Christian Hesse
34c9da5aa2 global-functions: $NotificationFunctions->"email": support removing attachment 2021-06-17 15:06:35 +02:00
Christian Hesse
1e1b98b161 upload-backup: remove file after upload 2021-06-16 14:59:16 +02:00
Christian Hesse
c60c96e32a global-functions: $HexToNum: properly handle capital characters 2021-06-16 10:16:35 +02:00
Christian Hesse
1ce0f63ef7 log-forward: use $HexToNum, do not resend old messages
Now we know the order of messages and can compare. Changing the filter
does no longer result in old messages being resent.
2021-06-15 16:59:02 +02:00
Christian Hesse
babcc00dcd global-functions: introduce $HexToNum 2021-06-15 14:38:02 +02:00
Christian Hesse
4cc8a0e160 global-functions: $SendEMail2: fix name in array
This did not send anything at all...

Fixes #12
2021-06-10 07:52:43 +02:00
Christian Hesse
de61c14c60 log-forward: implement reverse logic to include messages...
... even if a filter matches to exclude them. Let's have an example:

:global LogForwardFilter "(debug|info)";
:global LogForwardInclude "account";

This will forward everything about topic *account* (login, logout,
failed login, ...) - even with topic *info*.
2021-06-09 14:42:43 +02:00
Christian Hesse
d5f43aa26d log-forward: update comments in global-config 2021-06-09 14:42:43 +02:00
Christian Hesse
401f179ae9 doc/log-forward: mention Matrix 2021-06-09 14:41:09 +02:00
Christian Hesse
50d1706a06 global-functions: make Telegram notifications a module 2021-06-08 21:07:25 +02:00
Michael Gisbers
8375673d93 global-functions: implement notifications via Matrix
Matrix is an open network for secure, decentralized communication - and
it has a web api.

A warning on message type: Using 'm.notice' breaks rendering on Element
for Android (no fixed width font) and does not pop up desktop
notification. Thus we use 'm.text'. Should be safe as we do not send the
messages in response to other messages.

https://matrix.org/
2021-06-08 21:07:25 +02:00
Christian Hesse
7a43bfbc6a global-functions: make notification functions extensible
This allows to add notification functions without overloading functions.
Just add it into the array:

:set ($NotificationFunctions->"fancy-messager") do={
  # notification magic here...
}

Adding functions $SendFancyMessager and/or $SendFancyMessager2 may be
useful. Optionally a function to flush a queue may be required.

A BIG FAT WARNING about function parameters:
Calling a function from array results in $0 for the function name being
skipped. That's why we have to add the function name manually!
2021-06-08 21:07:24 +02:00
Christian Hesse
b866eca3ec global-functions: $ScriptInstallUpdate: drop the re-run message
This makes sense just rarely... For important changes we have the
migration mechanism. So just drop this.
2021-06-08 21:07:24 +02:00
Christian Hesse
f9a2afdeda global-functions: $ScriptInstallUpdate: reload configuration later 2021-06-08 21:07:24 +02:00
Christian Hesse
2315d6bc59 global-functions: $ScriptInstallUpdate: reload functions just once 2021-06-08 21:07:24 +02:00
Christian Hesse
57b0f1b2dd global-functions: support loading modules
If script's name starts with "global-functions.d/" it is handled
as module:

 * loaded at startup
 * triggers reload on update
2021-06-08 21:07:24 +02:00
Christian Hesse
a1c8716a95 INITIAL-COMMANDS: make github copy function work
The Github copy function skips all line breaks, so add some extra
semicolons to fix syntax.
2021-06-08 20:58:25 +02:00
Christian Hesse
7de5b58ad4 update list of contributors 2021-06-06 21:41:42 +02:00
Christian Hesse
80ee7d3bdd Makefile: remove extra whitespace 2021-05-26 08:51:51 +02:00
Christian Hesse
e74b2e03a2 ipv6-update: apply a mask on prefix
Fixes #11
2021-05-24 21:32:56 +02:00
Christian Hesse
330bc7fc8b check-certificates: fix variable name 2021-05-21 08:31:45 +02:00
Christian Hesse
45dd33c90a global-functions: $DownloadPackage: quote package name 2021-05-19 14:03:18 +02:00
Christian Hesse
05a7ae409b netwatch-notify: add info on hook in notification 2021-05-18 16:44:07 +02:00
Christian Hesse
5037dbbedc Merge branch 'lets-encrypt-ISRG-X1' into next 2021-05-18 16:33:52 +02:00
Christian Hesse
4427cabd0e update Let's Encrypt trust chain
Drop 'DST Root CA X3', use 'ISRG Root X1' instead. The migration code
makes sure that...

 * the intermediate certificate 'R3' is signed by 'ISRG Root X1'
 * 'ISRG Root X1' is self-signed, not cross-signed by 'DST Root CA X3'
 * 'DST Root CA X3' is finally gone
2021-05-18 16:33:35 +02:00
Christian Hesse
f2433b8091 drop certificate DST Root CA X3
Let's Encrypt planned the transition to ISRG's root certificate ("ISRG Root
X1") on July 8, 2019, but postponed several times.

Finally they found another solution: A certificate 'ISRG Root X1', but
cross-signed with 'DST Root CA X3' and with a livetime that exceeds that
of the root CA. This is said to work for most operating system where root
certificate authorities are just 'trust anchors'.

I doubt this is true for RouterOS, where certificates are just imported
into the certificate store. So let's migrate to 'ISRG Root X1' now.
2021-05-18 16:32:26 +02:00
Christian Hesse
862417b8d3 add 'ipsec-to-dns' 2021-05-17 16:41:51 +02:00
Christian Hesse
604306f220 dhcp-to-dns: use $0 in strings 2021-05-17 16:19:57 +02:00
Christian Hesse
2ba389a2be dhcp-to-dns: put string into variable 2021-05-17 16:18:07 +02:00
Christian Hesse
ed1a6c5de9 README: use svg logo 2021-05-07 09:18:39 +02:00
Christian Hesse
cd330a8518 logo: clean png export 2021-05-07 09:18:39 +02:00
Christian Hesse
2c77db52bf logo: convert text to path 2021-05-07 09:16:52 +02:00
Christian Hesse
8ac4f6570a logo: scale to 96x96 pixels 2021-05-07 09:16:52 +02:00
Christian Hesse
254126430e Merge branch 'netwatch-notify' into next 2021-05-06 15:42:54 +02:00
Christian Hesse
96621e01cb netwatch-notify: log failed resolve just once 2021-05-06 15:34:04 +02:00
Christian Hesse
0b1bb0f2b2 netwatch-notify: attempt to update address with working resolver only 2021-05-06 15:33:52 +02:00
Christian Hesse
cfb31e844c netwatch-notify: support dynamic address update 2021-05-06 15:11:05 +02:00
Christian Hesse
9d19313eee netwatch-notify: log on host up...
... if logged on host down before.
2021-05-06 15:11:05 +02:00
Christian Hesse
41f7d1e466 doc/netwatch-notify: tips & tricks: one of several hosts 2021-05-05 08:31:14 +02:00
Christian Hesse
64ff7fcf65 doc: inform about dependency on base installation
That should make the documentation clearer if external sites link to the
documentation of a specific script.
2021-05-03 15:07:50 +02:00
Christian Hesse
e0e53b8add update list of contributors 2021-05-03 10:35:30 +02:00
Christian Hesse
666cd3f184 upload-backup: add second symbol 2021-04-29 22:37:36 +02:00
Christian Hesse
9e81707491 email-backup: add second symbol 2021-04-29 22:37:36 +02:00
Christian Hesse
aa4ad27b0a cloud-backup: add second symbol 2021-04-29 22:37:36 +02:00
Christian Hesse
34ab2837a8 email-backup: add symbol in e-mail
That's easy now that we use $SendEMail2...
2021-04-29 22:37:36 +02:00
Christian Hesse
d2560db5c9 email-backup: use $SendEMail2
This drops $EmailBackupTo & $EmailBackupCc from settings! Use settings
overwrite if required:

:global EmailGeneralToOverride {
  "email-backup"="backup@example.com";
}
2021-04-29 22:37:36 +02:00
Christian Hesse
529cefffaf global-functions: $SendEMail2: support file attachments 2021-04-29 22:37:36 +02:00
Christian Hesse
c2b45a9093 email-backup: work inside directory 2021-04-29 21:29:32 +02:00
Christian Hesse
51007f9224 upload-backup: work inside directory 2021-04-29 21:29:32 +02:00
Christian Hesse
ff4e5339d0 capsman-rolling-upgrade: properly handle vanished cap 2021-04-29 15:34:09 +02:00
Christian Hesse
afc231596c packages-update: update wording 2021-04-29 14:55:51 +02:00
Christian Hesse
6f7ecaeec4 packages-update: add missing colon 2021-04-29 14:55:51 +02:00
Christian Hesse
7ed54a4fe7 global-functions: $DownloadPackage: be more verbose 2021-04-29 14:55:51 +02:00
Christian Hesse
0f445fd528 global-functions: $DownloadPackage: fix typo 2021-04-29 14:40:29 +02:00
Christian Hesse
5d973a095a global-functions: $FlushEmailQueue: try to avoid running simultaneously
We can not check the status for a *specific* mail, so running simultaneously
is a problem. Let's increase the interval to the number of queue items -
and hope it helps. Decrease when done.
2021-04-29 09:12:17 +02:00
Christian Hesse
da87761220 Merge branch 'notifications' into next 2021-04-28 20:16:08 +02:00
Christian Hesse
56b7523775 global-functions: notify about settings override 2021-04-28 15:33:37 +02:00
Christian Hesse
b497edd092 global-config: comment on overriding e-mail and Telegram settings 2021-04-28 15:11:08 +02:00
Christian Hesse
9fc75f5932 upload-backup: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
0d249d6da4 sms-forward: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
e6223a3661 netwatch-notify: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
87cbc1edad log-forward: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
fe9754c693 daily-psk: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
714a679402 collect-wireless-mac: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
a9b932d67e cloud-backup: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
8e1c524b85 check-routeros-update: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
fbe4c457c6 check-lte-firmware-upgrade: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
baed8b5cfd check-health: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
ebd3dbedcb check-certificates: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
c640823881 global-functions: $ScriptInstallUpdate: pass origin to $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
2d0ce17629 global-functions: $SendTelegram2: support overriding token id and chat id 2021-04-28 13:58:37 +02:00
Christian Hesse
bd05ca1133 global-functions: $SendTelegram2: store token id in queue 2021-04-28 13:58:37 +02:00
Christian Hesse
42dcdae11e global-functions: $SendEMail2: support overriding to and cc 2021-04-28 13:58:37 +02:00
Christian Hesse
e97b394536 global-functions: introduce $EitherOr 2021-04-28 13:58:37 +02:00
Christian Hesse
66a92c3da9 upload-backup: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
123fe01115 sms-forward: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
557016387c netwatch-notify: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
81f84353cd log-forward: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
354aedd98e daily-psk: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
1ca3e8b59f collect-wireless-mac: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
d6edf6c2d3 cloud-backup: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
19ca17190d check-routeros-update: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
4fe11fadee check-lte-firmware-upgrade: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
bf315c15f6 check-health: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
71976f2eb9 check-certificates: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
76f32e3927 global-functions: $ScriptInstallUpdate: use $SendNotification2 2021-04-28 13:58:37 +02:00
Christian Hesse
c7a2eecd3c global-functions: introduce $SendEMail2, $SendNotification2 & $SendTelegram2
These accept just one array as argument. Adding new features is possible
without breaking the API.

These calls are the same for now:

$SendNotification "Subject..." "Message...";
$SendNotification2 ({ subject="Subject..."; message="Message..." });

But the latter will bring more features in future.
2021-04-28 13:58:37 +02:00
Christian Hesse
d4c9d1c577 README: add logo 2021-04-28 13:58:14 +02:00
Christian Hesse
99f828e7c0 add logo
This should be displayed by Gitlab now...
Also it is the logo we use for the Telegram group.
2021-04-28 12:05:04 +02:00
Christian Hesse
a90511cff9 check-routeros-update: be verbose when run from terminal only 2021-04-27 08:57:05 +02:00
Christian Hesse
96613e9bdd global-functions: $LogPrintExit: add deprecation warning 2021-04-26 16:40:02 +02:00
Christian Hesse
625d1dda12 check-routeros-update: silence check-for-updates, but be more verbose 2021-04-26 16:33:41 +02:00
Christian Hesse
7fee37f57e update list of contributors 2021-04-12 23:40:17 +02:00
Christian Hesse
025f14ae13 global-functions: CertificateDownload: silence certificate import 2021-03-21 22:28:09 +01:00
Christian Hesse
b55cdfb566 check-certificates: silence certificate import 2021-03-21 22:27:31 +01:00
Christian Hesse
f77213c6d0 check-certificates: be more verbose when attempting to renew 2021-03-21 22:22:52 +01:00
Christian Hesse
5610926d0a log-forward: use $EscapeForRegEx 2021-03-17 08:55:33 +01:00
Christian Hesse
7c4ab95394 global-functions: introduce $EscapeForRegEx 2021-03-17 08:51:23 +01:00
Christian Hesse
baa096fe03 log-forward: filter e-mail error on log forwarding in script...
... and update the filter in global configuration.
2021-03-15 12:40:14 +01:00
Christian Hesse
d00f18dc8c log-forward: update filter to match mail with quoted-printable encoding 2021-03-11 21:21:40 +01:00
Christian Hesse
4472784274 global-functions: $CertificateAvailable: use pre-test loop
This is required to test for root CA (without intermediate) directly.
2021-03-10 23:16:39 +01:00
Christian Hesse
b1647c760c log-forward: list messages with 'black circle' 2021-03-04 18:47:55 +01:00
Christian Hesse
f762d395eb log-forward: skip multi-repeated messages 2021-03-04 18:44:34 +01:00
Christian Hesse
d1741c99fe global-functions: $ScriptInstallUpdate: run migration unconditionally
We want the migration to run even if the notification is disabled.
2021-03-04 12:13:20 +01:00
Christian Hesse
9ab20bb927 global-config-overlay: remove magic
This allows to drop the ignore flag.
2021-03-04 12:13:20 +01:00
Christian Hesse
842c44b10a global-functions: $DNSIsResolving: have a final return 2021-03-03 14:54:22 +01:00
Christian Hesse
e65802007f global-functions: introduce and use $QuotedPrintable
Some mail clients do not like unencoded utf-8 in subject... Let's
encode in quoted-printable to fix.
2021-03-03 14:54:22 +01:00
Christian Hesse
7829a6c33a global-functions: $UrlEncode: simplify code 2021-03-03 14:54:22 +01:00
Christian Hesse
a019ff861e global-functions: $ValidateSyntax: add line breaks
This makes sure the closing curly bracket is not hidden in comment.
2021-02-26 20:59:27 +01:00
Christian Hesse
99d3e5d578 netwatch-notify: use $ValidateSyntax 2021-02-26 16:23:13 +01:00
Christian Hesse
cf87be70f9 mode-button: use $ValidateSyntax 2021-02-26 16:01:39 +01:00
Christian Hesse
e76b52e3b0 sms-action: use $ValidateSyntax 2021-02-26 15:51:29 +01:00
Christian Hesse
8e00545267 global-functions: $ScriptInstallUpdate: validate syntax of changelog and migration code 2021-02-26 15:38:33 +01:00
Christian Hesse
c48ad50f24 global-functions: introduce and use $ValidateSyntax 2021-02-26 14:49:10 +01:00
Christian Hesse
464dd55bbd unattended-lte-firmware-upgrade: skip interface on missing firmware information 2021-02-26 12:21:38 +01:00
Christian Hesse
9c9c9f4d34 unattended-lte-firmware-upgrade: be more verbose 2021-02-26 11:58:28 +01:00
Christian Hesse
fcbfb568da unattended-lte-firmware-upgrade: act on running interfaces only
The firmware is downloaded over the air, so broadband connection
is required.
2021-02-26 11:51:19 +01:00
Christian Hesse
c9854fa800 doc/unattended-lte-firmware-upgrade: broadband connection is required! 2021-02-26 11:15:58 +01:00
Christian Hesse
bd6b67ad7a global-functions: $ScriptInstallUpdate: add syntax validation 2021-02-25 16:50:10 +01:00
Christian Hesse
d0cdad791c global-functions: $ScriptInstallUpdate: swap conditions 2021-02-25 16:31:19 +01:00
Christian Hesse
fe3d582c1f global-functions: $FlushEmailQueue: fix syntax 2021-02-25 12:51:57 +01:00
Christian Hesse
60ec200945 global-functions: $ScriptInstallUpdate: expect global-config-overlay to be present 2021-02-25 12:50:20 +01:00
Christian Hesse
948a2664c4 global-functions: $ScriptInstallUpdate: list news with 'black circle'
... if symbols are enabled.
2021-02-25 12:27:20 +01:00
Christian Hesse
68ab6af56b let's keep next branch and document it 2021-02-25 11:13:35 +01:00
Christian Hesse
1015a1bbde global-functions: $CertificateAvailable: use $0 for $RequiredRouterOS 2021-02-24 22:55:08 +01:00
Christian Hesse
8abb3c1e33 update-tunnelbroker: silence fetch 2021-02-24 22:55:08 +01:00
Christian Hesse
78a53e6fe2 gps-track: silence fetch 2021-02-24 22:55:08 +01:00
Christian Hesse
9d35b49f16 global-functions: silence fetch 2021-02-24 22:55:08 +01:00
Christian Hesse
295203cc1c check-certificates: silence fetch 2021-02-24 22:55:08 +01:00
Christian Hesse
274af98886 global-functions: $GetMacVendor: improve error handling
The API returns 404 on unknown mac vendor... We can just catch error,
but not decide whether it is connection error or unknown vendor.

Try without mac address - on error we have a connection issue.
2021-02-24 22:54:43 +01:00
Christian Hesse
eaeda375e2 certs: remove obsolote certificate "Let's Encrypt Authority X3"
Let's Encrypt started issuing certificates from "R3" intermediate on
December 2nd. All certificates should be renewed by now...
2021-02-24 21:51:56 +01:00
Christian Hesse
8a366f035d backup: notify about random delay 2021-02-24 21:51:56 +01:00
Christian Hesse
bc8b19fc31 upload-backup: add configurable random delay 2021-02-24 21:51:56 +01:00
Christian Hesse
8b44964a36 email-backup: add configurable random delay 2021-02-24 21:51:56 +01:00
Christian Hesse
6770a15a7d cloud-backup: add configurable random delay 2021-02-24 21:51:56 +01:00
Christian Hesse
766a92a74b global: use $0 for $ScriptFromTerminal 2021-02-24 21:51:56 +01:00
Christian Hesse
041ca062b1 global: use $0 for $ScriptLock 2021-02-24 21:51:56 +01:00
Christian Hesse
f46db91845 global: give script or function name in log messages 2021-02-24 21:51:54 +01:00
Christian Hesse
b0e52aa2d1 global-functions: $GetMacVendor: requires certificate "Cloudflare Inc ECC CA-3" now 2021-02-24 21:48:36 +01:00
Christian Hesse
0d91445cca global-functions: $ScriptInstallUpdate: handle migration before message 2021-02-23 14:48:28 +01:00
Christian Hesse
e99821c39a switch default branch from master to main 2021-02-23 10:14:09 +01:00
Christian Hesse
73eb92fb72 We have a Telegram group! 2021-02-22 10:34:09 +01:00
Christian Hesse
292176e910 README: swap stars and forks 2021-02-21 21:59:36 +01:00
Christian Hesse
9975709ab7 capsman-download-packages: give more context in output 2021-02-21 21:40:28 +01:00
Christian Hesse
940d31b555 capsman-download-packages: complain on undefined path 2021-02-21 21:36:34 +01:00
Christian Hesse
a2450dc9f0 gps-track: fix syntax 2021-02-18 23:43:15 +01:00
Christian Hesse
4b945da907 global-functions: $FlushTelegramQueue: disable web page preview
... just as without queue.
2021-02-18 23:23:55 +01:00
Christian Hesse
06b235b3b7 check-routeros-update: wait to be fully connected 2021-02-18 23:14:46 +01:00
Christian Hesse
182bd2fa0b check-routeros-update: give more context 2021-02-18 23:11:10 +01:00
Christian Hesse
60ca07dc8a global-functions: $TimeIsSync: do not flood log...
... when returning gracefully.
2021-02-18 21:49:23 +01:00
Christian Hesse
d5afc79eed global: drop script 'global-wait'
All scripts wait for the global functions on their own now.
2021-02-18 21:45:38 +01:00
Christian Hesse
2db73a189c global-functions: $ScriptInstallUpdate: fix change notification
In RouterOS functions are of type 'array' with 'code' (numerical index 1)
inside. Cast to string to make comparison work.

Also define the function to make it available.
2021-02-18 21:45:38 +01:00
Christian Hesse
148a7f93a6 global-functions: $ScriptInstallUpdate: Properly escape question mark 2021-02-18 21:10:14 +01:00
Christian Hesse
3f12730ed4 email-backup: no example address, complain if missing 2021-02-18 12:54:04 +01:00
Christian Hesse
776f072415 README: fix typo 2021-02-18 11:30:04 +01:00
Christian Hesse
e6f705f9e6 upload-backup: wait to be fully connected 2021-02-18 09:12:44 +01:00
Christian Hesse
8c221842a6 email-backup: wait to be fully connected 2021-02-18 09:12:31 +01:00
Christian Hesse
1c40a90c79 cloud-backup: wait to be fully connected 2021-02-18 09:12:07 +01:00
Christian Hesse
fc601a57ee global-functions: $DeviceInfo: shorten text 2021-02-16 20:08:32 +01:00
Christian Hesse
efca1ec049 global-functions: drop $MailServerIsUp
Now that we have an e-mail queue we do not care if the server is up or not.
2021-02-16 16:45:13 +01:00
Christian Hesse
28db473299 global-functions: send (and re-send) e-mails from queue 2021-02-16 16:45:13 +01:00
Christian Hesse
17d7678e2d global-functions: drop support for attachment in notification e-mail 2021-02-16 16:04:18 +01:00
Christian Hesse
e7c2a7745a daily-psk: drop support for attaching QR-Code
The notification contains the link. Should be sufficient, no?
2021-02-16 16:01:36 +01:00
Christian Hesse
0c2143298d global-functions: $CertificateAvailable: check chain by akid and skid
We can merge this when RouterOS 6.47 moves to long-term...
2021-02-09 09:58:46 +01:00
Christian Hesse
dad525173c global-functions: $DownloadPackage: this requires Let's Encrypt "R3" now 2021-02-03 14:32:38 +01:00
Christian Hesse
55a8a984f7 global-functions: $GetMacVendor: this requires Let's Encrypt "R3" now 2021-02-03 14:28:16 +01:00
Christian Hesse
eaea89112a global-functions: $LogPrintExit: notify about colorful output 2021-01-22 10:08:15 +01:00
Christian Hesse
b780b40baf global-functions: $LogPrintExit: make colorful output configurable 2021-01-22 09:22:34 +01:00
Christian Hesse
bbf918e329 global-functions: $LogPrintExit: colorful output 2021-01-22 09:22:34 +01:00
Christian Hesse
086a395e82 global-functions: $ScriptInstallUpdate: give hint on changes 2021-01-22 09:22:34 +01:00
Christian Hesse
99aaf642b2 capsman-download-packages: handle error when creating directory 2021-01-20 14:43:27 +01:00
Christian Hesse
e135ca1238 certificate-renew-issued: handle error when creating directory 2021-01-20 14:38:11 +01:00
Christian Hesse
c980699dd7 global-functions: add error handling 2021-01-20 14:23:57 +01:00
Christian Hesse
11d43e9fe5 global-functions: $SymbolForNotification: remove empty line 2021-01-20 14:08:01 +01:00
Christian Hesse
fa7f37e87f global-functions: $WaitForFile: declare input first 2021-01-20 14:07:20 +01:00
Christian Hesse
dc148065dc global-functions: $MkDir: clean path 2021-01-20 14:03:31 +01:00
Christian Hesse
6cea5a9f9b check-certificates: complete certificate renewal time
With a modified certificate renewal time may have failed if the new
certificate was not found.
2021-01-11 12:00:07 +01:00
Christian Hesse
d926c84cdb check-certificates: do not renew if loosing private key 2021-01-11 12:00:07 +01:00
Christian Hesse
8e628ce11e check-certificates: show info on private key 2021-01-11 12:00:07 +01:00
Christian Hesse
faf08b0575 global-functions: introduce and use $RequiredRouterOS 2021-01-04 10:39:11 +01:00
Christian Hesse
ab267d54b3 global-functions: $ScriptInstallUpdate: log error on reloading global functions 2021-01-03 21:37:48 +01:00
Christian Hesse
156024ac2f global-functions: $ScriptInstallUpdate: log error on reloading global configuration 2021-01-03 21:20:04 +01:00
Christian Hesse
90672798e8 hotspot-to-wpa: always use first entry to place before 2021-01-03 20:34:19 +01:00
Christian Hesse
3eccf923cc dhcp-to-dns: always use first entry to place before 2021-01-03 20:34:04 +01:00
Christian Hesse
c18f753338 collect-wireless-mac: always use first entry to place before 2021-01-03 20:33:32 +01:00
Christian Hesse
241d5fd2d7 ipv6-update: simplify the code...
... and make it match the code used in other scripts.
2021-01-03 20:27:24 +01:00
Christian Hesse
4368f500c3 ipv6-update: get old prefix from first matching address list entry 2021-01-03 19:56:47 +01:00
Christian Hesse
547fbc630a update copyright for 2021 2021-01-01 21:33:52 +01:00
Christian Hesse
ea7cdcb4a5 update list of contributors 2020-12-30 12:47:55 +01:00
Daniel Ziegenberg
ca6668950b collect-wireless-mac: always select first lease from dhcp-server
The script fails at setting the hostname when there are multiple leases
for a mac address.

In line 36 and 37 the hostname gets set from the data the lease. When there
is more than one lease for a specific mac address this fails with the message
"invalid internal item number". More than one lease for a mac address is
possible, if you have more than one SSID on a capsman and a single device
can login into more than one SSID.

Fixes #10

Signed-off-by: Christian Hesse <mail@eworm.de>
2020-12-30 12:42:03 +01:00
Christian Hesse
97ade535d9 certs: add plain text info about certificates
Also order certificates, so we have:
 * intermediate
 * root
 * alternative root, if any

Let's add 'ISRG Root X1' for 'E1' as there will be a valid cross-signed
chain 'E1' -> 'ISRG Root X2' -> 'ISRG Root X1'.
2020-12-30 00:45:11 +01:00
Christian Hesse
605c313e46 global-functions: $ScriptInstallUpdate: simplify code 2020-12-20 23:33:16 +01:00
Christian Hesse
caddcbabe2 global-functions: $ScriptInstallUpdate: drop ignore migration
Anybody had enough time to migrate, no?
2020-12-20 23:27:02 +01:00
Christian Hesse
0360a0ef90 global-functions: $ScriptInstallUpdate: implement migration mechanism
Reset $SentConfigChangesNotification and rerun $ScriptInstallUpdate
to test...

:set SentConfigChangesNotification
$ScriptInstallUpdate
2020-12-18 20:32:29 +01:00
Christian Hesse
40dc2415d3 global-functions: $ScriptInstallUpdate: make Let's Encrypt certificate semi-mandatory
... and remove the migration from changes.
2020-12-18 20:32:29 +01:00
Christian Hesse
05a9531dac certs: remove Let's Encrypt Authority X3 2020-12-18 20:32:29 +01:00
Christian Hesse
25d5454234 INITIAL-COMMANDS: drop Let's Encrypt Authority X3 2020-12-18 20:32:29 +01:00
Christian Hesse
c4c139d5a6 README: drop Let's Encrypt Authority X3 2020-12-18 20:32:29 +01:00
Christian Hesse
010e2d6b05 check-certificates: make the certificate renewal time configurable 2020-12-18 16:02:31 +01:00
Christian Hesse
be75772256 Merge branch 'ipv6-update' 2020-12-18 15:32:51 +01:00
Christian Hesse
3657830582 ipv6-update: notify about interface specific address list entries 2020-12-18 15:31:03 +01:00
Christian Hesse
cb72eccc6c ipv6-update: update interface specific address list entries 2020-12-18 10:11:18 +01:00
Christian Hesse
503dc3c32c ipv6-update: move the delay down
We have to wait for the interfaces, no need to delay address list entry.
2020-12-18 10:01:50 +01:00
Christian Hesse
744a03896c ipv6-update: automatically add ipv6 address list entry 2020-12-18 09:59:13 +01:00
Christian Hesse
e9210acfdb ipv6-update: add missing colon 2020-12-18 00:02:56 +01:00
Christian Hesse
62598b6653 import Let's Encrypt certificate "R3" 2020-12-17 22:47:12 +01:00
Christian Hesse
c51a630a21 INITIAL-COMMANDS: also import Let's Encrypt certificate "R3" 2020-12-17 22:14:25 +01:00
Christian Hesse
9f6b877aef README: also import Let's Encrypt certificate "R3" 2020-12-17 22:14:25 +01:00
Christian Hesse
50199a57a0 certs: add new Let's Encrypt certificates
https://letsencrypt.org/certificates/
2020-12-17 21:58:53 +01:00
Christian Hesse
16d3709030 log-forward: add 'if any' in log message 2020-12-14 23:39:50 +01:00
Christian Hesse
158c27e293 global-functions: $FlushTelegramQueue: log warning on empty queue...
... if scheduler exists.
2020-12-10 09:53:43 +01:00
Christian Hesse
adf35f3b16 global-functions: $FlushTelegramQueue: do not fail if run without scheduler 2020-12-10 09:38:59 +01:00
Christian Hesse
cef0e8c079 global-functions: $SendTelegram: give amount of truncated text 2020-12-01 09:11:37 +01:00
Michael Gisbers
e2e831dbf9 global-functions: $CertificateDownload: fix typo
Signed-off-by: Michael Gisbers <michael@gisbers.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
2020-11-29 22:26:18 +01:00
Christian Hesse
107f9e4bdf Merge branch 'telegram-clickable' 2020-11-27 10:03:08 +01:00
Christian Hesse
ca4e25283f global-functions: clickable links in telegram notifications 2020-11-26 23:04:05 +01:00
Christian Hesse
d09baddac3 global-functions: $SendEMail: prepare to add link
For e-mail just in plain text...
2020-11-26 23:04:05 +01:00
Christian Hesse
46866e2ff2 global-functions: $SendEMail: handle signature with $IfThenElse 2020-11-26 22:34:08 +01:00
Christian Hesse
b078ce2f0f global-functions: $SendTelegram: split off & move down truncation message 2020-11-26 22:24:56 +01:00
Christian Hesse
7e0558e85d global-functions: $SendTelegram: prepare to add clickable link
Formatting with fixed width font stopped links from being clickable.
2020-11-26 22:21:28 +01:00
Christian Hesse
d7725540f8 global-functions: $SendTelegram: change internal wording 2020-11-26 22:06:03 +01:00
Christian Hesse
54e164e542 global-functions: $SendTelegram: try to get the line breaks right 2020-11-26 22:02:39 +01:00
Christian Hesse
c93d1c4944 global-functions: $SendTelegram: disable web page preview 2020-11-26 17:32:12 +01:00
Christian Hesse
6b19cf2578 log-forward: add parenthesis in filter expression
Looks like this works without parenthesis in RouterOS,
let's add it anyway.
2020-11-26 10:32:17 +01:00
Christian Hesse
056d273c11 update list of contributors 2020-11-24 13:54:36 +01:00
Christian Hesse
0545fbd899 check-health: re-measure until we have a valid value 2020-11-24 13:54:36 +01:00
Christian Hesse
af50ed5909 check-health: use second measure against temperature spikes
The old spike detection was still prone to false alerts. Let's do a
second measurement and ignore on difference.

This results in more measurements being ignored, but temperature is
changing slowly only and it should not hurt.
2020-11-24 13:45:57 +01:00
Christian Hesse
13f7ba11da check-health: do not write unicode to log 2020-11-20 12:01:15 +01:00
Christian Hesse
b97d5308b1 check-health: guard against temperature spikes
Looks like devices out there suffer sensor issue or bug where
temperature value spikes and drops immediately:

https://forum.mikrotik.com/viewtopic.php?t=111030
https://forum.mikrotik.com/viewtopic.php?t=111109
https://forum.mikrotik.com/viewtopic.php?t=151242

... and possibly more.

Let's ignore these spikes, but at the same time increase the current
value to bring it into line - in case it's real.
2020-11-19 21:23:27 +01:00
Christian Hesse
88f9948c72 check-health: handle formatting by picking from string
The mathematical way is more elegant, but just picking the char from
string is shorter. 😜
2020-11-19 20:24:09 +01:00
Christian Hesse
7adfd1b670 check-health: properly handle voltage value below one
Before this produced division by zero...
2020-11-19 16:32:12 +01:00
Christian Hesse
34a0d4ab85 Merge branch 'netwatch-notify' 2020-11-17 22:45:35 +01:00
Christian Hesse
62ef70e5dd netwatch-notify: notify about changes 2020-11-17 22:28:05 +01:00
Christian Hesse
23923619dd netwatch-notify: increase count for every parent in chain 2020-11-17 22:28:05 +01:00
Christian Hesse
e7855b4611 netwatch-notify: support parents in a chain 2020-11-17 22:28:05 +01:00
Christian Hesse
d5125b816a netwatch-notify: be more verbose in logs 2020-11-17 22:28:05 +01:00
Christian Hesse
6c14412aa9 netwatch-notify: implemented simple dependency model 2020-11-17 22:28:05 +01:00
Christian Hesse
e1d9b08b9a doc/netwatch-notify: remove timeout from examples 2020-11-17 21:08:37 +01:00
Christian Hesse
cf5220278d netwatch-notify: unbreak custom count 2020-11-17 14:22:29 +01:00
Christian Hesse
021463c76b Merge branch 'log-forward' 2020-11-13 22:49:50 +01:00
Christian Hesse
966e7b6fd3 log-forward: do not exclude topic 'script'
We have justified severity for some log message, so do no longer exclude
topic 'script'.
2020-11-13 22:46:26 +01:00
Christian Hesse
348cc2e3f3 check-certificates: decrease log severity to info 2020-11-13 22:43:41 +01:00
Christian Hesse
19ed080244 check-routeros-update: decrease log severity to info 2020-11-13 22:34:31 +01:00
Christian Hesse
8b07119f38 check-health: decrease log severity to info 2020-11-13 22:17:55 +01:00
Christian Hesse
b8efaafe6e global-functions: $SendTelegram: decrease log severity to info
The message is queued, not lost...
2020-11-13 22:15:23 +01:00
Christian Hesse
7b3960a0e1 global-functions: $TimeIsSync: decrease log severity to info 2020-11-13 22:12:03 +01:00
Christian Hesse
27b494b139 global-functions: $MailServerIsUp: decrease log severity to info 2020-11-13 22:07:24 +01:00
Christian Hesse
d519b70e65 global-functions: $CertificateDownload: be more verbose 2020-11-13 22:02:00 +01:00
Christian Hesse
d2fab050ba log-forward: do not forward own e-mail logs
Revert the last change, instead just ignore messages that were generated
by log-forward, with "Log Forwarding" in subject.
2020-11-13 20:56:48 +01:00
Christian Hesse
24eb2c15a9 log-forward: do not forward e-mail logs
This could cause infinite loop if the mail server does not recover...
2020-11-12 23:18:51 +01:00
Christian Hesse
243b23dc19 global-functions: $DNSIsResolving: use a domain with low ttl 2020-11-06 22:57:19 +01:00
Christian Hesse
f2e16a92d1 README: optional scheduler to update scripts automatically 2020-11-01 22:20:02 +01:00
Christian Hesse
df66309281 doc/global-wait: link more use cases 2020-11-01 21:57:36 +01:00
Christian Hesse
d547f68df1 doc/global-wait: warn about scheduler 2020-11-01 21:57:13 +01:00
Christian Hesse
98c132105d check-routeros-update: support installing updates automatically if seen in neighbor list 2020-11-01 21:48:03 +01:00
Christian Hesse
7f356d76bf global-functions: $SymbolForNotification: support multiple symbols...
... with comma-separated list.
2020-10-27 00:30:40 +01:00
Christian Hesse
fee2523a22 mode-button: make LED configurable 2020-10-23 21:50:14 +02:00
Christian Hesse
2e4658e49a mode-button: act on led with type on or off only 2020-10-23 21:24:59 +02:00
Christian Hesse
55e114c190 mode-button: act on led with no interface setting only 2020-10-23 20:32:45 +02:00
Christian Hesse
3b65b7e835 mode-button: fix delay
The `:beep` command is async... So an additional delay is
required unconditionally.
2020-10-23 16:01:21 +02:00
Christian Hesse
cbb1e624b2 bridge-port-to-default: be more robust
This was unreliable with inconsistent configuration...
2020-10-23 15:27:17 +02:00
Christian Hesse
ae5570325b ospf-to-leds: introduce script to visualize ospf state via leds 2020-10-23 14:17:33 +02:00
Christian Hesse
ebbc40e3a0 mode-button: support inverted blink 2020-10-23 12:01:29 +02:00
Christian Hesse
dd39049d36 mode-button: use user-led for visual feeback
The user-led needs to be configured with type=off, it is ignored with
other configuration.
2020-10-22 22:18:22 +02:00
Christian Hesse
4af1f5dec2 sms-forward: improve wording for single/multiple message(s) 2020-10-19 13:49:57 +02:00
Christian Hesse
4a85deb45c log-forward: improve wording for single message 2020-10-18 20:16:54 +02:00
Christian Hesse
211edb93c0 check-health: do not hardcode names, use as available 2020-10-17 23:05:08 +02:00
Christian Hesse
a4b237044d sms-forward: lock against multiple invocations 2020-10-17 13:40:01 +02:00
Christian Hesse
6d9eb99e08 check-health: add deviation on temperature recovery threshold
This helps against notification flooding.
2020-10-16 22:58:14 +02:00
Christian Hesse
3e72d1ec0b check-health: give error on messing health values 2020-10-16 21:35:44 +02:00
Christian Hesse
8b2df7abd0 mode-button: merge mode-button-event & mode-button-scheduler 2020-10-16 08:24:19 +02:00
Christian Hesse
1c4531d536 README: link to global-config 2020-10-15 22:50:12 +02:00
Christian Hesse
b769077746 global-config: do not define mail addresses by default 2020-10-15 22:45:27 +02:00
Christian Hesse
c40c792806 global-functions: $SendTelegram: clean up 2020-10-14 22:07:02 +02:00
Christian Hesse
0009c7fc65 cloud-backup: add unit for size, add KiB 2020-10-13 20:46:30 +02:00
Christian Hesse
370d7c1a58 unattended-lte-firmware-upgrade: convert to function 2020-10-13 18:55:23 +02:00
Christian Hesse
e11e6b4658 check-lte-firmware-upgrade: show manufacturer & model 2020-10-13 13:23:32 +02:00
Christian Hesse
3e0039c266 global-functions: $SendTelegram: use fixed-width font...
... but give configuration to opt-out.
2020-10-13 10:05:59 +02:00
Christian Hesse
6b1d9e8f40 global-functions: $FlushTelegramQueue, $SendTelegram: move hint 2020-10-13 09:00:55 +02:00
Christian Hesse
fc99440224 global-functions: $UrlEncode: encode new line & carriage return 2020-10-13 08:46:20 +02:00
Christian Hesse
8ddc964cb5 global-functions: $IPCalc: return data in array 2020-10-10 19:59:53 +02:00
Christian Hesse
8e6403b1be global-functions: $WaitTimeSync: calculate with modulo operation
The uptime is returned in time, with supports arithmetic modulo
operation. This is three minutes in nano seconds, so multiplied
180 with 10^9.
2020-10-09 16:00:09 +02:00
Christian Hesse
9bd56d8aca packages-update: improve backup failure handling 2020-10-08 00:06:09 +02:00
Christian Hesse
ffad79b8fc packages-update: be more verbose 2020-10-08 00:04:29 +02:00
Christian Hesse
3dc10ca2b8 packages-update: fix variable usage 2020-10-07 23:55:10 +02:00
Christian Hesse
bc5133fb41 global-functions: $LogPrintExit: explicitly set severity 2020-10-07 23:27:09 +02:00
Christian Hesse
8425290d1d upload-backup: hint failure in subject 2020-10-07 23:27:09 +02:00
Christian Hesse
1cb7194ec5 upload-backup: exit with error on error
The error has been logged before, so just make sure to exit with error.
2020-10-07 23:27:09 +02:00
Christian Hesse
2be4a2ce98 cloud-backup: send notification on error and do exit 2020-10-07 23:27:09 +02:00
Christian Hesse
38a3ef9552 global-functions: $MailServerIsUp: return gracefully on missing configuration 2020-10-07 14:21:39 +02:00
Christian Hesse
a0d1709244 log-forward: notify on rate limit 2020-09-28 20:26:29 +02:00
Christian Hesse
744542e925 log-forward: add rate limit to prevent flooding 2020-09-28 20:20:19 +02:00
Christian Hesse
42289b6239 sms-forward: fix usage of function 2020-09-28 19:57:04 +02:00
Christian Hesse
d53cf3e8e7 log-forward: fix usage of function 2020-09-28 19:56:45 +02:00
Christian Hesse
b0db9c7d52 global-functions: $SendTelegram: scissors symbol for truncation 2020-09-28 19:53:32 +02:00
Christian Hesse
9ea6b159b6 global-functions: $SendTelegram: truncate messages if too long
Telegram messages have a maximum length of 4096 characters. Truncate if
too long, keep some spare characters for status messages.
2020-09-27 20:38:09 +02:00
Christian Hesse
697e32a306 log-forward: add filter on log message text 2020-09-25 22:21:59 +02:00
Christian Hesse
c3ea555233 dhcp-to-dns: notify on acting on all bound leases 2020-09-25 22:20:34 +02:00
Christian Hesse
9f16e0644b global-functions: notify on Telegram queue 2020-09-25 22:19:16 +02:00
Christian Hesse
9bec6914cc netwatch-notify: notify on configurable check count threshold 2020-09-25 22:17:26 +02:00
Christian Hesse
addd4d7d90 netwatch-syslog: find the correct netwatch entry 2020-09-21 21:25:17 +02:00
Christian Hesse
1a28a417f4 lease-script: give correct hint in message 2020-09-20 21:50:33 +02:00
Christian Hesse
9f3e39206c dhcp-to-dns: also act on static leases
Since commit 0560f828 we act on bound leases only. That keeps offline
clients away, so act on static leases as well.
2020-09-19 22:36:47 +02:00
Christian Hesse
956244d53b collect-wireless-mac: add symbol in notification 2020-09-18 13:11:33 +02:00
Christian Hesse
1367a59c27 daily-psk: add symbol in notification 2020-09-18 13:08:29 +02:00
Christian Hesse
49737af6d1 extend magic pattern with "by RouterOS"
This matches the string included in export.
2020-09-18 11:00:27 +02:00
Christian Hesse
6c3bcdecb2 global-functions: add missing colon 2020-09-17 21:21:04 +02:00
Christian Hesse
52f4f484e5 global-functions: $FlushTelegramQueue: destroy empty queue 2020-09-14 23:56:59 +02:00
Christian Hesse
a03c8773da global-functions: $FlushTelegramQueue: give hint on queued message 2020-09-14 23:22:02 +02:00
Christian Hesse
1b68e42bc6 global-functions: queue Telegram notifications on failure and re-send
This introduces function $FlushTelegramQueue, which flushes queue of
Telegram notifications. Notifications are appended to the queue if
sending failed.
2020-09-14 22:56:52 +02:00
Christian Hesse
0c111a2ebe doc/mode-button: add code to check for support 2020-09-08 17:16:51 +02:00
Christian Hesse
d434a2f2d7 check-certificates: do not notify with missing validity period 2020-09-06 22:31:55 +02:00
Christian Hesse
b3c1450f1c doc/check-certificates: hint on running on startup 2020-09-03 13:09:22 +02:00
Christian Hesse
cabafc7853 check-certificates: better check for non-empty value 2020-09-01 23:40:03 +02:00
Christian Hesse
5c7cde6227 bridge-port-to-default: better check for non-empty value 2020-09-01 23:39:34 +02:00
Christian Hesse
fae28357c7 global-functions: $DefaultRouteIsReachable: exclude blackhole 2020-09-01 23:15:57 +02:00
Christian Hesse
d320fa93f2 upload-backup: remove extra curly bracket 2020-09-01 11:32:27 +02:00
Christian Hesse
25d8d5d855 email-backup: remove extra curly bracket 2020-09-01 11:31:51 +02:00
Christian Hesse
b9c699b29f upload-backup: wait for file 2020-09-01 11:19:20 +02:00
Christian Hesse
8cbb053686 email-backup: wait for file 2020-09-01 11:18:13 +02:00
Christian Hesse
ff5cdc3019 [ ... print count-only ...] -> [ :len [ ... find ... ] ]
Using 'print count-only' always prints a number to terminal, even if the
value is evaluated in a condition or assigned to a variable. This can be
quite annoying. Behavior will not chance (SUP-25503), so replacing the
code...
2020-08-26 09:29:52 +02:00
Christian Hesse
92ca31a41d netwatch-notify: be more verbose on host downtime
Signed-off-by: Christian Hesse <mail@eworm.de>
2020-08-24 14:26:55 +02:00
Christian Hesse
e58d8e4373 netwatch-notify: make check count threshold configurable
Signed-off-by: Christian Hesse <mail@eworm.de>
2020-08-24 14:26:55 +02:00
Christian Hesse
d65874e142 global-functions: $TimeIsSync: return gracefully...
Situation will not improve... But chances are that RTC is available with
correct time, for example from host inside CHR vm. So return gracefully.
2020-08-21 23:39:36 +02:00
Christian Hesse
8c988ac55a global-functions: $TimeIsSync: warn on missing time source 2020-08-21 23:35:29 +02:00
Christian Hesse
7febb6a0f4 global-functions: $TimeIsSync: return false if cloud enabled but not ready 2020-08-21 23:33:12 +02:00
Christian Hesse
cc375704f3 global-functions: $TimeIsSync: return false if ntp client enabled but not synced 2020-08-21 23:25:53 +02:00
Christian Hesse
b68b997c1e check-certificates: wait to be fully connected 2020-08-21 23:13:47 +02:00
Christian Hesse
eaffb1dbd2 check-certificates: fix usage of function 2020-08-21 23:09:39 +02:00
Christian Hesse
f1236065ad fix typo: botton -> button 2020-08-13 13:07:40 +02:00
Christian Hesse
6575cb3321 notify about support for dhcp server name in fqdn 2020-08-07 22:15:30 +02:00
Christian Hesse
457110e262 update list of contributors 2020-08-07 22:11:01 +02:00
netztrip
2e1acc2505 dhcp-to-dns: add support for dhcp server name in fqdn 2020-08-07 22:08:01 +02:00
Christian Hesse
354be9c222 doc/dhcp-to-dns: document $PrefixInZone 2020-08-03 00:04:59 +02:00
Christian Hesse
3b28440b05 global-functions: drop $GetRandomSha256, introduce $GetRandom20CharHex
Do do generate certificate, but use scep-server otp.
2020-07-25 16:17:01 +02:00
Christian Hesse
1bac1b4d3d netwatch-notify: ignore disabled hosts 2020-07-18 00:01:51 +02:00
Christian Hesse
b27d875111 log-forward: lock script to run just once 2020-07-17 20:52:52 +02:00
Christian Hesse
00e99a13fb check-lte-firmware-upgrade: add symbol in notification 2020-07-17 12:26:55 +02:00
Christian Hesse
35c28df68d check-routeros-update: add symbol in all notifications 2020-07-17 12:25:44 +02:00
Christian Hesse
8eaf24e274 upload-backup: change symbol to warning sign on failure 2020-07-17 12:00:59 +02:00
Christian Hesse
3e1746f43e check-certificates: add symbol in notification 2020-07-17 11:52:54 +02:00
Christian Hesse
b91edc9e39 global-functions: $ScriptInstallUpdate: add symbol in notification 2020-07-17 11:40:24 +02:00
Christian Hesse
d1cba3fc05 upload-backup: add symbol in notification 2020-07-17 11:23:17 +02:00
Christian Hesse
e0fe98a274 cloud-backup: add symbol in notification 2020-07-17 11:22:40 +02:00
Christian Hesse
075859c898 global-functions: introduce and use $SymbolForNotification 2020-07-17 08:12:00 +02:00
Christian Hesse
0e7b2d3ac7 sms-forward: use $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
4a5185ae28 netwatch-notify: use $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
1b55c9b5a2 log-forward: use $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
33899b9904 check-routeros-update: use $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
17e9635ca1 check-health: use $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
7862ce5f19 global-functions: introduce $SymbolByUnicodeName 2020-07-17 07:52:56 +02:00
Christian Hesse
febf0ee5e4 check-routeros-update: move symbol before text 2020-07-17 00:10:31 +02:00
Christian Hesse
e709af4c4d dhcp-to-dns: use $IfThenElse 2020-07-16 21:46:20 +02:00
Christian Hesse
6dfd8ed41a check-certificates: use $IfThenElse 2020-07-16 21:18:12 +02:00
Christian Hesse
4c61cd0b65 global-functions: $DeviceInfo: use $IfThenElse 2020-07-16 21:06:13 +02:00
Christian Hesse
910641b6fa global-functions: introduce $IfThenElse 2020-07-16 20:34:27 +02:00
Christian Hesse
5859b0406e netwatch-notify: move symbol before text 2020-07-16 17:51:21 +02:00
Christian Hesse
806d9bd4fb check-health: move symbol before text 2020-07-16 17:48:21 +02:00
Christian Hesse
371e96911d sms-forward: add symbol 2020-07-16 14:53:35 +02:00
Christian Hesse
1aed883cd5 INITIAL-COMMANDS: declare $CertificateNameByCN 2020-07-16 10:56:24 +02:00
Christian Hesse
5d7d2e9ac6 check-health: add symbol for voltage 2020-07-15 21:01:15 +02:00
Christian Hesse
efd0b0d274 check-health: new symbol for high temperature 2020-07-15 20:52:24 +02:00
Christian Hesse
96d473cfe8 log-forward: remember the last id only 2020-07-15 14:43:26 +02:00
Christian Hesse
6bce0a4b6a add 'log-forward', drop 'early-errors' 2020-07-15 12:41:29 +02:00
Christian Hesse
9740b1f269 global-functions: $ScriptInstallUpdate: update wording for notification 2020-07-14 21:28:35 +02:00
Christian Hesse
e19f40f1eb README: be more explicit on file name 2020-07-14 17:02:46 +02:00
Christian Hesse
f4d6e07dbb global-config: dropped $ScriptUpdatesIgnore, use ignore flag in comment 2020-07-14 17:02:41 +02:00
Christian Hesse
d1b6ca3d0b notify about auto patch updates in check-routeros-update 2020-07-14 17:02:36 +02:00
Christian Hesse
4a52d51a36 notify about hooks in netwatch-notify 2020-07-14 17:02:31 +02:00
Christian Hesse
aec63407e8 notify about options in script comments 2020-07-14 16:23:04 +02:00
Christian Hesse
883920aeae notify about $IPCalc 2020-07-14 16:22:17 +02:00
Christian Hesse
23563cb9aa notify about early-errors 2020-07-14 16:16:46 +02:00
Christian Hesse
0b5ab83339 capsman-download-packages: wait to be fully connected 2020-07-14 14:29:29 +02:00
Christian Hesse
c4ff95b3ae global-functions: $MailServerIsUp: do immediate check 2020-07-14 10:59:08 +02:00
Christian Hesse
639bfc367b sms-forward: wait to be fully connected 2020-07-14 09:25:12 +02:00
Christian Hesse
16685dd332 global-functions: $DNSIsResolving: try a domain that is unlikely to be cached 2020-07-14 09:12:44 +02:00
Christian Hesse
d75ef3bd69 packages-update: add error handling, also run cloud-backup 2020-07-07 12:18:37 +02:00
Christian Hesse
b31d1a0f01 packages-update: do not install downgrade without confirmation 2020-07-07 09:30:48 +02:00
Christian Hesse
c5767c8d23 doc/check-routeros-update: patch updates 2020-07-07 09:27:40 +02:00
Christian Hesse
8b23c1e925 check-routeros-update: send just one notification 2020-07-07 09:27:40 +02:00
Christian Hesse
0f0d539c67 check-routeros-update: log and print on available downgrade 2020-07-07 09:27:40 +02:00
Christian Hesse
22a9a11c73 check-routeros-update: install update only, notification on downgrade 2020-07-07 09:27:40 +02:00
Christian Hesse
2907dbe18f check-routeros-update: support installing patch updates automatically 2020-07-07 00:21:47 +02:00
Christian Hesse
d8b2055fbc global-functions: add $VersionToNum 2020-07-07 00:01:00 +02:00
Christian Hesse
e1b45f13f5 early-errors: exclude certificate messages
This is most likely SCEP requests before network is up...
2020-07-06 16:04:08 +02:00
Christian Hesse
8dadde23f3 doc/netwatch-notify: document hooks 2020-07-06 15:54:02 +02:00
Christian Hesse
a79461aff2 netwatch-notify: add up hook for consistency
Also this works around the permission/policy limitations in
netwatch scripts.
2020-07-06 15:44:41 +02:00
Christian Hesse
1c10044b24 netwatch-notify: add support for down hook
Adding up-hook does not make sense... Just use netwatch's up-script for that.
2020-07-03 15:27:21 +02:00
Christian Hesse
49d5f52f0b mode-button-scheduler: drop useless variable 2020-07-03 15:25:31 +02:00
Christian Hesse
01fe371a0d dhcp-to-dns: allow to configure 'dhcp' prefix in zone 2020-07-03 08:20:36 +02:00
Christian Hesse
ef2cb11665 global-functions: $ScriptInstallUpdate: get base url and suffix from comment
Just set 'base-url=https://example.com/...' and/or 'url-suffix=\h=branch'
in comment to overwrite settings from global configuration.
2020-07-02 00:58:06 +02:00
Christian Hesse
e38f3fb022 global-functions: $ScriptInstallUpdate: support ignore from comment
Just add 'ignore' in comment...
2020-07-02 00:41:37 +02:00
Christian Hesse
149340ff34 global-functions: $ParseKeyValueStore: allow equals sign in value 2020-07-02 00:41:37 +02:00
Christian Hesse
2aaea7c58e global-functions: $ParseKeyValueStore: key without value for boolean true 2020-07-02 00:41:37 +02:00
Christian Hesse
5b03ae4fa2 global-functions: do not initialize $Sent* variables
The scripts work without initialization, removing this makes sure the
value is not overwritten on global functions reload.
2020-06-30 20:26:37 +02:00
Christian Hesse
2093661552 global-functions: $GetRandomNumber: limit at 2^32-1 2020-06-30 20:06:55 +02:00
Christian Hesse
baba79e3f5 global-functions: $GetRandomNumber: return 32bit number without limit 2020-06-29 16:32:19 +02:00
Christian Hesse
38760d05b0 global-functions: add $IPCalc
[admin@MikroTik] > $IPCalc 192.168.88.188/20
Address:   192.168.88.188
Netmask:   255.255.240.0
Network:   192.168.80.0/20
HostMin:   192.168.80.1
HostMax:   192.168.95.254
Broadcast: 192.168.95.255
2020-06-23 13:19:27 +02:00
Christian Hesse
71ad56aacc explicitly name the license
Copyright (C) 2013-2020 Christian Hesse <mail@eworm.de>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

https://www.gnu.org/licenses/#GPL
https://www.gnu.org/licenses/gpl.html
https://www.gnu.org/licenses/gpl.md
2020-06-19 22:17:42 +02:00
Christian Hesse
12015af855 global-functions: $GetRandomNumber: use $GetRandomSha256 2020-06-18 12:52:59 +02:00
Christian Hesse
529dbbe4f8 global-functions: rename $GetRandom -> $GetRandomNumber 2020-06-18 12:49:52 +02:00
Christian Hesse
a1d05f93c6 global-functions: add $GetRandomSha256 2020-06-18 12:23:50 +02:00
Christian Hesse
3589416840 add certificate 'GTS CA 1O1'
This is used by DNS over HTTPS services:

https://dns.google/dns-query
2020-06-10 11:08:18 +02:00
Christian Hesse
bfcf861b51 dhcp-to-dns: add a marker for new records 2020-06-02 22:09:13 +02:00
Christian Hesse
7597911672 daily-psk: wait to be fully connected 2020-05-27 00:21:30 +02:00
Christian Hesse
7ecda2204f early-errors: wait to be fully connected 2020-05-27 00:13:57 +02:00
Christian Hesse
6a50e80825 doc/early-errors: use $WaitFullyConnected 2020-05-26 23:59:12 +02:00
Christian Hesse
c88de834e4 doc/daily-psk: use $WaitFullyConnected 2020-05-26 23:58:46 +02:00
Christian Hesse
e871cb5a69 global-functions: add $WaitFullyConnected 2020-05-26 23:35:24 +02:00
Christian Hesse
4166bf91c3 global-functions: add $WaitDNSResolving 2020-05-26 23:34:58 +02:00
Christian Hesse
b7172b69ce global-functions: add $DNSIsResolving 2020-05-26 23:33:49 +02:00
Christian Hesse
856c879fd8 packages-update: accept lower and upper case characters 2020-05-26 22:59:50 +02:00
Christian Hesse
bcf57f0adb check-routeros-update: accept lower and upper case characters 2020-05-26 22:59:14 +02:00
Christian Hesse
83a8743879 global-functions: $WaitTimeSync: replace comment with debug output 2020-05-17 23:41:54 +02:00
Christian Hesse
3179994017 global-functions: $DownloadPackage: replace comment with debug output 2020-05-17 23:40:59 +02:00
Christian Hesse
ce5e34ef9e doc/sms-forward: add a hint on receiving sms 2020-05-17 22:36:30 +02:00
Christian Hesse
a806b37a47 sms-forward: warn and exit if receiving is not enabled 2020-05-17 22:34:17 +02:00
Christian Hesse
255b2a8244 global-functions: $MailServerIsUp: handle resolve errors 2020-05-15 20:34:33 +02:00
Christian Hesse
215bf78ce1 global-functions: $MailServerIsUp: remove duplicate define 2020-05-15 20:31:54 +02:00
Christian Hesse
77338563b7 global-functions: $MailServerIsUp: use prepared value 2020-05-15 20:29:15 +02:00
Christian Hesse
b5d1e7aa83 global-functions: $WaitTimeSync: run rotate-ntp less frequently 2020-05-15 20:23:14 +02:00
Christian Hesse
56b6da71c3 rotate-ntp: log resolve errors 2020-05-15 20:15:20 +02:00
Christian Hesse
12a29d076f global-functions: $WaitTimeSync: failing rotate-ntp is not fatal
Resolving ntp servers fais if internet connectivity is not established.
So this is not fatal, we want to catch error and fall through, then
continue.
2020-05-13 14:07:12 +02:00
Christian Hesse
9e4c6d70a9 doc/gps-track: add hint on coordinate format 2020-05-11 14:03:04 +02:00
Christian Hesse
5666006527 README: warn about deprecated commands in presentation 2020-05-04 14:14:42 +02:00
Christian Hesse
07603f1c7b README: expect recent RouterOS
RouterOS 6.43 can be considered obsolete these days.
2020-05-04 14:08:49 +02:00
Christian Hesse
378a1785f4 global-functions: $ScriptInstallUpdate: log when reloading code 2020-05-04 11:06:02 +02:00
Christian Hesse
ce4d332f55 global-functions: $DownloadPackage: support downloading bundle 2020-05-04 09:21:23 +02:00
Christian Hesse
59ba87d30e doc/early-errors: also install global-wait 2020-04-28 15:02:14 +02:00
Christian Hesse
8f44e0e0a7 doc/bridge-port: add command to install global-wait 2020-04-28 15:01:14 +02:00
Christian Hesse
1bce625ca9 early-errors: ... and exclude dns messages
Using DoH (DNS over HTTPS) results in a number of error messages before
network becomes available:

dns;error DoH server connection error: Network is unreachable

Exclude these.
2020-04-24 23:34:39 +02:00
Christian Hesse
fee2c4d4ad early-errors: ... but exclude e-mail messages
Most likely these are just error and critical messages failed sending anyway.
2020-04-24 23:34:39 +02:00
Christian Hesse
7c288c6203 early-errors: also include critical messages 2020-04-24 23:22:14 +02:00
Christian Hesse
940c1e9381 early-errors: get errors into array 2020-04-24 23:22:14 +02:00
Christian Hesse
0a48f37918 doc/mode-button: the reset button can do the same
... starting with RouterOS 6.47beta60.
2020-04-24 20:47:47 +02:00
Christian Hesse
29315c7377 INITIAL-COMMANDS: use function to rename certificates 2020-04-24 14:55:41 +02:00
Christian Hesse
85f9c5d62e check-certificates: exclude issued certificates on SCEP server 2020-04-24 14:38:29 +02:00
Christian Hesse
1e12c0e159 check-certificates: always use parenthesis 2020-04-24 13:49:50 +02:00
Christian Hesse
8f03a856e1 check-certificates: add missing blank 2020-04-24 12:19:14 +02:00
Christian Hesse
14dd16ef5a global-functions: $CertificateNameByCN: replace apostrophe 2020-04-24 11:09:02 +02:00
Christian Hesse
b67712cfe4 global-functions: add $WaitDefaultRouteReachable 2020-04-22 22:21:06 +02:00
Christian Hesse
999763a263 global-functions: add $DefaultRouteIsReachable 2020-04-22 22:20:42 +02:00
Christian Hesse
d6ce774fd8 global-functions: $TimeIsSync: unbreak with bundled ntp client 2020-04-22 10:08:23 +02:00
Christian Hesse
c8770efd72 add script 'early-erros' 2020-04-19 00:11:01 +02:00
Christian Hesse
aedc314519 check-routeros-update: update notification wording 2020-04-07 21:51:41 +02:00
Christian Hesse
06c8f279f8 check-lte-firmware-upgrade: give current and available version 2020-04-07 21:51:41 +02:00
Christian Hesse
fe8820d7d5 doc/capsman-rolling-upgrade: explain what happens 2020-04-07 13:30:27 +02:00
Christian Hesse
d87f5899c2 doc/capsman-download-packages: document how to download packages 2020-04-07 13:23:34 +02:00
Christian Hesse
96598b2d34 global-functions: $DownloadPackage: do not re-download 2020-04-07 12:54:46 +02:00
Christian Hesse
2cd8a56aa7 capsman-download-packages: create package path 2020-04-06 12:46:46 +02:00
Christian Hesse
289fd215c4 mode-button-event: use $LogPrintExit 2020-04-03 17:32:19 +02:00
Christian Hesse
413287586f upload-backup: use $LogPrintExit 2020-04-03 17:30:51 +02:00
Christian Hesse
03ae65c5f1 cloud-backup: use $LogPrintExit 2020-04-03 17:30:00 +02:00
Christian Hesse
1f1fef9fb5 check-health: use $LogPrintExit 2020-04-03 17:29:08 +02:00
Christian Hesse
b2d1b64bd2 capsman-rolling-upgrade: use $LogPrintExit 2020-04-03 17:26:35 +02:00
Christian Hesse
b17ca4bb63 mode-button-scheduler: use $LogPrintExit 2020-04-03 17:23:33 +02:00
Christian Hesse
93e72b5d07 packages-update: use $LogPrintExit 2020-04-03 17:22:03 +02:00
Christian Hesse
972a481faa sms-forward: use $LogPrintExit 2020-04-03 17:20:56 +02:00
Christian Hesse
ee903e263f check-lte-firmware-upgrade: use $LogPrintExit 2020-04-03 17:19:34 +02:00
Christian Hesse
d2b1f036ca update-gre-address: use $LogPrintExit 2020-04-03 17:18:05 +02:00
Christian Hesse
0045690459 gps-track: use $LogPrintExit 2020-04-03 17:16:42 +02:00
Christian Hesse
df177212d1 global-functions: $SendTelegram: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
af77645174 global-functions: $SendEMail: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
6f354c8bb0 global-functions: $ScriptFromTerminal: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
9c3ce55ee4 global-functions: $MailServerIsUp: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
596fb5f835 global-functions: $CertificateDownload: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
7cdeb9185e global-functions: $CertificateAvailable: use $LogPrintExit 2020-04-03 16:59:10 +02:00
Christian Hesse
324f5b0ba4 global-functions: $SendTelegram: check status of certificate download 2020-04-03 15:03:27 +02:00
Christian Hesse
e963e09114 global-functions: $GetMacVendor: check status of certificate download 2020-04-03 15:03:27 +02:00
Christian Hesse
abb97601ce global-functions: $DownloadPackage: check status of certificate download 2020-04-03 15:03:27 +02:00
Christian Hesse
151630b674 check-certificates: warn about missing chain 2020-04-03 14:36:32 +02:00
Christian Hesse
a304a2fa69 update-tunnelbroker: check status of certificate download
Also use $LogPrintExit...
2020-04-03 14:29:31 +02:00
Christian Hesse
dfeaa1ed41 global-functions: $Certificate{Available,Download}: return and check status 2020-04-03 14:24:24 +02:00
Christian Hesse
c1c8d46dc0 check-certificates: check and download certificate chain 2020-04-03 14:12:09 +02:00
Christian Hesse
afd33b8e25 global-functions: $ScriptInstallUpdate: log and print changes 2020-04-01 11:38:25 +02:00
Christian Hesse
da581dedbf add navigation links for initial commands page 2020-03-31 14:34:01 +02:00
Christian Hesse
a598cca2da global-functions: $SendTelegram: always return a value
... overwise it opens a prompt "value:".
2020-03-31 13:35:59 +02:00
Christian Hesse
40970fb738 global-functions: $SendEMail: always return a value
... overwise it opens a prompt "value:".
2020-03-31 13:34:30 +02:00
Christian Hesse
e33b4af433 global-functions: $ScriptInstallUpdate: ignore empty scripts
Now that script-updates is gone we support installing new scripts with
$ScriptInstallUpdate only.
2020-03-31 12:58:13 +02:00
Christian Hesse
04460debfc script-updates: fix syntax error 2020-03-31 12:51:37 +02:00
Christian Hesse
4d0b3b0780 add links GitHub batches 2020-03-30 16:30:25 +02:00
Christian Hesse
cc69e5ada7 add GitHub batches from shields.io
https://shields.io/category/social
2020-03-30 16:18:47 +02:00
Christian Hesse
2363f75e7f ask for GitHub and GitLab stars 2020-03-27 22:19:33 +01:00
Christian Hesse
54a8f2839d Merge branch 'documentation' 2020-03-27 22:15:43 +01:00
Christian Hesse
1d93e92dcd Notify about new documentation! 2020-03-27 22:12:49 +01:00
Christian Hesse
c6389f5d2c README: add section 'Available Scripts' and link documentation 2020-03-27 22:12:49 +01:00
Christian Hesse
070ae8ecb5 link global-{config,config-overlay,functions} to main README 2020-03-27 22:12:49 +01:00
Christian Hesse
c32a727b6e add doc/upload-backup.md 2020-03-27 22:12:49 +01:00
Christian Hesse
3f6539da4c add doc/update-tunnelbroker.md 2020-03-27 22:12:49 +01:00
Christian Hesse
a2b009502f add doc/update-gre-address.md 2020-03-27 22:12:49 +01:00
Christian Hesse
f45dbb3a73 add doc/unattended-lte-firmware-upgrade.md 2020-03-27 22:12:49 +01:00
Christian Hesse
1e5784225a add doc/super-mario-theme.md 2020-03-27 22:12:49 +01:00
Christian Hesse
997ef3bf23 add doc/ssh-keys-import.md 2020-03-27 22:12:49 +01:00
Christian Hesse
e8bc0a7169 add doc/sms-forward.md 2020-03-27 22:12:49 +01:00
Christian Hesse
ed2718da2a add doc/sms-action.md 2020-03-27 22:12:49 +01:00
Christian Hesse
747af21bea add doc/rotate-ntp.md 2020-03-27 22:12:49 +01:00
Christian Hesse
15995b495f add doc/ppp-on-up.md 2020-03-27 22:12:49 +01:00
Christian Hesse
d075cce0ef add doc/packages-update.md 2020-03-27 22:12:49 +01:00
Christian Hesse
222fe8fd54 add doc/netwatch-syslog.md 2020-03-27 22:12:49 +01:00
Christian Hesse
f482c565c7 add doc/netwatch-notify.md 2020-03-27 22:12:49 +01:00
Christian Hesse
5594ffd69a add doc/mode-button.md 2020-03-27 22:12:49 +01:00
Christian Hesse
8c3489761e add doc/leds-mode.md 2020-03-27 22:12:49 +01:00
Christian Hesse
e1377cbd92 add doc/lease-script.md 2020-03-27 22:12:49 +01:00
Christian Hesse
024e9c97a1 add doc/ipv6-update.md 2020-03-27 22:12:49 +01:00
Christian Hesse
b20fcaa94d add doc/ip-addr-bridge.md 2020-03-27 22:12:49 +01:00
Christian Hesse
39857405d5 add doc/hotspot-to-wpa.md 2020-03-27 22:12:49 +01:00
Christian Hesse
cba9352fc4 add doc/gps-track.md 2020-03-27 22:12:49 +01:00
Christian Hesse
2e0e83d136 add doc/global-wait.md 2020-03-27 22:12:49 +01:00
Christian Hesse
8b724a9b5a add doc/email-backup.md 2020-03-27 22:12:49 +01:00
Christian Hesse
e0346bf60e add doc/dhcp-to-dns.md 2020-03-27 22:12:49 +01:00
Christian Hesse
c9b7139859 add doc/dhcp-lease-comment.md 2020-03-27 22:12:49 +01:00
Christian Hesse
e949e527f6 add doc/daily-psk.md 2020-03-27 22:12:49 +01:00
Christian Hesse
79e7b3229f add doc/collect-wireless-mac.md 2020-03-27 22:12:49 +01:00
Christian Hesse
d1bba48cc7 add doc/cloud-backup.md 2020-03-27 22:12:49 +01:00
Christian Hesse
c1dcc28028 add doc/check-routeros-update.md 2020-03-27 22:12:49 +01:00
Christian Hesse
969ae57fc2 add doc/check-lte-firmware-upgrade.md 2020-03-27 22:12:49 +01:00
Christian Hesse
ff867d1b6b add doc/check-health.md 2020-03-27 22:12:49 +01:00
Christian Hesse
e962fe9189 add doc/check-certificates.md 2020-03-27 22:12:49 +01:00
Christian Hesse
d08a342f06 add doc/certificate-renew-issued.md 2020-03-27 22:12:49 +01:00
Christian Hesse
77c1f6fd63 add doc/capsman-rolling-upgrade.md 2020-03-27 22:12:49 +01:00
Christian Hesse
74d192cf53 add doc/capsman-download-packages.md 2020-03-27 22:12:49 +01:00
Christian Hesse
60a21e11b0 add doc/bridge-port.md 2020-03-27 22:12:49 +01:00
Christian Hesse
b2f81f7cad add doc/accesslist-duplicates.md 2020-03-27 22:12:49 +01:00
Christian Hesse
1d580c39f9 drop doc/template.md 2020-03-27 21:38:28 +01:00
Christian Hesse
a87fbb4be1 start news items with capital letter 2020-03-26 14:22:10 +01:00
Christian Hesse
0d6bdd4eb1 README: unify markup 2020-03-26 07:53:44 +01:00
Christian Hesse
524cc29e99 check-health: add fancy unicode symbols 2020-03-24 12:38:03 +01:00
Christian Hesse
0229516bb5 check-routeros-update: add fancy unicode symbol 2020-03-24 12:35:40 +01:00
Christian Hesse
7e982a470d netwatch-notify: add fancy unicode symbols
https://www.compart.com/de/unicode/block/U+2700
2020-03-24 12:28:06 +01:00
Christian Hesse
111e339d06 netwatch-notify: report the number of checks a host was down 2020-03-24 12:12:00 +01:00
Christian Hesse
5f46ef7635 completely replace script-updates with $ScriptInstallUpdate 2020-03-23 14:01:20 +01:00
Christian Hesse
1282a91f04 check-certificates: exclude certificates issued by SCEP 2020-03-20 22:03:31 +01:00
Christian Hesse
1cde38e2da move template to sub directory 2020-03-20 12:58:47 +01:00
Christian Hesse
f16056ef8b convert initial commands from script to page
This is not intended for installation...
2020-03-20 12:51:28 +01:00
Christian Hesse
8a88743e9f add certificate 'DigiCert ECC Secure Server CA'
This is used by DNS over HTTPS services:

https://cloudflare-dns.com/dns-query
https://dns9.quad9.net/dns-query (secured)
https://dns10.quad9.net/dns-query (unsecured)

https://github.com/curl/curl/wiki/DNS-over-HTTPS
2020-03-20 12:07:11 +01:00
Christian Hesse
1e7e19cc87 certificate-renew-issued: log action 2020-03-20 09:26:12 +01:00
Christian Hesse
739884ecc7 certificate-renew-issued: support auto-export with given passphrases 2020-03-20 09:26:12 +01:00
Christian Hesse
f50e416e49 global-functions: introduce $MkDir
This is a dirty hack... RouterOS does not support creating directories,
so we mis-use http server and fetch tool.
2020-03-20 09:26:12 +01:00
Christian Hesse
98585afe1c add script 'global-wait'
Run this in schedulers that fire on startup without interval. Schedulers
should look something like this:

/ system scheduler {
  add name=global-scripts on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }" start-time=startup;
  add name=bridge-port-to-default on-event="/ system script { run global-wait; run bridge-port-to-default; }" start-time=startup;
}
2020-03-12 08:40:29 +01:00
Christian Hesse
63ed093340 check-health: add encoded degree sign 2020-03-09 16:23:10 +01:00
Christian Hesse
1f8c22b23d hotspot-to-wpa: unbreak options 2020-03-09 13:46:06 +01:00
Christian Hesse
8992b18166 global-functions: $DeviceInfo: more indention 2020-03-09 09:29:36 +01:00
Christian Hesse
8020955b3b script-updates: also consider scripts with empty source for update 2020-03-05 20:09:36 +01:00
Christian Hesse
f3e2fb654b netwatch-notify: add logging 2020-03-05 12:47:42 +01:00
Christian Hesse
9aed03693c netwatch-notify: fix handling of array
Looks like handling of more-dimensional arrays is a bit tricky in
RouterOS... Without this *all* values with the same key name are
updated, independent of intermediate name.
2020-03-05 12:42:21 +01:00
Christian Hesse
3d07ebde05 global-functions: $SendEMail: invert condition 2020-03-05 11:00:36 +01:00
Christian Hesse
227151e189 global-functions: $SendTelegram: invert condition 2020-03-05 11:00:36 +01:00
Christian Hesse
34db2e34db global-functions: $SendTelegram: allow to override chatid
This allows to send Telegram messages to different contact or group.
Use something like this:

/system scheduler add name=netwatch-notify interval=1m start-time=startup \
  on-event=":global TelegramChatIdOverride \"-1234\"; / system script run netwatch-notify; :set TelegramChatIdOverride;"
2020-03-05 10:54:48 +01:00
Christian Hesse
71ae8cb75f rotate-ntp: use $LogPrintExit 2020-03-05 09:42:28 +01:00
Christian Hesse
27e2635007 bridge-port-to-default: use $LogPrintExit for debug 2020-03-05 09:24:10 +01:00
Christian Hesse
bf41a8d48a always use severity 'warning', not just 'warn' 2020-03-05 09:18:23 +01:00
Christian Hesse
e104b54bf0 hotspot-to-wpa: use $LogPrintExit and add more logging 2020-03-05 09:17:19 +01:00
Christian Hesse
970641a974 check-routeros-update: use $LogPrintExit 2020-03-05 09:08:57 +01:00
Christian Hesse
08bb73b6fc check-certificates: use $LogPrintExit for debug 2020-03-05 09:01:11 +01:00
Christian Hesse
34255c9050 script-updates: use $LogPrintExit for debug 2020-03-05 08:58:29 +01:00
Christian Hesse
3ec34fa752 dhcp-to-dns: fix value in message 2020-03-05 08:43:56 +01:00
Christian Hesse
554308a399 dhcp-to-dns: use $LogPrintExit 2020-03-05 08:37:12 +01:00
Christian Hesse
be5b6e0687 dhcp-lease-comment: use $LogPrintExit 2020-03-05 08:34:33 +01:00
Christian Hesse
3127800496 daily-psk: use $LogPrintExit 2020-03-05 08:26:05 +01:00
Christian Hesse
1dbd91f76d collect-wireless-mac: use $LogPrintExit 2020-03-05 08:22:47 +01:00
Christian Hesse
f90c59e4fb netwatch-notify: properly initialize default values 2020-03-05 08:15:36 +01:00
Christian Hesse
792eba8465 global-functions: $LogPrintExit: add debugging option 2020-03-05 08:11:17 +01:00
Christian Hesse
478688d534 netwatch-notify: use another level of array 2020-03-04 21:01:21 +01:00
Christian Hesse
e588607efd add script netwatch-notify 2020-03-04 15:56:40 +01:00
Christian Hesse
628ae1bd70 bridge-port-to-default: use $ParseKeyValueStore...
... and unbreak last commit removing delay (69352c90).
This requires a change in configuration syntax. Change this...

    comment="default:br-local, alt:br-guest"

to...

    comment="default=br-local, alt=br-guest"
2020-03-03 13:32:00 +01:00
Christian Hesse
4ccdec602e bridge-port-to-default: use $LogPrintExit 2020-03-03 08:54:18 +01:00
Christian Hesse
001e7eeb39 global-functions: sort alphabetically 2020-02-28 15:26:26 +01:00
Christian Hesse
3db752bc97 global-functions: $ScriptLock: use $LogPrintExit 2020-02-27 13:51:27 +01:00
Christian Hesse
ceaa83b83e global-functions: merge $LogAnd{Error,Put} to $LogPrintExit ...
... and fix logging.

Logging with severity from variable (:log $severity ...) is not
possible, this is considered a syntax error. Also the 'workaround' with
parsing code failed with missing message in log.

The reliable code is a lot longer, so merge the two functions to save a
lot of duplicate code.
2020-02-26 14:19:54 +01:00
Christian Hesse
6036edb506 packages-update: use $LogAndError 2020-02-26 12:58:49 +01:00
Christian Hesse
3cd9b9ead5 check-certificates: use $LogAndPut 2020-02-26 12:55:38 +01:00
Christian Hesse
b70a460f43 check-certificates: use $LogAndError 2020-02-26 12:54:13 +01:00
Christian Hesse
d516b1b249 script-updates: use $LogAndPut 2020-02-26 12:15:07 +01:00
Christian Hesse
312caf3f90 global-functions: introduce $LogAndPut 2020-02-26 12:11:50 +01:00
Christian Hesse
3ebf68a08c global-functions: $LogAndError: add severity 2020-02-26 12:09:19 +01:00
Christian Hesse
6ef764c7d7 hotspot-to-wpa: automatically add missing access-list entry 2020-02-26 11:51:49 +01:00
Christian Hesse
0e6438eaff upload-backup: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
c766d2dfda update-tunnelbroker: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
86ed56e7ad email-backup: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
286d7ced11 ipv6-update: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
801608eeaf check-certificates: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
0326a7222c lease-script: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
7ec411c542 sms-action: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
f1ab717ae5 ppp-on-up: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
1d93bcbc0d check-routeros-update: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
9b9ad20b3d packages-update: use $LogAndError 2020-02-26 11:51:49 +01:00
Christian Hesse
bb9a4e6ecf sms-forward: use $LogAndError 2020-02-26 11:49:11 +01:00
Christian Hesse
556fc2d0d3 global-functions: introduce $LogAndError 2020-02-24 19:53:15 +01:00
Christian Hesse
69352c90d5 bridge-port-to-default: drop delay
Now that we expect the scheduler to have a delay and script-updates
warning about it...
2020-02-24 19:47:17 +01:00
Christian Hesse
5316ec6ef5 script-updates: warn on scheduler at startup with no interval 2020-02-24 19:43:35 +01:00
Christian Hesse
125f37615b drop script 'daily-psk-schedule'
We have some useful functions that can replace the functionality. Just
add a schedule like this:

add name=daily-psk-startup on-event=":delay 1s; :global WaitTimeSync; \$WaitTimeSync; / system script run daily-psk.local;" start-time=startup
2020-02-24 13:01:45 +01:00
Christian Hesse
19b80ee063 global-functions: $WaitTimeSync: rotate ntp servers minutely
Signed-off-by: Christian Hesse <mail@eworm.de>
2020-02-24 13:01:45 +01:00
Christian Hesse
5fab77abad global-functions: introduce $WaitTimeSync 2020-02-24 12:55:18 +01:00
Christian Hesse
2a80fd6dbe check-certificates: check for synced time 2020-02-24 11:14:49 +01:00
Christian Hesse
6e8f5f19f6 daily-psk-schedule: use $TimeIsSync 2020-02-24 11:08:11 +01:00
Christian Hesse
77ec3293f0 global-functions: introduce $TimeIsSync 2020-02-24 11:06:17 +01:00
Christian Hesse
4984b4fd51 daily-psk-schedule: use $MailServerIsUp 2020-02-24 10:48:41 +01:00
Christian Hesse
e11ddeaf8c sms-forward: use $MailServerIsUp 2020-02-24 10:48:24 +01:00
Christian Hesse
7d2239f24e global-functions: introduce $MailServerIsUp 2020-02-24 10:48:04 +01:00
Christian Hesse
23fe30c4e1 check-certificates: rename all certificates by their common names 2020-02-06 18:18:56 +01:00
Christian Hesse
e376845b12 global-functions: introduce and use $CertificateNameByCN 2020-02-06 18:18:56 +01:00
Christian Hesse
38b23ddc10 script-updates: prefix variable name with dollar 2020-02-05 17:09:30 +01:00
Christian Hesse
b5f4c2c87e global-config: drop $ScriptUpdatesConfigChangesIgnore
Comment or remove $GlobalConfigVersion in global-config-overlay
to disable change notifications.
2020-02-04 20:19:46 +01:00
Christian Hesse
03af7d6d9c global-functions: $CharacterReplace: do not limit string length
I've tried something like this to update a device:

/ system script set source=[ $CharacterReplace [ get global-config-overlay source ] "GlobalConfigVersion 10" "GlobalConfigVersion 11" ] global-config-overlay;

This broke with global-config-overlay longer than 999 characters. So makes
sure there is no limit for string length.
2020-02-03 21:29:21 +01:00
Christian Hesse
0c705d5311 global-config-overlay: add footer
... to guard against truncation by accident.
2020-02-03 09:29:53 +01:00
Christian Hesse
7f81734006 global-functions: $CertificateAvailable: simplify loop 2020-02-02 15:16:36 +01:00
Christian Hesse
1e72f03e5e README: update instructions to use $ScriptInstallUpdate 2020-01-29 22:14:56 +01:00
Christian Hesse
833e72eac8 script-updates: only handle scripts with magic pattern
This is supposed to prevent overwriting foreign scripts. New scripts are
expected to be installed with function $ScriptInstallUpdate!
2020-01-29 21:44:41 +01:00
Christian Hesse
c500243c97 global-functions: add $ScriptInstallUpdate
Just call without parameters to update scripts:

[admin@MikroTik] > $InstallAndUpdate

Add comma separated list of scripts to install and update:

[admin@MikroTik] > $InstallAndUpdate cloud-backup[,upload-backup][,...]
2020-01-29 21:44:41 +01:00
Christian Hesse
352818ea48 global-functions: $CertificateAvailable: check whole chain
The root certificate is a self-signed certificate. Check for the issue
certificate until we find the self-signed one.
2020-01-29 21:08:10 +01:00
Christian Hesse
801dce05fa global-functions: $CertificateAvailable: warn about crl download to flash
Downloading certificate crls to flash can fill up all available space.
So warn about it!
2020-01-29 09:27:00 +01:00
Christian Hesse
74f6449e8a update-tunnelbroker: replace deprecated keep-result=no with output=none 2020-01-28 21:52:29 +01:00
Christian Hesse
639011a9ba gps-track: replace deprecated keep-result=no with output=none 2020-01-28 21:52:15 +01:00
Christian Hesse
5741924cf9 global-functions: replace deprecated keep-result=no with output=none 2020-01-28 21:51:27 +01:00
Christian Hesse
c7034ca5af check-health: never divide, always multiply
With RouterOS we have integral numbers only. This prevent from having
friction that is cut off.
2020-01-24 08:17:42 +01:00
Christian Hesse
6e5e0e72bd check-health: always calculate on the lower voltage value
This makes sure an alert is triggered in both directions. Before we could have:

24.0V to 21.8V -> OK
21.8V to 24.0V -> Alert!
2020-01-24 08:16:54 +01:00
Christian Hesse
958bfa7ce8 collect-wireless-mac: automatically add missing access-list entry 2020-01-17 10:36:03 +01:00
Christian Hesse
12da4de305 check-routeros-update: do not act if reboot is scheduled 2020-01-16 16:11:50 +01:00
Christian Hesse
08c90c95b7 mode-button-scheduler: give proper message if no action defined 2020-01-06 10:33:27 +01:00
Christian Hesse
b3a76c7e4b global-functions: $CertificateDownload: properly name new certificates 2020-01-06 10:20:19 +01:00
Christian Hesse
aa885e17e2 collect-wireless-mac: use dynamic & bound mac address only 2020-01-06 09:47:32 +01:00
Christian Hesse
bb7c4ef0d9 dhcp-lease-comment: act on bound leases only 2020-01-06 09:42:00 +01:00
Christian Hesse
0560f828d1 dhcp-to-dns: act on bound leases only 2020-01-06 09:40:24 +01:00
Christian Hesse
cf79e6c473 global-functions: do not encode dash, dot, slash and underscore 2020-01-03 11:24:12 +01:00
Christian Hesse
b1b7ed83ed global-functions: $Certificate*: add quoting around CN 2020-01-03 10:15:34 +01:00
Christian Hesse
cb1e520965 global-functions: split $CertificateAvailable to $CertificateDownload
This allows to force download even if certificate is available. We need
this for a clean update path with Let's Encrypt.
2020-01-03 10:07:55 +01:00
Christian Hesse
afb9839073 update copyright for 2020 2020-01-01 17:00:39 +01:00
Christian Hesse
f9c9d67cc9 packages-update: improve wording 2019-12-20 14:38:42 +01:00
Christian Hesse
d064bd349e global-functions: define first, set later 2019-12-10 14:45:35 +01:00
Christian Hesse
64341690bf global-functions: $DownloadPackage: retry on error 2019-12-05 13:20:26 +01:00
Christian Hesse
7365bfa525 packages-update: lock against multiple invocation 2019-12-05 11:41:49 +01:00
Christian Hesse
3db466f476 capsman-rolling-upgrade: lock against multiple invocation 2019-12-05 11:41:49 +01:00
Christian Hesse
b8db93918f capsman-download-packages: lock against multiple invocation 2019-12-05 11:41:49 +01:00
Christian Hesse
9548641b60 packages-update: skip the interactive part of non-terminal 2019-12-04 09:21:07 +01:00
Christian Hesse
f26222d5a8 check-routeros-update: use $ScriptFromTerminal 2019-12-03 23:45:55 +01:00
Christian Hesse
ebd5ff9bfe global-functions: introduce $ScriptFromTerminal
Checking whether or not started from terminal is tricky... We have to find
the job for the script, find its top most parent and get its type.
2019-12-03 23:45:55 +01:00
Christian Hesse
bccdb47fde ipv6-update: calculate address with bitwise operator
Support for bitwise operator was added in RouterOS 6.46beta38.
2019-12-03 12:07:36 +01:00
Christian Hesse
e37af0065c hotspot-to-wpa: get limits from place-before-entry 2019-12-03 11:41:18 +01:00
Christian Hesse
ac6c132ea0 global-functions: $DeviceInfo: append revision to model 2019-11-28 10:49:21 +01:00
Christian Hesse
a8a0523d33 collect-wireless-mac: add the dns name 2019-11-25 17:07:45 +01:00
Christian Hesse
15a6fb325e collect-wireless-mac: lease without address should be impossible...
... we need the check for empty hostname, though.
2019-11-25 16:43:19 +01:00
Christian Hesse
b70d4f7666 collect-wireless-mac: move code into condition 2019-11-25 16:39:23 +01:00
Christian Hesse
73a3e58c8f {email,upload}-backup: update wording 2019-11-21 22:22:04 +01:00
Christian Hesse
845c25f87c dhcp-to-dns: act on hostname only if available 2019-11-14 22:16:33 +01:00
Christian Hesse
395bc8c90f dhcp-to-dns: set the temporary variable unconditionally 2019-11-12 13:02:40 +01:00
Christian Hesse
91776d3388 dhcp-to-dns: handle duplicate mac-address and host-name
* several leases for one mac address (changed client id, different net):
   -> take address from last lease
  Most likely this is the same devices which booted different OS or
  changed to different network.

* several leases for one host name:
   -> take address from first lease
  We see either different devices with same name or one device with
  several network interfaces. Keep the first name to mitigate stealing
  dns name.
2019-11-12 12:49:28 +01:00
Christian Hesse
9d5c566b1c check-certificates: make renew notification silent 2019-11-11 20:47:11 +01:00
Christian Hesse
c93c6e1934 README: fix typo and wording 2019-11-05 00:28:30 +01:00
Christian Hesse
7c0c27c03f global-functions: add architecture in device info 2019-10-28 13:15:10 +01:00
Christian Hesse
df0c2afa31 check-health: decrease default threshold for voltage 2019-10-22 15:03:52 +02:00
Christian Hesse
39815662f7 check-health: work with battery property
Seen on wAP R... No idea what this is.
2019-10-18 12:25:27 +02:00
Christian Hesse
9ce5d722b3 add script 'hotspot-to-wpa' 2019-10-14 21:24:35 +02:00
Christian Hesse
f40bb2c8c8 check-health: make threshold for voltage configurable 2019-10-14 19:13:31 +02:00
Christian Hesse
09ce75c5b1 update list of contributors / donors
Thanks for the Mikrotik coffee mug!
2019-09-13 11:45:38 +02:00
Christian Hesse
1cee36a911 introduce global-config-overlay 2019-09-12 21:29:41 +02:00
Michael Gisbers
2258087aab global-functions: $DeviceInfo: handle configuration version 2019-09-12 21:29:41 +02:00
Christian Hesse
94581741f4 global-functions: introduce and use $DeviceInfo 2019-09-12 21:29:41 +02:00
Christian Hesse
23b38fa15a dhcp-to-dns: find duplicate leases by mac-address 2019-09-11 12:36:47 +02:00
Christian Hesse
c7c5da2eca README: add just one scheduler for global scripts 2019-09-11 12:36:47 +02:00
Christian Hesse
a7c498a90e update list of contributors / donors
Thanks a lot!
2019-09-11 12:36:47 +02:00
Christian Hesse
c8d6c4597f packages-update: add random delay for scheduler 2019-09-11 12:36:24 +02:00
Christian Hesse
ecc281446c packages-update: add option to schedule reboot 2019-09-02 09:39:19 +02:00
Christian Hesse
166bbffe1d script-updates: add donation hint in configuration warning notification 2019-08-30 14:10:58 +02:00
Christian Hesse
c7563d4ffd add info about past contributions 2019-08-30 13:43:35 +02:00
Christian Hesse
914e535eea README: add contribute section, including donate option 2019-08-30 13:43:35 +02:00
Christian Hesse
05f2d03ad9 use shorter url for my repository 2019-08-30 13:43:21 +02:00
Christian Hesse
8c8d7f93f1 ipv6-update: get values into array
... and concatenate name and regexp - just either of both is set.
2019-08-30 11:03:43 +02:00
Christian Hesse
f559c4ac92 unattended-lte-firmware-upgrade: add valid script to scheduler 2019-08-30 11:03:43 +02:00
Christian Hesse
03db080774 mode-button-event: add valid script to scheduler 2019-08-30 11:03:43 +02:00
Christian Hesse
e479f3b01a README: add valid script to scheduler 2019-08-30 11:03:43 +02:00
Christian Hesse
1ee3213e02 script-updates: better regex matching 2019-08-29 09:13:11 +02:00
Christian Hesse
2d1a07dd0f capsman-rolling-upgrade: do not fail on missing cap
This is a long running process, chances are that a cap disappears
intermittently. So find cap by name and do not fail.
2019-08-29 07:54:00 +02:00
Christian Hesse
63ca79b960 check-health: check for valid psu state data
This is required with recovery notifications
2019-08-28 20:48:32 +02:00
Christian Hesse
b74d465cd0 check-health: also send recovery notifications 2019-08-27 15:20:11 +02:00
Christian Hesse
29dc1b8841 add script 'check-health'
This may be incomplete... Please report if you have missing PSUs,
ttemperature sensors, whatever.
2019-08-27 12:01:32 +02:00
Christian Hesse
44437c6846 upload-backup: make notification silent 2019-08-18 21:30:59 +02:00
Christian Hesse
0f27c935d8 cloud-backup: make notification silent 2019-08-18 21:30:59 +02:00
Christian Hesse
5a3076c7c3 check-routeros-update: make notifications silent 2019-08-18 21:30:59 +02:00
Christian Hesse
a78d9d0470 check-lte-firmware-upgrade: make notification silent 2019-08-18 21:30:59 +02:00
Christian Hesse
06b93ca6c2 global-functions: support sending silent telegram notifications 2019-08-18 21:30:59 +02:00
Christian Hesse
d457421e1e global-functions: split off $SendEMail and $SendTelegram 2019-08-18 21:30:59 +02:00
Christian Hesse
4210a49098 check-routeros-update: fail on empty version string 2019-08-08 20:27:11 +02:00
Christian Hesse
dcd47d8ac4 sms-forward: add sender in subject 2019-08-08 16:15:10 +02:00
Christian Hesse
5408ba008a sms-forward: fix array access in condition 2019-08-05 10:32:19 +02:00
Christian Hesse
67f4b135f5 capsman-download-packages: syntax error with missing parenthesis 2019-08-02 15:22:17 +02:00
Christian Hesse
ab4aef4dfb global-functions: $DownloadPackage: re-introduce check for valid package
Even if fetch tool does its job right now... Chances are that the
download servers have corrupted or empty files.
2019-08-01 18:45:54 +02:00
Christian Hesse
70798de8f0 check-certificates: fix renewing certificate in place 2019-07-31 21:04:06 +02:00
Christian Hesse
acce2322c3 global-functions: add $RandomDelay 2019-07-26 18:14:33 +02:00
Christian Hesse
f49b67f5e7 global-functions: add $GetRandom 2019-07-26 18:13:59 +02:00
Christian Hesse
25a22e2e1c script-updates: get source from array 2019-07-25 21:19:10 +02:00
Christian Hesse
1c4dfeaa4a sms-forward: get values into arrays 2019-07-25 14:24:18 +02:00
Christian Hesse
cc9b2620e7 update-tunnelbroker: get values into array 2019-07-25 14:22:08 +02:00
Christian Hesse
d9d98cfe9e script-updates: get values into arrays 2019-07-25 13:12:17 +02:00
Christian Hesse
8d4dc1e3f6 dhcp-to-dns: get values into arrays, general rework 2019-07-25 12:55:11 +02:00
Christian Hesse
46fee70a56 dhcp-lease-comment: get values into array 2019-07-25 10:47:45 +02:00
Christian Hesse
e7dffe0a82 capsman-download-packages: get values into array 2019-07-25 10:35:15 +02:00
Christian Hesse
be133146dd cloud-backup: do not remove but replace cloud backup
The replace functionality for cloud backup is available
with version 6.45beta42.
2019-07-24 23:42:28 +02:00
Christian Hesse
39eef1a0b1 upload-backup: get values into array 2019-07-24 11:13:53 +02:00
Christian Hesse
5789b8d984 cloud-backup: get values into array 2019-07-24 11:12:52 +02:00
Christian Hesse
32cc5d1078 email-backup: get values into array 2019-07-24 11:11:57 +02:00
Christian Hesse
21996dfcaf check-routeros-update: get values into array 2019-07-24 11:10:47 +02:00
Christian Hesse
55313b4841 upload-backup: get values into array 2019-07-24 11:06:50 +02:00
Christian Hesse
1020db0b31 cloud-backup: get values into array 2019-07-24 11:05:44 +02:00
Christian Hesse
5f59211168 email-backup: get values into array 2019-07-24 11:04:31 +02:00
Christian Hesse
9e3ee77a4a check-routeros-update: get values into array 2019-07-24 11:01:45 +02:00
Christian Hesse
6699545157 packages-update: allow to downgrade on change of update channel 2019-07-24 10:49:51 +02:00
Christian Hesse
7fe0938f86 packages-update: break if latest version is unknown 2019-07-24 10:22:37 +02:00
Christian Hesse
3aa4d7ea50 packages-update: get values into array 2019-07-24 10:13:39 +02:00
Christian Hesse
229dc539cc global-functions: $DownloadPackage: fix downloading for CHR / x86_64 2019-07-19 15:37:01 +02:00
Christian Hesse
1e075d8d64 packages-update: run email-backup and/or upload-backup 2019-07-19 11:46:29 +02:00
Christian Hesse
8d1313f588 add script 'upload-backup' 2019-07-19 11:46:29 +02:00
Christian Hesse
26f01b238b global-config: move config for email-backup
Signed-off-by: Christian Hesse <mail@eworm.de>
2019-07-19 11:46:29 +02:00
Christian Hesse
431a4c8176 email-backup: no more than one dot in file name
Looks like some providers do not allow more than one dot in attachment's
file name to mitigate something like `holiday.png.exe`.

Let's just replace dots with underscores.

Fixes #2

Reported-by: @Kampfwurst
2019-07-18 14:43:13 +02:00
Christian Hesse
e309dee3b1 capsman-download-packages: do not require extra permission
The idea was to run capsman-download-packages from netwatch when
upgrade.mikrotik.com is up.

Instead run it from scheduler at startup, but add a delay:

/ system scheduler add name=capsman-download-packages \
    on-event=":delay 2m; capsman-download-packages" start-time=startup
2019-07-18 14:00:53 +02:00
Christian Hesse
b68f5ebc86 daily-psk-schedule: better matching 2019-07-18 13:50:01 +02:00
Christian Hesse
5d12be36d7 update-tunnelbroker: use $ParseKeyValueStore 2019-07-18 13:50:01 +02:00
Christian Hesse
beb2e70097 check-certificates: use $ParseKeyValueStore 2019-07-18 13:50:01 +02:00
Christian Hesse
047c0989d8 ipv6-update: use $ParseKeyValueStore 2019-07-18 13:50:01 +02:00
Christian Hesse
f79ba55637 global-functions: add $ParseKeyValueStore 2019-07-17 16:27:21 +02:00
Christian Hesse
16f04ee7ee global-functions: $CharacterReplace: use same condition in loop 2019-07-16 12:46:33 +02:00
Christian Hesse
b1b53e3d0d global-functions: append system note in e-mail signature 2019-07-16 12:42:40 +02:00
Christian Hesse
12af69b443 update-gre-address: handle missing dynamic address 2019-07-10 11:45:20 +02:00
Christian Hesse
13f091e5ae gps-track: remove workaround 2019-07-09 11:19:41 +02:00
Christian Hesse
65c76b8409 capsman-rolling-upgrade: log with info, give identity 2019-07-08 15:49:00 +02:00
Christian Hesse
43d77cb62d lease-script: give hint about mis-usage 2019-07-05 23:38:44 +02:00
Christian Hesse
933db2ddc8 sms-action: give hint about mis-usage 2019-07-05 23:33:45 +02:00
Christian Hesse
15beb92347 ppp-on-up: give hint about mis-usage 2019-07-05 23:21:46 +02:00
Christian Hesse
894ee65675 ipv6-update: give hint about mis-usage 2019-07-05 16:09:49 +02:00
Christian Hesse
1272fe1cb1 update-gre-address: get values into arrays 2019-07-01 11:26:10 +02:00
Christian Hesse
5d0104f0a7 update-gre-address: update for latest routeros
With RouterOS 6.45 "remote-peers" was renamed to "active-peers":

*) ipsec - renamed "remote-peers" to "active-peers";
2019-07-01 10:21:17 +02:00
Christian Hesse
08ef63ddbd check-routeros-update: link a changelog that opens in browser
The old link was delivered with MIME type 'application/octet-stream',
browsers wanted to download it as file.
2019-07-01 09:44:50 +02:00
Christian Hesse
44dd4231cb bridge-port-to-default: handle special value 'dhcp-client'...
... which disables the bridge port, but enables a dhcp client.
2019-06-26 00:07:11 +02:00
Christian Hesse
9d1a59fd64 bridge-port-to-default: get bridge port values into array 2019-06-25 23:06:51 +02:00
Christian Hesse
2f22e06b9b gps-track: fix the condition for workaround
A null byte is always matched in regexp...
2019-06-25 14:32:25 +02:00
Christian Hesse
e9cdf94785 add script 'certificate-renew-issued' 2019-06-24 13:39:45 +02:00
Christian Hesse
5101d57d52 backup: split off cloud-backup
Currently backup to MikroTik cloud is pretty unreliable and script can
not catch errors at runtime. Looks like this does not change any time
soon (Ticket#2019052022003204).

So let's just split off the cloud backup to make sure email backup works
as expected.
2019-06-14 15:13:41 +02:00
Christian Hesse
2252058202 daily-psk: add hint about device specific rule
I tricked myself several times... If a more device specific (or just
earlier matching) rule exists the daily PSK is not applied!
2019-06-13 08:14:03 +02:00
Christian Hesse
44836ccf04 mode-button-scheduler: beep for confirmation
But be silent if silent-boot is enabled.
2019-06-12 20:34:20 +02:00
Christian Hesse
fd2901cd45 daily-psk.capsman: pick only first configuration 2019-05-24 14:26:32 +02:00
Christian Hesse
a2e6362967 check-lte-firmware-upgrade: drop literal 'notification' 2019-05-23 12:19:01 +02:00
Christian Hesse
0c45102798 check-routeros-update: drop literal 'notification' 2019-05-23 12:19:01 +02:00
Christian Hesse
cf3cd89398 check-certificates: get certificate values into array 2019-05-21 13:24:43 +02:00
Christian Hesse
6b603b1e0e gps-track: make workaround conditional
This is fixed in 6.45rc42.
2019-05-09 22:07:09 +02:00
Christian Hesse
a1bad3c0aa email-backup: make sure to act on first cloud backup 2019-05-09 21:20:44 +02:00
Christian Hesse
b7592f6b18 check-certificates: do not try to renew locally issued certificates 2019-05-02 11:59:43 +02:00
Christian Hesse
360d30bf2a check-certificates: give issuer info on locally issued certificates
Certificates issued locally do not have an 'issuer' property, but a
'ca' one. Looks like either of both is filled, so just concatenate.
2019-05-02 11:16:28 +02:00
Christian Hesse
42834e9de1 global-functions: $CertificateAvailable: fetch by CommonName
Now that we have a proper $UrlEncode function... Fetch certificates
by CommonName.

Also remove the PEM after import.
2019-04-30 16:52:53 +02:00
Christian Hesse
7f96e5c966 global-functions: add $WaitForFile, wait for file on fetch
The fetch command is asynchronous, the file is not guaranteed to be
available when command terminates.

I opened an issue at Mikrotik support (Ticket#2019041722004999),
their answer:

> You should perform a check in a loop.
> :delay until file exist
>
> That can happen also with any configuration not just files.

So add a function to wait for a file with given name.

I have not seen this with other configuration, though.
2019-04-30 16:52:53 +02:00
Christian Hesse
9aac873163 daily-psk-schedule: try to rotate ntp after five minutes uptime 2019-04-16 09:29:43 +02:00
Christian Hesse
5273efda21 check-certificates: make sure fingerprint is a string
This makes sure the condition below works for certificate templates,
which do not have a fingerprint.
2019-04-11 22:22:05 +02:00
Christian Hesse
20d7020fe3 check-certificates: do not send notification for templates 2019-04-11 10:19:46 +02:00
Christian Hesse
ea94b7598e check-certificates: always return a string in $GetIssuerCN 2019-04-11 09:57:20 +02:00
Christian Hesse
58c25c8cca check-certificates: add url encoding for certificate download 2019-04-10 14:47:20 +02:00
Christian Hesse
e562825bd9 check-certificates: try to fetch PEM and P12 file 2019-04-10 14:29:24 +02:00
Christian Hesse
5beebbe8e8 check-certificates: use full path...
... to make sure syntax does not break if package is not installed.
2019-04-10 14:29:24 +02:00
Christian Hesse
c0b73d6e92 check-certificates: just change certificates, no loop 2019-04-10 13:59:38 +02:00
Christian Hesse
b93d4d40bc drop deprecated mode= for fetch 2019-04-09 18:01:44 +02:00
Christian Hesse
2e10a80f95 sms-forward: group messages for same sender 2019-04-05 09:24:04 +02:00
Christian Hesse
15d3e9ea7b global-config: change duplicate word from daily psk 2019-04-05 07:56:50 +02:00
Christian Hesse
50279efbdb ipv6-update: fix with prefix containing section(s) of zeros 2019-04-04 22:37:13 +02:00
Christian Hesse
228ec7106b daily-psk: use the template system 2019-04-03 22:51:15 +02:00
Christian Hesse
b35c0b8a6f always write warnings and errors to log 2019-04-03 21:30:43 +02:00
Christian Hesse
27b2fffaaf script-updates: clear variable after use 2019-04-03 13:14:09 +02:00
Christian Hesse
ea73505ecc script-updates: send global-config changes notification just once 2019-04-03 08:30:28 +02:00
Christian Hesse
7b1c275cc2 script-updates: add option to ignore global-config changes 2019-04-02 08:48:35 +02:00
280 changed files with 15133 additions and 2352 deletions

10
.gitignore vendored
View file

@ -1,3 +1,13 @@
# backup and temporary files
*~
# patches and related files
*.orig
*.patch
*.rej
# html files (as generated from markdown)
*.html
# Mac OS X folder settings file
.DS_Store

50
BRANCHES.md Normal file
View file

@ -0,0 +1,50 @@
Installing from branches
========================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
[⬅️ Go back to main README](README.md)
> ⚠️ **Warning**: Living on the edge? Great, read on!
> If not: Please use the `main` branch and leave this page!
These scripts are developed in a [git](https://git-scm.com/) repository.
Development and experimental branches are used to provide early access
for specific changes. You can install scripts from these branches
for testing.
## Install single script
To install a single script from `next` branch:
$ScriptInstallUpdate script-name "base-url=https://rsc.eworm.de/next/";
## Switch existing script
Alternatively switch an existing script to update from `next` branch:
/system/script/set comment="base-url=https://rsc.eworm.de/next/" script-name;
$ScriptInstallUpdate;
## Switch installation
Last but not least - to switch the complete installation to the `next`
branch edit `global-config-overlay` and add:
:global ScriptUpdatesBaseUrl "https://rsc.eworm.de/next/";
... then reload the configuration and update:
/system/script/run global-config;
$ScriptInstallUpdate;
> **Info**: Replace `next` with *whatever* to use another specific branch.
---
[⬅️ Go back to main README](README.md)
[⬆️ Go back to top](#top)

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

82
CERTIFICATES.md Normal file
View file

@ -0,0 +1,82 @@
Certificate name from browser
=============================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
[⬅️ Go back to main README](README.md)
All well known desktop, mobile and server operating systems come with a
certificate store that is populated with a set of well known and trusted
certificates, acting as *trust anchors*.
However RouterOS does not, still sometimes a specific certificate is
required to properly verify a chain of trust. One example is downloading
the scripts from this repository with `fetch` command, thus the very
first step of [installation](README.md#the-long-way-in-detail) is importing
the certificate.
The scripts can install additional certificates when required. This happens
from this repository if available, or from [mkcert.org](https://mkcert.org)
as a fallback.
Get the certificate's CommonName
--------------------------------
But how to determine what certificate may be required? Often easiest way
is to use a desktop browser to get that information. This demonstration uses
[Mozilla Firefox](https://www.mozilla.org/firefox/).
Let's assume we want to make sure the certificate for
[git.eworm.de](https://git.eworm.de/) is available. Open that page in the
browser, then click the *lock* icon in addressbar, followed by "*Connection
secure*".
![screenshot: dialog A](CERTIFICATES.d/01-dialog-A.avif)
The dialog will change, click "*More information*".
![screenshot: dialog B](CERTIFICATES.d/02-dialog-B.avif)
A new window opens, click the button "*View Certificate*". (That window
can be closed now.)
![screenshot: window](CERTIFICATES.d/03-window.avif)
A new tab opens, showing information on the server certificate and its
chain of trust. The leftmost certificate is what we are interested in.
![screenshot: certificate](CERTIFICATES.d/04-certificate.avif)
Now we know that "`ISRG Root X2`" is required, some scripts need just
that information.
Import a certificate by CommonName
----------------------------------
Running the function `$CertificateAvailable` with that name as parameter
makes sure the certificate is available in the device's store:
$CertificateAvailable "ISRG Root X2";
If the certificate is actually available already nothing happens, and there
is no output. Otherwise the certificate is downloaded and imported.
If importing a certificate with that exact name fails a warning is given
and nothing is actually imported.
See also
--------
* [Download, import and update firewall address-lists](doc/fw-addr-lists.md)
* [Manage DNS and DoH servers from netwatch](doc/netwatch-dns.md)
* [Send notifications via Matrix](doc/mod/notification-matrix.md)
* [Send notifications via Ntfy](doc/mod/notification-ntfy.md)
---
[⬅️ Go back to main README](README.md)
[⬆️ Go back to top](#top)

63
CONTRIBUTIONS.md Normal file
View file

@ -0,0 +1,63 @@
Past Contributions
==================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
[⬅️ Go back to main README](README.md)
Thanks a lot for your contributions! ❤️
## Patches
These persons contributed code or documentation. See the git history
for details!
* [Anatoly Bubenkov](mailto:bubenkoff@gmail.com) (@bubenkoff)
* [Ben Harris](mailto:mail@bharr.is) (@bharrisau)
* [Daniel Ziegenberg](mailto:daniel@ziegenberg.at) (@ziegenberg)
* [Ignacio Serrano](mailto:ignic@ignic.com) (@ignic)
* [Michael Gisbers](mailto:michael@gisbers.de) (@mgisbers)
* [Miquel Bonastre](mailto:mbonastre@yahoo.com) (@mbonastre)
* @netravnen
* [netztrip](mailto:dave-tvg@netztrip.de) (@netztrip)
* [Stefan Müller](mailto:stefan.mueller.83@gmail.com) (@PackElend)
## Donations
Add yourself to the list,
[donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)!
* Abdul Mannan Abbasi
* Andrea Ruffini Perico
* Andrew Cox
* Christoph Boss (@Kampfwurst)
* Daniel Ziegenberg (@ziegenberg)
* Devin Dean (@dd2594gh)
* Evaldo Gardenal
* Florian Estraviz
* Giorgio Bikos
* Harold Schoemaker
* Hugo BV
* Klaus Michael Rübsam
* Leonardo Valeri Manera
* Linux-Schmie.de Michael Gisbers
* Manuel Kuhn
* Marek Čábák
* Oleksandr Yukhymchuk
* Peter Holtkamp
* Peter Ponzel
* Reiner Vehrenkamp
* Richard Österreicher
* Simon Hitzemann
* Sunny Chu (@sunnychuchu)
* Ulrich Wessendorf
* Zac Kornilakis
---
[⬅️ Go back to main README](README.md)
[⬆️ Go back to top](#top)

675
COPYING.md Normal file
View file

@ -0,0 +1,675 @@
### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program--to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands \`show w' and \`show c' should show the
appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an "about box".
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.

63
DEBUG.md Normal file
View file

@ -0,0 +1,63 @@
Debug output and logs
=====================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
[⬅️ Go back to main README](README.md)
Sometimes scripts do not behave as expected. In these cases debug output
or logs can help.
## Debug output
Run this command in a terminal:
:set PrintDebug true;
You will then see debug output when running the script from terminal.
To revert to default output run:
:set PrintDebug false;
### Debug output for specific script
Even having debug output for a specific script or function only (or a
set of) is possible. To enable debug output for `telegram-chat` run:
:set ($PrintDebugOverride->"telegram-chat") true;
## Debug logs
The debug info can go to system log. To make it show up in `memory` run:
/system/logging/add topics=script,debug action=memory;
Other actions (`disk`, `email`, `remote` or `support`) can be used as
well. I do not recommend using `echo` - use [debug output](#debug-output)
instead.
Disable or remote that setting to restore regular logging.
## Verbose output
Specific scripts can generate huge amount of output. These do use a function
`$LogPrintVerbose`, which is declared, but has no code, intentionally.
If you *really* want that output set the function to be the same as
`$LogPrint`:
:set LogPrintVerbose $LogPrint;
To revert that change just run:
:set LogPrintVerbose;
---
[⬅️ Go back to main README](README.md)
[⬆️ Go back to top](#top)

53
INITIAL-COMMANDS.md Normal file
View file

@ -0,0 +1,53 @@
Initial commands
================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
[⬅️ Go back to main README](README.md)
> ⚠️ **Warning**: These command are inteneded for initial setup. If you are
> not aware of the procedure please follow
> [the long way in detail](README.md#the-long-way-in-detail).
Run the complete base installation:
{
/tool/fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/ISRG-Root-X2.pem" dst-path="isrg-root-x2.pem" as-value;
:delay 1s;
/certificate/import file-name="isrg-root-x2.pem" passphrase="";
:if ([ :len [ /certificate/find where fingerprint="69729b8e15a86efc177a57afb7171dfc64add28c2fca8cf1507e34453ccb1470" ] ] != 1) do={
:error "Something is wrong with your certificates!";
};
:delay 1s;
/system/script/set name=("global-config-overlay-" . [ /system/clock/get date ] . "-" . [ /system/clock/get time ]) [ find where name="global-config-overlay" ];
:foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={
/system/script/remove [ find where name=$Script ];
/system/script/add name=$Script owner=$Script source=([ /tool/fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script . ".rsc") output=user as-value]->"data");
};
/system/script { run global-config; run global-functions; };
/system/scheduler/remove [ find where name="global-scripts" ];
/system/scheduler/add name="global-scripts" start-time=startup on-event="/system/script { run global-config; run global-functions; }";
:global CertificateNameByCN;
$CertificateNameByCN "ISRG Root X2";
};
Then continue setup with
[scheduled automatic updates](README.md#scheduled-automatic-updates) or
[editing configuration](README.md#editing-configuration).
## Fix existing installation
The [initial commands](#initial-commands) above allow to fix an existing
installation in case it ever breaks. If `global-config-overlay` did exist
before it is renamed with a date and time suffix (like
`global-config-overlay-2024-01-25-09:33:12`). Make sure to restore the
configuration overlay if required.
---
[⬅️ Go back to main README](README.md)
[⬆️ Go back to top](#top)

View file

@ -2,24 +2,35 @@
# template scripts -> final scripts
# markdown files -> html files
TEMPLATE = $(wildcard *.template)
CAPSMAN = $(TEMPLATE:.template=.capsman)
LOCAL = $(TEMPLATE:.template=.local)
CAPSMAN = $(wildcard *.capsman.rsc)
LOCAL = $(wildcard *.local.rsc)
WIFI = $(wildcard *.wifi.rsc)
MARKDOWN = $(wildcard *.md)
HTML = $(MARKDOWN:.md=.html)
MARKDOWN = $(wildcard *.md doc/*.md doc/mod/*.md)
HTML = $(MARKDOWN:.md=.html)
all: $(CAPSMAN) $(LOCAL) $(HTML)
all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML)
%.html: %.md Makefile
markdown $< | sed 's/href="\([-[:alnum:]]*\)\.md"/href="\1.html"/g' > $@
markdown $< | sed 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' > $@
%.local: %.template Makefile
sed -e '/\/ caps-man/d' -e 's|%PATH%|interface wireless|' -e 's|%TEMPL%|$(suffix $@)|' \
%.capsman.rsc: %.template.rsc Makefile
sed -e '/\/interface\/wifi\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.capsman|' \
-e '/^# NOT \/caps-man\/ #$$/,/^# NOT \/caps-man\/ #$$/d' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $< > $@
%.capsman: %.template Makefile
sed -e '/\/ interface wireless/d' -e 's/%PATH%/caps-man/' -e 's/%TEMPL%/$(suffix $@)/' \
%.local.rsc: %.template.rsc Makefile
sed -e '/\/caps-man\//d' -e '/\/interface\/wifi\//d' -e 's|%TEMPL%|.local|' \
-e '/^# NOT \/interface\/wireless\/ #$$/,/^# NOT \/interface\/wireless\/ #$$/d' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $< > $@
%.wifi.rsc: %.template.rsc Makefile
sed -e '/\/caps-man\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.wifi|' \
-e '/^# NOT \/interface\/wifi\/ #$$/,/^# NOT \/interface\/wifi\/ #$$/d' \
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $< > $@
clean:
rm -f $(HTML)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

3
README.d/hello-world.rsc Normal file
View file

@ -0,0 +1,3 @@
#!rsc by RouterOS
:put ("Hello World from " . [ /system/identity/get name ] . "!");

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

BIN
README.d/upstream.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

356
README.md
View file

@ -1,23 +1,52 @@
RouterOS Scripts
================
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.15-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
![RouterOS Scripts Logo](logo.svg)
[RouterOS](https://mikrotik.com/software) is the operating system developed
by [MikroTik](https://mikrotik.com/aboutus) for networking tasks. This
repository holds a number of [scripts](https://wiki.mikrotik.com/wiki/Manual:Scripting)
to manage RouterOS devices or extend their functionality.
*Use at your own risk!*
*Use at your own risk*, pay attention to
[license and warranty](#license-and-warranty)!
Requirements
------------
Latest version of the scripts require at least **RouterOS 6.43** to function
properly. The changelog lists the corresponding change as follows:
### Software (RouterOS)
> *) fetch - added "as-value" output format;
Latest version of the scripts require recent RouterOS to function properly.
Make sure to install latest updates before you begin. If new functionality
or a breaking change in RouterOS `7.n` is used in my scripts I push my
change some time after `7.(n+1)` was released. At any time you should have
at least two minor and their bugfix releases to choose from.
Specific scripts may require even newer RouterOS version, for example cloud
backup was added in 6.44.
Specific scripts may require even newer RouterOS version.
> **Info**: The `main` branch is now RouterOS v7 only. If you are still
> running RouterOS v6 switch to `routeros-v6` branch!
Starting with RouterOS 7.17 the
[device-mode](https://help.mikrotik.com/docs/spaces/ROS/pages/93749258/Device-mode)
has been extended to give more fine-grained control over what features are
available. You need to enable `scheduler` and `fetch` at least, specific
scripts may require additional features.
### Hardware
RouterOS packages increase in size with each release. This becomes a
problem for devices with 16MB storage and below, those with an ARM CPU
are specifically affected.
Huge configuration and lots of scripts give an extra risk. **Take care!**
Initial setup
-------------
@ -25,9 +54,9 @@ Initial setup
### Get me ready!
If you know how things work just copy and paste the
[initial commands](initial-commands). Remember to edit and rerun
`global-config`!
First time useres should take the long way below.
[initial commands](INITIAL-COMMANDS.md). Remember to edit and rerun
`global-config-overlay`!
First time users should take the long way below.
### Live presentation
@ -36,6 +65,9 @@ RouterOS script distribution](https://www.youtube.com/watch?v=B9neG3oAhcY)
including demonstation recorded live at [MUM Europe
2019](https://mum.mikrotik.com/2019/EU/) in Vienna.
> ⚠️ **Warning**: Some details changed. So see the presentation, then follow
> the steps below for up-to-date commands.
### The long way in detail
The update script does server certificate verification, so first step is to
@ -43,107 +75,309 @@ 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.cgi/routeros-scripts/plain/certs/letsencrypt.pem" dst-path="letsencrypt.pem"
status: finished
downloaded: 3KiBC-z pause]
total: 3KiB
duration: 1s
/tool/fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/ISRG-Root-X2.pem" dst-path="isrg-root-x2.pem";
![screenshot: download certs](README.d/01-download-certs.avif)
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.
file to your MikroTik device.
* [ISRG Root X1](https://letsencrypt.org/certs/isrgrootx1.pem.txt)
* [Let's Encrypt Authority X3](https://letsencrypt.org/certs/letsencryptauthorityx3.pem.txt)
* [ISRG Root X2](https://letsencrypt.org/certs/isrg-root-x2.pem)
Then we import the certificates.
Then we import the certificate.
[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
/certificate/import file-name="isrg-root-x2.pem" passphrase="";
For basic verification we rename the certifiactes and print their count. Make
sure the certificate count is **three**.
Do not worry that the command is not shown - that happens because it contains
a sensitive property, the passphrase.
[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
![screenshot: import certs](README.d/02-import-certs.avif)
For basic verification we rename the certificate and print it by
fingerprint. Make sure exactly this one certificate ("*ISRG-Root-X2*")
is shown.
/certificate/set name="ISRG-Root-X2" [ find where common-name="ISRG Root X2" ];
/certificate/print proplist=name,fingerprint where fingerprint="69729b8e15a86efc177a57afb7171dfc64add28c2fca8cf1507e34453ccb1470";
![screenshot: check certs](README.d/03-check-certs.avif)
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](https://www.identrust.com/support/downloads). The site is
crap and a good example how to *not* do it.
All following commands will verify the server certificate. For validity the
certificate's lifetime is checked with local time, so make sure the device's
date and time is set correctly!
Now let's download the main scripts and add them in configuration on the fly.
[admin@MikroTik] > :foreach Script in={ "global-config"; "global-functions"; "script-updates" } do={ / system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit.cgi/routeros-scripts/plain/" . $Script) output=user as-value]->"data"); }
:foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={ /system/script/add name=$Script owner=$Script source=([ /tool/fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script . ".rsc") 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`!
![screenshot: import scripts](README.d/04-import-scripts.avif)
[admin@MikroTik] > / system script edit global-config source
And finally load configuration and functions and add the scheduler.
And finally load configuration and functions and add the schedulers.
/system/script { run global-config; run global-functions; };
/system/scheduler/add name="global-scripts" start-time=startup on-event="/system/script { run global-config; run global-functions; }";
[admin@MikroTik] > / system script run global-config
[admin@MikroTik] > / system script run global-functions
[admin@MikroTik] > / system scheduler add name=global-config start-time=startup on-event=global-config
[admin@MikroTik] > / system scheduler add name=global-functions start-time=startup on-event=global-functions
![screenshot: run and schedule scripts](README.d/05-run-and-schedule-scripts.avif)
### Scheduled automatic updates
The last step is optional: Add this scheduler **only** if you want the
scripts to be updated automatically!
/system/scheduler/add name="ScriptInstallUpdate" start-time=startup interval=1d on-event=":global ScriptInstallUpdate; \$ScriptInstallUpdate;";
![screenshot: schedule update](README.d/06-schedule-update.avif)
Editing configuration
---------------------
The configuration needs to be tweaked for your needs. Edit
`global-config-overlay`, copy relevant configuration from
[`global-config`](global-config.rsc) (the one without `-overlay`).
Save changes and exit with `Ctrl-o`.
/system/script/edit global-config-overlay source;
![screenshot: edit global-config-overlay](README.d/07-edit-global-config-overlay.avif)
Additionally creating configuration snippets is supported. The script name
of these snippets has to start with `global-config-overlay.d/` to make them
being loaded automatically. This allows to split off parts of the
configuration.
To apply your changes run `global-config`, which will automatically load
the overlay as well:
/system/script/run global-config;
![screenshot: apply configuration](README.d/08-apply-configuration.avif)
This last step is required when ever you make changes to your configuration.
> **Info**: It is recommended to edit the configuration using the command
> line interface. If using Winbox on Windows OS, the line endings may be
> missing. To fix this run:
> `/system/script/set source=[ :tocrlf [ get global-config-overlay source ] ] global-config-overlay;`
Updating scripts
----------------
To update existing scripts just run `script-updates`.
To update existing scripts just run function `$ScriptInstallUpdate`. If
everything is up-to-date it will not produce any output.
[admin@MikroTik] > / system script run script-updates
$ScriptInstallUpdate;
![screenshot: update scripts](README.d/09-update-scripts.avif)
If the update includes news or requires configuration changes a notification
is sent - in addition to terminal output and log messages.
![news and changes notification](README.d/notification-news-and-changes.avif)
Adding a script
---------------
To add a script from the repository create a configuration item first, then
update scripts to fetch the source.
To add a script from the repository run function `$ScriptInstallUpdate` with
a comma separated list of script names.
[admin@MikroTik] > / system script add name=check-routeros-update
[admin@MikroTik] > / system script run script-updates
$ScriptInstallUpdate check-certificates,check-routeros-update;
![screenshot: install scripts](README.d/10-install-scripts.avif)
Scheduler and events
--------------------
Most scripts are designed to run regularly from
[scheduler](https://wiki.mikrotik.com/wiki/Manual:System/Scheduler). We just
added `check-routeros-update`, so let's run it every hour to make sure not to
added `check-routeros-update`, so let's run it daily to make sure not to
miss an update.
[admin@MikroTik] > / system scheduler add name=check-routeros-update interval=1h on-event=check-routeros-update
/system/scheduler/add name="check-routeros-update" interval=1d start-time=startup on-event="/system/script/run check-routeros-update;";
![screenshot: schedule script](README.d/11-schedule-script.avif)
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] > / system script add name=dhcp-to-dns
[admin@MikroTik] > / system script run script-updates
[admin@MikroTik] > / ip dhcp-server set lease-script=dhcp-to-dns [ find ]
[admin@MikroTik] > / system scheduler add name=dhcp-to-dns interval=5m on-event=dhcp-to-dns
$ScriptInstallUpdate dhcp-to-dns,lease-script;
/ip/dhcp-server/set lease-script=lease-script [ find ];
/system/scheduler/add name="dhcp-to-dns" interval=5m on-event="/system/script/run dhcp-to-dns;";
![screenshot: setup lease script](README.d/12-setup-lease-script.avif)
There's much more to explore... Have fun!
### Upstream
Available scripts
-----------------
* [Find and remove access list duplicates](doc/accesslist-duplicates.md)
* [Upload backup to Mikrotik cloud](doc/backup-cloud.md)
* [Send backup via e-mail](doc/backup-email.md)
* [Save configuration to fallback partition](doc/backup-partition.md)
* [Upload backup to server](doc/backup-upload.md)
* [Download packages for CAP upgrade from CAPsMAN](doc/capsman-download-packages.md)
* [Run rolling CAP upgrades from CAPsMAN](doc/capsman-rolling-upgrade.md)
* [Renew locally issued certificates](doc/certificate-renew-issued.md)
* [Renew certificates and notify on expiration](doc/check-certificates.md)
* [Notify about health state](doc/check-health.md)
* [Notify on LTE firmware upgrade](doc/check-lte-firmware-upgrade.md)
* [Notify on RouterOS update](doc/check-routeros-update.md)
* [Collect MAC addresses in wireless access list](doc/collect-wireless-mac.md)
* [Use wireless network with daily psk](doc/daily-psk.md)
* [Comment DHCP leases with info from access list](doc/dhcp-lease-comment.md)
* [Create DNS records for DHCP leases](doc/dhcp-to-dns.md)
* [Automatically upgrade firmware and reboot](doc/firmware-upgrade-reboot.md)
* [Download, import and update firewall address-lists](doc/fw-addr-lists.md)
* [Wait for global functions und modules](doc/global-wait.md)
* [Send GPS position to server](doc/gps-track.md)
* [Use WPA network with hotspot credentials](doc/hotspot-to-wpa.md)
* [Create DNS records for IPSec peers](doc/ipsec-to-dns.md)
* [Update configuration on IPv6 prefix change](doc/ipv6-update.md)
* [Manage IP addresses with bridge status](doc/ip-addr-bridge.md)
* [Run other scripts on DHCP lease](doc/lease-script.md)
* [Manage LEDs dark mode](doc/leds-mode.md)
* [Forward log messages via notification](doc/log-forward.md)
* [Mode button with multiple presses](doc/mode-button.md)
* [Manage DNS and DoH servers from netwatch](doc/netwatch-dns.md)
* [Notify on host up and down](doc/netwatch-notify.md)
* [Visualize OSPF state via LEDs](doc/ospf-to-leds.md)
* [Manage system update](doc/packages-update.md)
* [Run scripts on ppp connection](doc/ppp-on-up.md)
* [Act on received SMS](doc/sms-action.md)
* [Forward received SMS](doc/sms-forward.md)
* [Play Super Mario theme](doc/super-mario-theme.md)
* [Chat with your router and send commands via Telegram bot](doc/telegram-chat.md)
* [Install LTE firmware upgrade](doc/unattended-lte-firmware-upgrade.md)
* [Update GRE configuration with dynamic addresses](doc/update-gre-address.md)
* [Update tunnelbroker configuration](doc/update-tunnelbroker.md)
Available modules
-----------------
* [Manage ports in bridge](doc/mod/bridge-port-to.md)
* [Manage VLANs on bridge ports](doc/mod/bridge-port-vlan.md)
* [Inspect variables](doc/mod/inspectvar.md)
* [IP address calculation](doc/mod/ipcalc.md)
* [Send notifications via e-mail](doc/mod/notification-email.md)
* [Send notifications via Matrix](doc/mod/notification-matrix.md)
* [Send notifications via Ntfy](doc/mod/notification-ntfy.md)
* [Send notifications via Telegram](doc/mod/notification-telegram.md)
* [Download script and run it once](doc/mod/scriptrunonce.md)
* [Import ssh keys for public key authentication](doc/mod/ssh-keys-import.md)
Installing custom scripts & modules
-----------------------------------
My scripts cover a lot of use cases, but you may have your own ones. You can
still use my scripts to manage and deploy yours, by specifying `base-url`
(and `url-suffix`) for each script.
This will fetch and install a script `hello-world.rsc` from the given url:
$ScriptInstallUpdate hello-world "base-url=https://git.eworm.de/cgit/routeros-scripts-custom/plain/";
![screenshot: install custom script](README.d/13-install-custom-script.avif)
For a script to be considered valid it has to begin with a *magic token*.
Have a look at [any script](README.d/hello-world.rsc) and copy the first line
without modification.
Starting a script's name with `mod/` makes it a module and it is run
automatically by `global-functions`.
### Linked custom scripts & modules
> ⚠️ **Warning**: These links are being provided for your convenience only;
> they do not constitute an endorsement or an approval by me. I bear no
> responsibility for the accuracy, legality or content of the external site
> or for that of subsequent links. Contact the external site for answers to
> questions regarding its content.
* [Hello World](https://git.eworm.de/cgit/routeros-scripts-custom/about/doc/hello-world.md)
(This is a demo script to show how the linking to external documentation
will be done.)
> **Info**: You have your own set of scripts and/or modules and want these
> to be listed here? There should be a general info page that links here,
> and documentation for each script. You can start by cloning my
> [Custom RouterOS-Scripts](https://git.eworm.de/cgit/routeros-scripts-custom/)
> (or fork on [GitHub](https://github.com/eworm-de/routeros-scripts-custom)
> or [GitLab](https://gitlab.com/eworm-de/routeros-scripts-custom)) and make
> your changes. Then please [get in contact](#patches-issues-and-whishlist)...
Removing a script
-----------------
There is no specific function for script removal. Just remove it from
configuration...
/system/script/remove to-be-removed;
![screenshot: remove script](README.d/14-remove-script.avif)
Possibly a scheduler and other configuration has to be removed as well.
Contact
-------
We have a Telegram Group [RouterOS-Scripts](https://t.me/routeros_scripts)!
[![RouterOS Scripts Telegram Group](README.d/telegram-group.avif)](https://t.me/routeros_scripts)
Get help, give feedback or just chat - but do not expect free professional
support!
Contribute
----------
Thanks a lot for [past contributions](CONTRIBUTIONS.md)! ❤️
### Patches, issues and whishlist
Feel free to contact me via e-mail or open an
[issue](https://github.com/eworm-de/routeros-scripts/issues) or
[pull request](https://github.com/eworm-de/routeros-scripts/pulls)
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](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J).
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=for-the-badge)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
Thanks a lot for your support!
License and warranty
--------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[GNU General Public License](COPYING.md) for more details.
Upstream
--------
[![upstream](README.d/upstream.png)](https://rsc.eworm.de/)
URL:
[GitHub.com](https://github.com/eworm-de/routeros-scripts#routeros-scripts)
Mirror:
[eworm.de](https://git.eworm.de/cgit.cgi/routeros-scripts/about/)
[eworm.de](https://git.eworm.de/cgit/routeros-scripts/about/)
[GitLab.com](https://gitlab.com/eworm-de/routeros-scripts#routeros-scripts)
---
[▲ Go back to top](#top)
[⬆️ Go back to top](#top)

View file

@ -1,34 +0,0 @@
#!rsc
# RouterOS script: accesslist-duplicates.capsman
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
#
# print duplicate antries in wireless access list
#
# !! Do not edit this file, it is generated from template!
:local Seen [ :toarray "" ];
:local Shown [ :toarray "" ];
:foreach AccList in=[ / caps-man access-list find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ / caps-man access-list get $AccList mac-address ];
:foreach SeenMac in=$Seen do={
:if ($SeenMac = $Mac) do={
:local Skip 0;
:foreach ShownMac in=$Shown do={
:if ($ShownMac = $Mac) do={ :set Skip 1; }
}
:if ($Skip = 0) do={
/ caps-man access-list print where mac-address=$Mac;
:set Shown ($Shown, $Mac);
:put "\nNumeric id to remove, any key to skip!";
:local Remove ([ :terminal inkey ] - 48);
:if ($Remove >= 0 && $Remove <= 9) do={
:put ("Removing numeric id " . $Remove . "...\n");
/ caps-man access-list remove $Remove;
}
}
}
}
:set Seen ($Seen, $Mac);
}

View file

@ -0,0 +1,37 @@
#!rsc by RouterOS
# RouterOS script: accesslist-duplicates.capsman
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# print duplicate antries in wireless access list
# https://rsc.eworm.de/doc/accesslist-duplicates.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:local Seen ({});
:foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ /caps-man/access-list/get $AccList mac-address ];
:if ($Seen->$Mac = 1) do={
/caps-man/access-list/print where mac-address=$Mac;
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
:if ([ :typeof $Remove ] = "num") do={
:put ("Removing numeric id " . $Remove . "...\n");
/caps-man/access-list/remove $Remove;
}
}
:set ($Seen->$Mac) 1;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,34 +0,0 @@
#!rsc
# RouterOS script: accesslist-duplicates.local
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
#
# print duplicate antries in wireless access list
#
# !! Do not edit this file, it is generated from template!
:local Seen [ :toarray "" ];
:local Shown [ :toarray "" ];
:foreach AccList in=[ / interface wireless access-list find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ / interface wireless access-list get $AccList mac-address ];
:foreach SeenMac in=$Seen do={
:if ($SeenMac = $Mac) do={
:local Skip 0;
:foreach ShownMac in=$Shown do={
:if ($ShownMac = $Mac) do={ :set Skip 1; }
}
:if ($Skip = 0) do={
/ interface wireless access-list print where mac-address=$Mac;
:set Shown ($Shown, $Mac);
:put "\nNumeric id to remove, any key to skip!";
:local Remove ([ :terminal inkey ] - 48);
:if ($Remove >= 0 && $Remove <= 9) do={
:put ("Removing numeric id " . $Remove . "...\n");
/ interface wireless access-list remove $Remove;
}
}
}
}
:set Seen ($Seen, $Mac);
}

View file

@ -0,0 +1,37 @@
#!rsc by RouterOS
# RouterOS script: accesslist-duplicates.local
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# print duplicate antries in wireless access list
# https://rsc.eworm.de/doc/accesslist-duplicates.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:local Seen ({});
:foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
:if ($Seen->$Mac = 1) do={
/interface/wireless/access-list/print where mac-address=$Mac;
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
:if ([ :typeof $Remove ] = "num") do={
:put ("Removing numeric id " . $Remove . "...\n");
/interface/wireless/access-list/remove $Remove;
}
}
:set ($Seen->$Mac) 1;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,35 +0,0 @@
#!rsc
# RouterOS script: accesslist-duplicates%TEMPL%
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
#
# print duplicate antries in wireless access list
#
# !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'!
:local Seen [ :toarray "" ];
:local Shown [ :toarray "" ];
:foreach AccList in=[ / %PATH% access-list find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ / %PATH% access-list get $AccList mac-address ];
:foreach SeenMac in=$Seen do={
:if ($SeenMac = $Mac) do={
:local Skip 0;
:foreach ShownMac in=$Shown do={
:if ($ShownMac = $Mac) do={ :set Skip 1; }
}
:if ($Skip = 0) do={
/ %PATH% access-list print where mac-address=$Mac;
:set Shown ($Shown, $Mac);
:put "\nNumeric id to remove, any key to skip!";
:local Remove ([ :terminal inkey ] - 48);
:if ($Remove >= 0 && $Remove <= 9) do={
:put ("Removing numeric id " . $Remove . "...\n");
/ %PATH% access-list remove $Remove;
}
}
}
}
:set Seen ($Seen, $Mac);
}

View file

@ -0,0 +1,46 @@
#!rsc by RouterOS
# RouterOS script: accesslist-duplicates%TEMPL%
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# print duplicate antries in wireless access list
# https://rsc.eworm.de/doc/accesslist-duplicates.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:local Seen ({});
:foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:foreach AccList in=[ /interface/wifi/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ /caps-man/access-list/get $AccList mac-address ];
:local Mac [ /interface/wifi/access-list/get $AccList mac-address ];
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
:if ($Seen->$Mac = 1) do={
/caps-man/access-list/print where mac-address=$Mac;
/interface/wifi/access-list/print where mac-address=$Mac;
/interface/wireless/access-list/print where mac-address=$Mac;
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
:if ([ :typeof $Remove ] = "num") do={
:put ("Removing numeric id " . $Remove . "...\n");
/caps-man/access-list/remove $Remove;
/interface/wifi/access-list/remove $Remove;
/interface/wireless/access-list/remove $Remove;
}
}
:set ($Seen->$Mac) 1;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,37 @@
#!rsc by RouterOS
# RouterOS script: accesslist-duplicates.wifi
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# print duplicate antries in wireless access list
# https://rsc.eworm.de/doc/accesslist-duplicates.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:local Seen ({});
:foreach AccList in=[ /interface/wifi/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
:local Mac [ /interface/wifi/access-list/get $AccList mac-address ];
:if ($Seen->$Mac = 1) do={
/interface/wifi/access-list/print where mac-address=$Mac;
:local Remove [ :tonum [ /terminal/ask prompt="\nNumeric id to remove, any key to skip!" ] ];
:if ([ :typeof $Remove ] = "num") do={
:put ("Removing numeric id " . $Remove . "...\n");
/interface/wifi/access-list/remove $Remove;
}
}
:set ($Seen->$Mac) 1;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

104
backup-cloud.rsc Normal file
View file

@ -0,0 +1,104 @@
#!rsc by RouterOS
# RouterOS script: backup-cloud
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: backup-script, order=40
# requires RouterOS, version=7.15
#
# upload backup to MikroTik cloud
# https://rsc.eworm.de/doc/backup-cloud.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global BackupRandomDelay;
:global Identity;
:global PackagesUpdateBackupFailure;
:global DeviceInfo;
:global FormatLine;
:global HumanReadableNum;
:global LogPrint;
:global MkDir;
:global RandomDelay;
:global RmDir;
:global ScriptFromTerminal;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global WaitForFile;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={
$RandomDelay $BackupRandomDelay;
}
:if ([ $MkDir ("tmpfs/backup-cloud") ] = false) do={
$LogPrint error $ScriptName ("Failed creating directory!");
:set ExitOK true;
:error false;
}
:local I 5;
:do {
:execute {
:global BackupPassword;
:local Backup ([ /system/backup/cloud/find ]->0);
:if ([ :typeof $Backup ] = "id") do={
/system/backup/cloud/upload-file action=create-and-upload \
password=$BackupPassword replace=$Backup;
} else={
/system/backup/cloud/upload-file action=create-and-upload \
password=$BackupPassword;
}
/file/add name="tmpfs/backup-cloud/done";
} as-string;
:set I ($I - 1);
} while=([ $WaitForFile "tmpfs/backup-cloud/done" 200ms ] = false && $I > 0);
:if ([ $WaitForFile "tmpfs/backup-cloud/done" ] = true) do={
:if ($I < 4) do={
:log warning ($ScriptName . ": Retry successful, please discard previous connection errors.");
}
:local Cloud [ /system/backup/cloud/get ([ find ]->0) ];
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "floppy-disk,cloud" ] . "Cloud backup"); \
message=("Uploaded backup for " . $Identity . " to cloud.\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
[ $FormatLine "Name" ($Cloud->"name") ] . "\n" . \
[ $FormatLine "Size" ([ $HumanReadableNum ($Cloud->"size") 1024 ] . "B") ] . "\n" . \
[ $FormatLine "Download key" ($Cloud->"secret-download-key") ]); silent=true });
} else={
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "floppy-disk,warning-sign" ] . "Cloud backup failed"); \
message=("Failed uploading backup for " . $Identity . " to cloud!\n\n" . [ $DeviceInfo ]) });
$LogPrint error $ScriptName ("Failed uploading backup for " . $Identity . " to cloud!");
:set PackagesUpdateBackupFailure true;
}
$RmDir "tmpfs/backup-cloud";
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

140
backup-email.rsc Normal file
View file

@ -0,0 +1,140 @@
#!rsc by RouterOS
# RouterOS script: backup-email
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: backup-script, order=20
# requires RouterOS, version=7.15
#
# create and email backup and config file
# https://rsc.eworm.de/doc/backup-email.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global BackupPassword;
:global BackupRandomDelay;
:global BackupSendBinary;
:global BackupSendExport;
:global BackupSendGlobalConfig;
:global Domain;
:global Identity;
:global PackagesUpdateBackupFailure;
:global CleanName;
:global DeviceInfo;
:global FormatLine;
:global LogPrint;
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
:global ScriptLock;
:global SendEMail2;
:global SymbolForNotification;
:global WaitForFile;
:global WaitFullyConnected;
:if ([ :typeof $SendEMail2 ] = "nothing") do={
$LogPrint error $ScriptName ("The module for sending notifications via e-mail is not installed.");
:set ExitOK true;
:error false;
}
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
$LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
:set ExitOK true;
:error false;
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={
$RandomDelay $BackupRandomDelay;
}
# filename based on identity
:local DirName ("tmpfs/" . $ScriptName);
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
:local FilePath ($DirName . "/" . $FileName);
:local BackupFile "none";
:local ExportFile "none";
:local ConfigFile "none";
:local Attach ({});
:if ([ $MkDir $DirName ] = false) do={
$LogPrint error $ScriptName ("Failed creating directory!");
:set ExitOK true;
:error false;
}
# binary backup
:if ($BackupSendBinary = true) do={
/system/backup/save encryption=aes-sha256 name=$FilePath password=$BackupPassword;
$WaitForFile ($FilePath . ".backup");
:set BackupFile ($FileName . ".backup");
:set Attach ($Attach, ($FilePath . ".backup"));
}
# create configuration export
:if ($BackupSendExport = true) do={
/export terse show-sensitive file=$FilePath;
$WaitForFile ($FilePath . ".rsc");
:set ExportFile ($FileName . ".rsc");
:set Attach ($Attach, ($FilePath . ".rsc"));
}
# global-config-overlay
:if ($BackupSendGlobalConfig = true) do={
# Do *NOT* use '/file/add ...' here, as it is limited to 4095 bytes!
:execute script={ :put [ /system/script/get global-config-overlay source ]; } \
file=($FilePath . ".conf\00");
$WaitForFile ($FilePath . ".conf");
:set ConfigFile ($FileName . ".conf");
:set Attach ($Attach, ($FilePath . ".conf"));
}
# send email with status and files
$SendEMail2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "floppy-disk,incoming-envelope" ] . \
"Backup & Config"); \
message=("See attached files for backup and config export for " . \
$Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
[ $FormatLine "Backup file" $BackupFile ] . "\n" . \
[ $FormatLine "Export file" $ExportFile ] . "\n" . \
[ $FormatLine "Config file" $ConfigFile ]); \
attach=$Attach; remove-attach=true });
# wait for the mail to be sent
:local I 0;
:while ([ :len [ /file/find where name ~ ($FilePath . "\\.(backup|rsc)\$") ] ] > 0) do={
:if ($I >= 120) do={
$LogPrint warning $ScriptName ("Files are still available, sending e-mail failed.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:delay 1s;
:set I ($I + 1);
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

126
backup-partition.rsc Normal file
View file

@ -0,0 +1,126 @@
#!rsc by RouterOS
# RouterOS script: backup-partition
# Copyright (c) 2022-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: backup-script, order=70
# requires RouterOS, version=7.15
# requires device-mode, scheduler
#
# save configuration to fallback partition
# https://rsc.eworm.de/doc/backup-partition.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global BackupPartitionCopyBeforeFeatureUpdate;
:global PackagesUpdateBackupFailure;
:global LogPrint;
:global ScriptFromTerminal;
:global ScriptLock;
:global VersionToNum;
:local CopyTo do={
:local ScriptName [ :tostr $1 ];
:local FallbackTo [ :toid $2 ];
:local FallbackToName [ :tostr $3 ];
:global LogPrint;
:do {
/partitions/copy-to $FallbackTo;
$LogPrint info $ScriptName ("Copied RouterOS to partition '" . $FallbackToName . "'.");
:return true;
} on-error={
$LogPrint error $ScriptName ("Failed copying RouterOS to partition '" . $FallbackToName . "'!");
:return false;
}
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ :len [ /partitions/find ] ] < 2) do={
$LogPrint error $ScriptName ("Device does not have a fallback partition.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:local ActiveRunning [ /partitions/find where active running ];
:if ([ :len $ActiveRunning ] < 1) do={
$LogPrint error $ScriptName ("Device is not running from active partition.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:local FallbackToName [ /partitions/get $ActiveRunning fallback-to ];
:local FallbackTo [ /partition/find where name=$FallbackToName !active ];
:if ([ :len $FallbackTo ] < 1) do={
$LogPrint error $ScriptName ("There is no inactive partition named '" . $FallbackToName . "'.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ /partitions/get $ActiveRunning version ] != [ /partitions/get $FallbackTo version]) do={
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
:put ("The partitions have different RouterOS versions. Copy over to '" . $FallbackToName . "'? [y/N]");
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
}
} else={
:local Update [ /system/package/update/get ];
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
:local BitMask [ $VersionToNum "255.255zero0" ];
:if ($BackupPartitionCopyBeforeFeatureUpdate = true && $NumLatest > 0 && \
($NumInstalled & $BitMask) != ($NumLatest & $BitMask)) do={
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
}
}
}
:do {
/system/scheduler/add start-time=startup name="running-from-backup-partition" \
on-event=(":log warning (\"Running from partition '\" . " . \
"[ /partitions/get [ find where running ] name ] . \"'!\")");
/partitions/save-config-to $FallbackTo;
/system/scheduler/remove "running-from-backup-partition";
$LogPrint info $ScriptName ("Saved configuration to partition '" . $FallbackToName . "'.");
} on-error={
/system/scheduler/remove [ find where name="running-from-backup-partition" ];
$LogPrint error $ScriptName ("Failed saving configuration to partition '" . $FallbackToName . "'!");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

178
backup-upload.rsc Normal file
View file

@ -0,0 +1,178 @@
#!rsc by RouterOS
# RouterOS script: backup-upload
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: backup-script, order=50
# requires RouterOS, version=7.15
# requires device-mode, fetch
#
# create and upload backup and config file
# https://rsc.eworm.de/doc/backup-upload.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global BackupPassword;
:global BackupRandomDelay;
:global BackupSendBinary;
:global BackupSendExport;
:global BackupSendGlobalConfig;
:global BackupUploadPass;
:global BackupUploadUrl;
:global BackupUploadUser;
:global Domain;
:global Identity;
:global PackagesUpdateBackupFailure;
:global CleanName;
:global DeviceInfo;
:global IfThenElse;
:global LogPrint;
:global MkDir;
:global RandomDelay;
:global RmDir;
:global RmFile;
:global ScriptFromTerminal;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global WaitForFile;
:global WaitFullyConnected;
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
$LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
:set ExitOK true;
:error false;
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set PackagesUpdateBackupFailure true;
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={
$RandomDelay $BackupRandomDelay;
}
# filename based on identity
:local DirName ("tmpfs/" . $ScriptName);
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
:local FilePath ($DirName . "/" . $FileName);
:local BackupFile "none";
:local ExportFile "none";
:local ConfigFile "none";
:local Failed 0;
:if ([ $MkDir $DirName ] = false) do={
$LogPrint error $ScriptName ("Failed creating directory!");
:set ExitOK true;
:error false;
}
# binary backup
:if ($BackupSendBinary = true) do={
/system/backup/save encryption=aes-sha256 name=$FilePath password=$BackupPassword;
$WaitForFile ($FilePath . ".backup");
:do {
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".backup") \
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".backup");
:set BackupFile [ /file/get ($FilePath . ".backup") ];
:set ($BackupFile->"name") ($FileName . ".backup");
} on-error={
$LogPrint error $ScriptName ("Uploading backup file failed!");
:set BackupFile "failed";
:set Failed 1;
}
$RmFile ($FilePath . ".backup");
}
# create configuration export
:if ($BackupSendExport = true) do={
/export terse show-sensitive file=$FilePath;
$WaitForFile ($FilePath . ".rsc");
:do {
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".rsc") \
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".rsc");
:set ExportFile [ /file/get ($FilePath . ".rsc") ];
:set ($ExportFile->"name") ($FileName . ".rsc");
} on-error={
$LogPrint error $ScriptName ("Uploading configuration export failed!");
:set ExportFile "failed";
:set Failed 1;
}
$RmFile ($FilePath . ".rsc");
}
# global-config-overlay
:if ($BackupSendGlobalConfig = true) do={
# Do *NOT* use '/file/add ...' here, as it is limited to 4095 bytes!
:execute script={ :put [ /system/script/get global-config-overlay source ]; } \
file=($FilePath . ".conf\00");
$WaitForFile ($FilePath . ".conf");
:do {
/tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
:set ConfigFile [ /file/get ($FilePath . ".conf") ];
:set ($ConfigFile->"name") ($FileName . ".conf");
} on-error={
$LogPrint error $ScriptName ("Uploading global-config-overlay failed!");
:set ConfigFile "failed";
:set Failed 1;
}
$RmFile ($FilePath . ".conf");
}
:local FileInfo do={
:local Name $1;
:local File $2;
:global FormatLine;
:global HumanReadableNum;
:global IfThenElse;
:return \
[ $IfThenElse ([ :typeof $File ] = "array") \
($Name . ":\n" . [ $FormatLine " name" ($File->"name") ] . "\n" . \
[ $FormatLine " size" ([ $HumanReadableNum ($File->"size") 1024 ] . "B") ]) \
[ $FormatLine $Name $File ] ];
}
$SendNotification2 ({ origin=$ScriptName; \
subject=[ $IfThenElse ($Failed > 0) \
([ $SymbolForNotification "floppy-disk,warning-sign" ] . "Backup & Config upload with failure") \
([ $SymbolForNotification "floppy-disk,arrow-up" ] . "Backup & Config upload") ]; \
message=("Backup and config export upload for " . $Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
[ $FileInfo "Backup file" $BackupFile ] . "\n" . \
[ $FileInfo "Export file" $ExportFile ] . "\n" . \
[ $FileInfo "Config file" $ConfigFile ]); silent=true });
:if ($Failed = 1) do={
:set PackagesUpdateBackupFailure true;
}
$RmDir $DirName;
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,31 +0,0 @@
#!rsc
# RouterOS script: bridge-port-to-default
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# reset bridge ports to default bridge
:global BridgePortTo;
:local Len ([ :len $BridgePortTo ] + 1);
:if ($Len = 1) do={
:delay 1s;
:set Len ([ :len $BridgePortTo ] + 1);
}
:foreach Interface in=[ / interface bridge port find where comment!="" ] do={
:foreach Comment in=[ :toarray [ / interface bridge port get $Interface comment ] ] do={
:if ([ :pick $Comment 0 $Len ] = ($BridgePortTo . ":")) do={
:local InterfaceName [ / interface bridge port get $Interface interface ];
:local BridgeDefault [ :pick $Comment $Len [ :len $Comment ] ];
:local BridgeCurrent [ / interface bridge port get $Interface bridge ];
:if ($BridgeDefault != $BridgeCurrent) do={
:log info ("Changing interface " . $InterfaceName . " to " . $BridgePortTo . " bridge " . $BridgeDefault);
/ interface bridge port set bridge=$BridgeDefault $Interface;
/ ip dhcp-client renew [ find where interface=$BridgeDefault ];
} else={
:log debug ("Interface " . $InterfaceName . " already connected to " . $BridgePortTo . " bridge " . $BridgeDefault);
}
}
}
}

View file

@ -1,15 +0,0 @@
#!rsc
# RouterOS script: bridge-port-toggle
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# toggle bridge ports between default and alt bridge
:global BridgePortTo;
:if ($BridgePortTo != "default") do={
:set BridgePortTo "default";
} else={
:set BridgePortTo "alt";
}
/ system script run bridge-port-to-default;

View file

@ -1,39 +0,0 @@
#!rsc
# RouterOS script: capsman-download-packages
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
#
# requires: dont-require-permissions=yes
#
# download and cleanup packages for CAP installation from CAPsMAN
:global DownloadPackage;
:global CleanFilePath;
:local PackagePath [ $CleanFilePath [ / caps-man manager get package-path ] ];
:local InstalledVersion [ / system package update get installed-version ];
:local Updated false;
:foreach Package in=[ / file find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:local PackageName [ / file get $Package package-name ];
:local PackageArchitecture [ / file get $Package package-architecture ];
:if ($PackageArchitecture = "mips") do={
:set PackageArchitecture "mipsbe";
}
:if ($PackageName = "wireless@") do={
:set PackageName "wireless";
}
:if ([ $DownloadPackage $PackageName $InstalledVersion $PackageArchitecture $PackagePath ] = true) do={
:set Updated true;
/ file remove $Package;
}
}
:if ($Updated = true) do={
:if ([ / system script print count-only where name="capsman-rolling-upgrade" ] > 0) do={
/ system script run capsman-rolling-upgrade;
} else={
/ caps-man remote-cap upgrade [ find where version!=$InstalledVersion ];
}
}

View file

@ -0,0 +1,92 @@
#!rsc by RouterOS
# RouterOS script: capsman-download-packages.capsman
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CleanFilePath;
:global DownloadPackage;
:global LogPrint;
:global MkDir;
:global RmFile;
:global ScriptLock;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /caps-man/manager/get package-path ] ];
:local InstalledVersion [ /system/package/update/get installed-version ];
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:set ExitOK true;
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
:set ExitOK true;
:error false;
}
$LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
}
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
($File->"package-architecture") $PackagePath ] = true) do={
:set Updated true;
$RmFile ($File->"name");
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={
:set Updated true;
}
}
}
}
:if ($Updated = true) do={
:local Scripts [ /system/script/find where source~"\n# provides: capsman-rolling-upgrade.capsman\r?\n" ];
:if ([ :len $Scripts ] > 0) do={
:foreach Script in=$Scripts do={
/system/script/run $Script;
}
} else={
/caps-man/remote-cap/upgrade [ find where version!=$InstalledVersion ];
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,103 @@
#!rsc by RouterOS
# RouterOS script: capsman-download-packages%TEMPL%
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CleanFilePath;
:global DownloadPackage;
:global LogPrint;
:global MkDir;
:global RmFile;
:global ScriptLock;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /caps-man/manager/get package-path ] ];
:local PackagePath [ $CleanFilePath [ /interface/wifi/capsman/get package-path ] ];
:local InstalledVersion [ /system/package/update/get installed-version ];
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:set ExitOK true;
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
:set ExitOK true;
:error false;
}
$LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
}
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
($File->"package-architecture") $PackagePath ] = true) do={
:set Updated true;
$RmFile ($File->"name");
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
# NOT /interface/wifi/ #
:foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={
# NOT /interface/wifi/ #
# NOT /caps-man/ #
:foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
"arm64"={ "routeros"; "wifi-qcom" } };
:foreach Package in=($Packages->$Arch) do={
# NOT /caps-man/ #
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={
:set Updated true;
}
}
}
}
:if ($Updated = true) do={
:local Scripts [ /system/script/find where source~"\n# provides: capsman-rolling-upgrade%TEMPL%\r?\n" ];
:if ([ :len $Scripts ] > 0) do={
:foreach Script in=$Scripts do={
/system/script/run $Script;
}
} else={
/caps-man/remote-cap/upgrade [ find where version!=$InstalledVersion ];
/interface/wifi/capsman/remote-cap/upgrade [ find where version!=$InstalledVersion ];
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,94 @@
#!rsc by RouterOS
# RouterOS script: capsman-download-packages.wifi
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# download and cleanup packages for CAP installation from CAPsMAN
# https://rsc.eworm.de/doc/capsman-download-packages.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CleanFilePath;
:global DownloadPackage;
:global LogPrint;
:global MkDir;
:global RmFile;
:global ScriptLock;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /interface/wifi/capsman/get package-path ] ];
:local InstalledVersion [ /system/package/update/get installed-version ];
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
:set ExitOK true;
:error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
:set ExitOK true;
:error false;
}
$LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
"). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
:set ($File->"package-architecture") "mipsbe";
}
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
($File->"package-architecture") $PackagePath ] = true) do={
:set Updated true;
$RmFile ($File->"name");
}
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
"arm64"={ "routeros"; "wifi-qcom" } };
:foreach Package in=($Packages->$Arch) do={
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={
:set Updated true;
}
}
}
}
:if ($Updated = true) do={
:local Scripts [ /system/script/find where source~"\n# provides: capsman-rolling-upgrade.wifi\r?\n" ];
:if ([ :len $Scripts ] > 0) do={
:foreach Script in=$Scripts do={
/system/script/run $Script;
}
} else={
/interface/wifi/capsman/remote-cap/upgrade [ find where version!=$InstalledVersion ];
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,20 +0,0 @@
#!rsc
# RouterOS script: capsman-rolling-upgrade
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
#
# upgrade CAPs one after another
:local InstalledVersion [ / system package update get installed-version ];
:local RemoteCapCount [ /caps-man remote-cap print count-only ];
:if ($RemoteCapCount > 0) do={
:local Delay (600 / $RemoteCapCount);
:if ($Delay > 120) do={ :set Delay 120; }
:foreach RemoteCap in=[ / caps-man remote-cap find where version!=$InstalledVersion ] do={
:local RemoteCapName [ / caps-man remote-cap get $RemoteCap name ];
:log debug ("Starting upgrade for CAP " . $RemoteCapName . "...");
/ caps-man remote-cap upgrade $RemoteCap;
:delay ($Delay . "s");
}
}

View file

@ -0,0 +1,50 @@
#!rsc by RouterOS
# RouterOS script: capsman-rolling-upgrade.capsman
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: capsman-rolling-upgrade.capsman
# requires RouterOS, version=7.15
#
# upgrade CAPs one after another
# https://rsc.eworm.de/doc/capsman-rolling-upgrade.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];
:local RemoteCapCount [ :len [ /caps-man/remote-cap/find ] ];
:if ($RemoteCapCount > 0) do={
:local Delay (600 / $RemoteCapCount);
:if ($Delay > 120) do={ :set Delay 120; }
:foreach RemoteCap in=[ /caps-man/remote-cap/find where version!=$InstalledVersion ] do={
:local RemoteCapVal [ /caps-man/remote-cap/get $RemoteCap ];
:if ([ :len $RemoteCapVal ] > 1) do={
$LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
" (" . $RemoteCapVal->"identity" . ")...");
/caps-man/remote-cap/upgrade $RemoteCap;
} else={
$LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,58 @@
#!rsc by RouterOS
# RouterOS script: capsman-rolling-upgrade%TEMPL%
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: capsman-rolling-upgrade%TEMPL%
# requires RouterOS, version=7.15
#
# upgrade CAPs one after another
# https://rsc.eworm.de/doc/capsman-rolling-upgrade.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];
:local RemoteCapCount [ :len [ /caps-man/remote-cap/find ] ];
:local RemoteCapCount [ :len [ /interface/wifi/capsman/remote-cap/find ] ];
:if ($RemoteCapCount > 0) do={
:local Delay (600 / $RemoteCapCount);
:if ($Delay > 120) do={ :set Delay 120; }
:foreach RemoteCap in=[ /caps-man/remote-cap/find where version!=$InstalledVersion ] do={
:foreach RemoteCap in=[ /interface/wifi/capsman/remote-cap/find where version!=$InstalledVersion ] do={
:local RemoteCapVal [ /caps-man/remote-cap/get $RemoteCap ];
:local RemoteCapVal [ /interface/wifi/capsman/remote-cap/get $RemoteCap ];
:if ([ :len $RemoteCapVal ] > 1) do={
# NOT /caps-man/ #
:set ($RemoteCapVal->"name") ($RemoteCapVal->"common-name");
# NOT /caps-man/ #
$LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
" (" . $RemoteCapVal->"identity" . ")...");
/caps-man/remote-cap/upgrade $RemoteCap;
/interface/wifi/capsman/remote-cap/upgrade $RemoteCap;
} else={
$LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,51 @@
#!rsc by RouterOS
# RouterOS script: capsman-rolling-upgrade.wifi
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: capsman-rolling-upgrade.wifi
# requires RouterOS, version=7.15
#
# upgrade CAPs one after another
# https://rsc.eworm.de/doc/capsman-rolling-upgrade.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];
:local RemoteCapCount [ :len [ /interface/wifi/capsman/remote-cap/find ] ];
:if ($RemoteCapCount > 0) do={
:local Delay (600 / $RemoteCapCount);
:if ($Delay > 120) do={ :set Delay 120; }
:foreach RemoteCap in=[ /interface/wifi/capsman/remote-cap/find where version!=$InstalledVersion ] do={
:local RemoteCapVal [ /interface/wifi/capsman/remote-cap/get $RemoteCap ];
:if ([ :len $RemoteCapVal ] > 1) do={
:set ($RemoteCapVal->"name") ($RemoteCapVal->"common-name");
$LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
" (" . $RemoteCapVal->"identity" . ")...");
/interface/wifi/capsman/remote-cap/upgrade $RemoteCap;
} else={
$LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,52 @@
#!rsc by RouterOS
# RouterOS script: certificate-renew-issued
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# renew locally issued certificates
# https://rsc.eworm.de/doc/certificate-renew-issued.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CertIssuedExportPass;
:global LogPrint;
:global MkDir;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:foreach Cert in=[ /certificate/find where issued expires-after<3w ] do={
:local CertVal [ /certificate/get $Cert ];
/certificate/issued-revoke $Cert;
/certificate/set name=($CertVal->"name" . "-revoked-" . [ /system/clock/get date ]) $Cert;
/certificate/add name=($CertVal->"name") common-name=($CertVal->"common-name") \
key-usage=($CertVal->"key-usage") subject-alt-name=($CertVal->"subject-alt-name");
/certificate/sign ($CertVal->"name") ca=($CertVal->"ca");
:if ([ :typeof ($CertIssuedExportPass->($CertVal->"common-name")) ] = "str") do={
:if ([ $MkDir "cert-issued" ] = true) do={
/certificate/export-certificate ($CertVal->"name") type=pkcs12 \
file-name=("cert-issued/" . $CertVal->"common-name") \
export-passphrase=($CertIssuedExportPass->($CertVal->"common-name"));
$LogPrint info $ScriptName ("Issued a new certificate for '" . $CertVal->"common-name" . \
"', exported to 'cert-issued/" . $CertVal->"common-name" . ".p12'.");
} else={
$LogPrint warning $ScriptName ("Failed creating directory, not exporting certificate.");
}
} else={
$LogPrint info $ScriptName ("Issued a new certificate for '" . $CertVal->"common-name" . "'.");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,29 @@
# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority
# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority
# Label: "Certum Trusted Network CA"
# Serial: 279744
# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78
# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e
# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e
-----BEGIN CERTIFICATE-----
MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM
MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D
ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU
cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3
WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg
Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw
IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B
AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH
UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM
TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU
BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM
kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x
AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV
HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y
sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL
I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8
J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY
VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
-----END CERTIFICATE-----

View file

@ -0,0 +1,29 @@
# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com
# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com
# Label: "DigiCert Global Root G2"
# Serial: 4293743540046975378534879503202253541
# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44
# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4
# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f
-----BEGIN CERTIFICATE-----
MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH
MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI
2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx
1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ
q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz
tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ
vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP
BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV
5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY
1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4
NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG
Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91
8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe
pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
MrY=
-----END CERTIFICATE-----

View file

@ -0,0 +1,22 @@
# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com
# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com
# Label: "DigiCert Global Root G3"
# Serial: 7089244469030293291760083333884364146
# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca
# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e
# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0
-----BEGIN CERTIFICATE-----
MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw
CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu
ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe
Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw
EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x
IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF
K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG
fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO
Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd
BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx
AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/
oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8
sycX
-----END CERTIFICATE-----

38
certs/GTS-Root-R1.pem Normal file
View file

@ -0,0 +1,38 @@
# Issuer: CN=GTS Root R1 O=Google Trust Services LLC
# Subject: CN=GTS Root R1 O=Google Trust Services LLC
# Label: "GTS Root R1"
# Serial: 159662320309726417404178440727
# MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40
# SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a
# SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf
-----BEGIN CERTIFICATE-----
MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw
CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU
MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw
MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp
Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA
A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo
27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w
Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw
TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl
qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH
szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8
Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk
MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p
aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN
VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID
AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb
C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe
QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy
h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4
7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J
ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef
MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/
Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT
6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ
0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm
2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb
bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c
-----END CERTIFICATE-----

20
certs/GTS-Root-R4.pem Normal file
View file

@ -0,0 +1,20 @@
# Issuer: CN=GTS Root R4 O=Google Trust Services LLC
# Subject: CN=GTS Root R4 O=Google Trust Services LLC
# Label: "GTS Root R4"
# Serial: 159662532700760215368942768210
# MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8
# SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47
# SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d
-----BEGIN CERTIFICATE-----
MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD
VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG
A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw
WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz
IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi
QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR
HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D
9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8
p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD
-----END CERTIFICATE-----

View file

@ -0,0 +1,30 @@
# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc.
# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc.
# Label: "Go Daddy Root Certificate Authority - G2"
# Serial: 0
# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01
# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b
# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz
NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE
AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD
E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH
/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy
DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh
GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR
tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA
AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX
WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu
9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr
gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo
2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI
4uJEvlz36hz1
-----END CERTIFICATE-----

38
certs/ISRG-Root-X1.pem Normal file
View file

@ -0,0 +1,38 @@
# Issuer: CN=ISRG Root X1 O=Internet Security Research Group
# Subject: CN=ISRG Root X1 O=Internet Security Research Group
# Label: "ISRG Root X1"
# Serial: 172886928669790476064670243504169061120
# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e
# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8
# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----

21
certs/ISRG-Root-X2.pem Normal file
View file

@ -0,0 +1,21 @@
# Issuer: CN=ISRG Root X2 O=Internet Security Research Group
# Subject: CN=ISRG Root X2 O=Internet Security Research Group
# Label: "ISRG Root X2"
# Serial: 87493402998870891108772069816698636114
# MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5
# SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af
# SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70
-----BEGIN CERTIFICATE-----
MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw
CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg
R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00
MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT
ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw
EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW
+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9
ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T
AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI
zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW
tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1
/q4AaOeMSQ+2b1tbFfLn
-----END CERTIFICATE-----

58
certs/Makefile Normal file
View file

@ -0,0 +1,58 @@
# Makefile to check certificates
CURL = curl \
--capath /dev/null \
--connect-timeout 5 \
--output /dev/null \
--silent
DOMAINS_DUAL = \
api.macvendors.com/GTS-Root-R4 \
api.telegram.org/Go-Daddy-Root-Certificate-Authority-G2 \
cloudflare-dns.com/DigiCert-Global-Root-G2 \
dns.google/GTS-Root-R4 \
dns.quad9.net/DigiCert-Global-Root-G3 \
git.eworm.de/ISRG-Root-X2 \
lists.blocklist.de/Certum-Trusted-Network-CA \
matrix.org/GTS-Root-R4 \
raw.githubusercontent.com/USERTrust-RSA-Certification-Authority \
rsc.eworm.de/ISRG-Root-X2 \
upgrade.mikrotik.com/ISRG-Root-X1
DOMAINS_IPV4 = \
1.1.1.1/DigiCert-Global-Root-G2 \
8.8.8.8/GTS-Root-R1 \
9.9.9.9/DigiCert-Global-Root-G3 \
api.mullvad.net/ISRG-Root-X1 \
ipv4.showipv6.de/ISRG-Root-X1 \
ipv4.tunnelbroker.net/Starfield-Root-Certificate-Authority-G2 \
mkcert.org/ISRG-Root-X1 \
ntfy.sh/ISRG-Root-X1 \
www.dshield.org/ISRG-Root-X1 \
www.spamhaus.org/GTS-Root-R4
DOMAINS_IPV6 = \
[2606\:4700\:4700\:\:1111]/DigiCert-Global-Root-G2 \
[2001\:4860\:4860\:\:8888]/GTS-Root-R1 \
[2620\:fe\:\:9]/DigiCert-Global-Root-G3 \
ipv6.showipv6.de/ISRG-Root-X1
.PHONY: $(DOMAINS_DUAL) $(DOMAINS_IPV4) $(DOMAINS_IPV6)
all: $(DOMAINS_DUAL) $(DOMAINS_IPV4) $(DOMAINS_IPV6)
$(DOMAINS_DUAL):
ifndef NOIPV4
$(CURL) -4 --cacert $(notdir $@).pem https://$(dir $@)
endif
ifndef NOIPV6
$(CURL) -6 --cacert $(notdir $@).pem https://$(dir $@)
endif
$(DOMAINS_IPV4):
ifndef NOIPV4
$(CURL) -4 --cacert $(notdir $@).pem https://$(dir $@)
endif
$(DOMAINS_IPV6):
ifndef NOIPV6
$(CURL) -6 --cacert $(notdir $@).pem https://$(dir $@)
endif

View file

@ -0,0 +1,30 @@
# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc.
# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc.
# Label: "Starfield Root Certificate Authority - G2"
# Serial: 0
# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96
# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e
# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5
-----BEGIN CERTIFICATE-----
MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs
ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw
MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj
aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp
Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg
nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1
HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N
Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN
dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0
HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G
CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU
sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3
4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg
8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1
mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
-----END CERTIFICATE-----

View file

@ -0,0 +1,41 @@
# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network
# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network
# Label: "USERTrust RSA Certification Authority"
# Serial: 2645093764781058787591871645665788717
# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5
# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e
# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2
-----BEGIN CERTIFICATE-----
MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw
MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV
BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy
dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B
3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY
tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/
Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2
VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT
79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6
c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT
Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l
c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee
UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE
Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF
Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO
VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3
ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs
8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR
iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze
Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ
XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/
qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB
VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB
L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG
jjxDah2nGN59PRbxYvnKkKj9
-----END CERTIFICATE-----

View file

@ -1,51 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz
NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE
AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD
E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH
/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy
DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh
GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR
tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA
AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX
WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu
9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr
gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo
2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI
4uJEvlz36hz1
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIE0DCCA7igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTExMDUwMzA3MDAwMFoXDTMxMDUwMzA3
MDAwMFowgbQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjEtMCsGA1UE
CxMkaHR0cDovL2NlcnRzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkvMTMwMQYDVQQD
EypHbyBEYWRkeSBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwggEi
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC54MsQ1K92vdSTYuswZLiBCGzD
BNliF44v/z5lz4/OYuY8UhzaFkVLVat4a2ODYpDOD2lsmcgaFItMzEUz6ojcnqOv
K/6AYZ15V8TPLvQ/MDxdR/yaFrzDN5ZBUY4RS1T4KL7QjL7wMDge87Am+GZHY23e
cSZHjzhHU9FGHbTj3ADqRay9vHHZqm8A29vNMDp5T19MR/gd71vCxJ1gO7GyQ5HY
pDNO6rPWJ0+tJYqlxvTV0KaudAVkV4i1RFXULSo6Pvi4vekyCgKUZMQWOlDxSq7n
eTOvDCAHf+jfBDnCaQJsY1L6d8EbyHSHyLmTGFBUNUtpTrw700kuH9zB0lL7AgMB
AAGjggEaMIIBFjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV
HQ4EFgQUQMK9J47MNIMwojPX+2yz8LQsgM4wHwYDVR0jBBgwFoAUOpqFBxBnKLbv
9r0FQW4gwZTaD94wNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8v
b2NzcC5nb2RhZGR5LmNvbS8wNQYDVR0fBC4wLDAqoCigJoYkaHR0cDovL2NybC5n
b2RhZGR5LmNvbS9nZHJvb3QtZzIuY3JsMEYGA1UdIAQ/MD0wOwYEVR0gADAzMDEG
CCsGAQUFBwIBFiVodHRwczovL2NlcnRzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkv
MA0GCSqGSIb3DQEBCwUAA4IBAQAIfmyTEMg4uJapkEv/oV9PBO9sPpyIBslQj6Zz
91cxG7685C/b+LrTW+C05+Z5Yg4MotdqY3MxtfWoSKQ7CC2iXZDXtHwlTxFWMMS2
RJ17LJ3lXubvDGGqv+QqG+6EnriDfcFDzkSnE3ANkR/0yBOtg2DZ2HKocyQetawi
DsoXiWJYRBuriSUBAA/NxBti21G00w9RKpv0vHP8ds42pM3Z2Czqrpv1KrKQ0U11
GIo/ikGQI31bS/6kA1ibRrLDYGCD+H1QQc7CoZDDu+8CL9IVVO5EFdkKrqeKM+2x
LXY2JtwE65/3YR8V3Idv7kaWKK2hJn0KCacuBKONvPi8BDAB
-----END CERTIFICATE-----

View file

@ -1,83 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFjTCCA3WgAwIBAgIRANOxciY0IzLc9AUoUSrsnGowDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTYxMDA2MTU0MzU1
WhcNMjExMDA2MTU0MzU1WjBKMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDEjMCEGA1UEAxMaTGV0J3MgRW5jcnlwdCBBdXRob3JpdHkgWDMwggEi
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCc0wzwWuUuR7dyXTeDs2hjMOrX
NSYZJeG9vjXxcJIvt7hLQQWrqZ41CFjssSrEaIcLo+N15Obzp2JxunmBYB/XkZqf
89B4Z3HIaQ6Vkc/+5pnpYDxIzH7KTXcSJJ1HG1rrueweNwAcnKx7pwXqzkrrvUHl
Npi5y/1tPJZo3yMqQpAMhnRnyH+lmrhSYRQTP2XpgofL2/oOVvaGifOFP5eGr7Dc
Gu9rDZUWfcQroGWymQQ2dYBrrErzG5BJeC+ilk8qICUpBMZ0wNAxzY8xOJUWuqgz
uEPxsR/DMH+ieTETPS02+OP88jNquTkxxa/EjQ0dZBYzqvqEKbbUC8DYfcOTAgMB
AAGjggFnMIIBYzAOBgNVHQ8BAf8EBAMCAYYwEgYDVR0TAQH/BAgwBgEB/wIBADBU
BgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEBATAwMC4GCCsGAQUFBwIB
FiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQub3JnMB0GA1UdDgQWBBSo
SmpjBH3duubRObemRWXv86jsoTAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3Js
LnJvb3QteDEubGV0c2VuY3J5cHQub3JnMHIGCCsGAQUFBwEBBGYwZDAwBggrBgEF
BQcwAYYkaHR0cDovL29jc3Aucm9vdC14MS5sZXRzZW5jcnlwdC5vcmcvMDAGCCsG
AQUFBzAChiRodHRwOi8vY2VydC5yb290LXgxLmxldHNlbmNyeXB0Lm9yZy8wHwYD
VR0jBBgwFoAUebRZ5nu25eQBc4AIiMgaWPbpm24wDQYJKoZIhvcNAQELBQADggIB
ABnPdSA0LTqmRf/Q1eaM2jLonG4bQdEnqOJQ8nCqxOeTRrToEKtwT++36gTSlBGx
A/5dut82jJQ2jxN8RI8L9QFXrWi4xXnA2EqA10yjHiR6H9cj6MFiOnb5In1eWsRM
UM2v3e9tNsCAgBukPHAg1lQh07rvFKm/Bz9BCjaxorALINUfZ9DD64j2igLIxle2
DPxW8dI/F2loHMjXZjqG8RkqZUdoxtID5+90FgsGIfkMpqgRS05f4zPbCEHqCXl1
eO5HyELTgcVlLXXQDgAWnRzut1hFJeczY1tjQQno6f6s+nMydLN26WuU4s3UYvOu
OsUxRlJu7TSRHqDC3lSE5XggVkzdaPkuKGQbGpny+01/47hfXXNB7HntWNZ6N2Vw
p7G6OfY+YQrZwIaQmhrIqJZuigsrbe3W+gdn5ykE9+Ky0VgVUsfxo52mwFYs1JKY
2PGDuWx8M6DlS6qQkvHaRUo0FMd8TsSlbF0/v965qGFKhSDeQoMpYnwcmQilRh/0
ayLThlHLN81gSkJjVrPI0Y8xCVPB4twb1PFUd2fPM3sA1tJ83sZ5v8vgFv2yofKR
PB0t6JzUA81mSqM3kxl5e+IZwhYAyO0OTg3/fs8HqGTNKd9BqoUwSRBzp06JMg5b
rUCGwbCUDI0mxadJ3Bz4WxR6fyNpBK2yAinWEsikxqEt
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
-----END CERTIFICATE-----

View file

@ -1,52 +0,0 @@
-----BEGIN CERTIFICATE-----
MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs
ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw
MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj
aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp
Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg
nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1
HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N
Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN
dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0
HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G
CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU
sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3
4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg
8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1
mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFADCCA+igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs
ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTExMDUwMzA3MDAw
MFoXDTMxMDUwMzA3MDAwMFowgcYxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj
aG5vbG9naWVzLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydHMuc3RhcmZpZWxk
dGVjaC5jb20vcmVwb3NpdG9yeS8xNDAyBgNVBAMTK1N0YXJmaWVsZCBTZWN1cmUg
Q2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQDlkGZL7PlGcakgg77pbL9KyUhpgXVObST2yxcT+LBxWYR6ayuF
pDS1FuXLzOlBcCykLtb6Mn3hqN6UEKwxwcDYav9ZJ6t21vwLdGu4p64/xFT0tDFE
3ZNWjKRMXpuJyySDm+JXfbfYEh/JhW300YDxUJuHrtQLEAX7J7oobRfpDtZNuTlV
Bv8KJAV+L8YdcmzUiymMV33a2etmGtNPp99/UsQwxaXJDgLFU793OGgGJMNmyDd+
MB5FcSM1/5DYKp2N57CSTTx/KgqT3M0WRmX3YISLdkuRJ3MUkuDq7o8W6o0OPnYX
v32JgIBEQ+ct4EMJddo26K3biTr1XRKOIwSDAgMBAAGjggEsMIIBKDAPBgNVHRMB
Af8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUJUWBaFAmOD07LSy+
zWrZtj2zZmMwHwYDVR0jBBgwFoAUfAwyH6fZMH/EfWijYqihzqsHWycwOgYIKwYB
BQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5zdGFyZmllbGR0ZWNo
LmNvbS8wOwYDVR0fBDQwMjAwoC6gLIYqaHR0cDovL2NybC5zdGFyZmllbGR0ZWNo
LmNvbS9zZnJvb3QtZzIuY3JsMEwGA1UdIARFMEMwQQYEVR0gADA5MDcGCCsGAQUF
BwIBFitodHRwczovL2NlcnRzLnN0YXJmaWVsZHRlY2guY29tL3JlcG9zaXRvcnkv
MA0GCSqGSIb3DQEBCwUAA4IBAQBWZcr+8z8KqJOLGMfeQ2kTNCC+Tl94qGuc22pN
QdvBE+zcMQAiXvcAngzgNGU0+bE6TkjIEoGIXFs+CFN69xpk37hQYcxTUUApS8L0
rjpf5MqtJsxOYUPl/VemN3DOQyuwlMOS6eFfqhBJt2nk4NAfZKQrzR9voPiEJBjO
eT2pkb9UGBOJmVQRDVXFJgt5T1ocbvlj2xSApAer+rKluYjdkf5lO6Sjeb6JTeHQ
sPTIFwwKlhR8Cbds4cLYVdQYoKpBaXAko7nv6VrcPuuUSvC33l8Odvr7+2kDRUBQ
7nIMpBKGgc0T0U7EPMpODdIm8QC3tKai4W56gf0wrHofx1l7
-----END CERTIFICATE-----

View file

@ -1,117 +0,0 @@
#!rsc
# RouterOS script: check-certificates
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# check for certificate validity
:global Identity;
:global CertRenewUrl;
:global CertRenewPass;
:global SendNotification;
:local GetIssuerCN do={
:foreach IssuerI in=$1 do={
:if ([ :pick $IssuerI 0 3 ] = "CN=") do={
:return [ :pick $IssuerI 3 99 ];
}
}
}
:local FormatExpire do={
:global CharacterReplace;
:return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ];
}
:foreach Cert in=[ / certificate find where !revoked expires-after<3w ] do={
:local CertName [ / certificate get $Cert name ];
:local CommonName [ / certificate get $Cert common-name ];
:local FingerPrint [ / certificate get $Cert fingerprint ];
:do {
:if ([ :len $CertRenewUrl ] = 0) do={
:error "No CertRenewUrl given.";
}
/ tool fetch mode=https check-certificate=yes-without-crl url=($CertRenewUrl . $CommonName . ".pem");
:foreach PassPhrase in=$CertRenewPass do={
/ certificate import file-name=($CommonName . ".pem") passphrase=$PassPhrase;
}
/ file remove [ find where name=($CommonName . ".pem") ];
:local CertNew [ / certificate find where common-name=$CommonName fingerprint!=$FingerPrint expires-after>3w ];
:local CertNameNew [ / certificate get $CertNew name ];
:foreach IpService in=[ / ip service find where certificate=$CertName ] do={
/ ip service set $IpService certificate=$CertNameNew;
}
:do {
:foreach Identity in=[ / ip ipsec identity find where certificate=$CertName ] do={
/ ip ipsec identity set $Identity certificate=$CertNameNew;
}
:foreach Identity in=[ / ip ipsec identity find where remote-certificate=$CertName ] do={
/ ip ipsec identity set $Identity remote-certificate=$CertNameNew;
}
} on-error={
:log debug ("Setting IPSEC certificates failed. Package 'security' not installed?");
}
:do {
:foreach Hotspot in=[ / ip hotspot profile find where ssl-certificate=$CertName ] do={
/ ip hotspot profile set $Hotspot ssl-certificate=$CertNameNew;
}
} on-error={
:log debug ("Setting hotspot certificates failed. Package 'hotspot' not installed?");
}
/ certificate remove $Cert;
/ certificate set $CertNew name=$CertName;
:set CommonName [ / certificate get $CertNew common-name ];
:set FingerPrint [ / certificate get $CertNew fingerprint ];
:local Issuer [ $GetIssuerCN [ / certificate get $CertNew issuer ] ];
:local InvalidBefore [ / certificate get $CertNew invalid-before ];
:local InvalidAfter [ / certificate get $CertNew invalid-after ];
:local ExpiresAfter [ $FormatExpire [ / certificate get $CertNew expires-after ] ];
$SendNotification ("Certificate renewed") \
("A certificate on " . $Identity . " has been renewed.\n\n" . \
"Name: " . $CertName . "\n" . \
"CommonName: " . $CommonName . "\n" . \
"Fingerprint: " . $FingerPrint . "\n" . \
"Issuer: " . $Issuer . "\n" . \
"Validity: " . $InvalidBefore . " to " . $InvalidAfter . "\n" . \
"Expires in: " . $ExpiresAfter);
:log info ("The certificate " . $CertName . " has been renewed.");
} on-error={
:log debug ("Could not renew certificate " . $CertName ".");
}
}
:foreach Cert in=[ / certificate find where !revoked expires-after<2w ] do={
:local CertName [ / certificate get $Cert name ];
:local CommonName [ / certificate get $Cert common-name ];
:local FingerPrint [ / certificate get $Cert fingerprint ];
:local Issuer [ $GetIssuerCN [ / certificate get $Cert issuer ] ];
:local InvalidBefore [ / certificate get $Cert invalid-before ];
:local InvalidAfter [ / certificate get $Cert invalid-after ];
:local ExpiresAfter [ $FormatExpire [ / certificate get $Cert expires-after ] ];
:local State "is about to expire";
:if ([ / certificate get $Cert expired ] = true) do={
:set ExpiresAfter "expired";
:set State "expired";
}
$SendNotification ("Certificate warning!") \
("A certificate on " . $Identity . " " . $State . ".\n\n" . \
"Name: " . $CertName . "\n" . \
"CommonName: " . $CommonName . "\n" . \
"Fingerprint: " . $FingerPrint . "\n" . \
"Issuer: " . $Issuer . "\n" . \
"Validity: " . $InvalidBefore . " to " . $InvalidAfter . "\n" . \
"Expires in: " . $ExpiresAfter);
:log warning ("The certificate " . $CertName . " " . $State . \
", it is invalid after " . $InvalidAfter . ".");
}

242
check-certificates.rsc Normal file
View file

@ -0,0 +1,242 @@
#!rsc by RouterOS
# RouterOS script: check-certificates
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires device-mode, fetch
#
# check for certificate validity
# https://rsc.eworm.de/doc/check-certificates.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CertRenewTime;
:global CertRenewUrl;
:global CertWarnTime;
:global Identity;
:global CertificateAvailable
:global EscapeForRegEx;
:global IfThenElse;
:global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitFullyConnected;
:local CheckCertificatesDownloadImport do={
:local ScriptName [ :tostr $1 ];
:local CertName [ :tostr $2 ];
:local FetchName [ :tostr $3 ];
:global CertRenewUrl;
:global CertRenewPass;
:global CertificateNameByCN;
:global EscapeForRegEx;
:global FetchUserAgentStr;
:global LogPrint;
:global RmFile;
:global UrlEncode;
:global WaitForFile;
:foreach Type in={ "p12"; "pem" } do={
:local CertFileName ([ $UrlEncode $FetchName ] . "." . $Type);
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
"' (file '" . $CertFileName . "')...");
:do {
/tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \
($CertRenewUrl . $CertFileName) dst-path=$CertFileName as-value;
$WaitForFile $CertFileName;
:local DecryptionFailed true;
:foreach I,PassPhrase in=$CertRenewPass do={
:do {
$LogPrint debug $ScriptName ("Trying " . $I . ". passphrase... ");
:local Result [ /certificate/import file-name=$CertFileName passphrase=$PassPhrase as-value ];
:if ($Result->"decryption-failures" = 0) do={
$LogPrint debug $ScriptName ("Success!");
:set DecryptionFailed false;
}
} on-error={ }
}
$RmFile $CertFileName;
:if ($DecryptionFailed = true) do={
$LogPrint warning $ScriptName ("Decryption failed for certificate file '" . $CertFileName . "'.");
}
:foreach CertInChain in=[ /certificate/find where common-name!=$CertName !private-key \
name~("^" . [ $EscapeForRegEx $CertFileName ] . "_[0-9]+\$") \
!(subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $CertName ] . "(\\W|\$)")) \
!(common-name=[]) ] do={
$CertificateNameByCN [ /certificate/get $CertInChain common-name ];
}
:return true;
} on-error={
$LogPrint debug $ScriptName ("Could not download certificate file '" . $CertFileName . "'.");
}
}
:return false;
}
:local FormatInfo do={
:local Cert $1;
:global FormatLine;
:global FormatMultiLines;
:global IfThenElse;
:local FormatExpire do={
:global CharacterReplace;
:return [ $CharacterReplace [ $CharacterReplace [ :tostr $1 ] "w" "w " ] "d" "d " ];
}
:local FormatCertChain do={
:local Cert $1;
:global EitherOr;
:global ParseKeyValueStore;
:local CertVal [ /certificate/get $Cert ];
:if ([ :typeof ($CertVal->"issuer") ] = "nothing") do={
:return "self-signed";
}
:local Return "";
:for I from=0 to=5 do={
:set Return ($Return . [ $EitherOr ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") \
([ $ParseKeyValueStore (($CertVal->"issuer")->0) ]->"CN") ]);
:set CertVal [ /certificate/get [ find where skid=($CertVal->"akid") ] ];
:if (($CertVal->"akid") = "" || ($CertVal->"akid") = ($CertVal->"skid")) do={
:return $Return;
}
:set Return ($Return . " -> ");
}
:return ($Return . "...");
}
:local CertVal [ /certificate/get $Cert ];
:return ( \
[ $FormatLine "Name" ($CertVal->"name") ] . "\n" . \
[ $IfThenElse ([ :len ($CertVal->"common-name") ] > 0) ([ $FormatLine "CommonName" ($CertVal->"common-name") ] . "\n") ] . \
[ $IfThenElse ([ :len ($CertVal->"subject-alt-name") ] > 0) ([ $FormatMultiLines "SubjectAltNames" ($CertVal->"subject-alt-name") ] . "\n") ] . \
[ $FormatLine "Private key" [ $IfThenElse (($CertVal->"private-key") = true) "available" "missing" ] ] . "\n" . \
[ $FormatLine "Fingerprint" ($CertVal->"fingerprint") ] . "\n" . \
[ $IfThenElse ([ :len ($CertVal->"ca") ] > 0) [ $FormatLine "Issuer" ($CertVal->"ca") ] [ $FormatLine "Issuer chain" [ $FormatCertChain $Cert ] ] ] . "\n" . \
"Validity:\n" . \
[ $FormatLine " from" ($CertVal->"invalid-before") ] . "\n" . \
[ $FormatLine " to" ($CertVal->"invalid-after") ] . "\n" . \
[ $FormatLine "Expires in" [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ] ]);
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:foreach Cert in=[ /certificate/find where !revoked !ca !scep-url expires-after<$CertRenewTime ] do={
:local CertVal [ /certificate/get $Cert ];
:local LastName;
:local FetchName;
:do {
:if ([ :len $CertRenewUrl ] = 0) do={
$LogPrint info $ScriptName ("No CertRenewUrl given.");
:error false;
}
$LogPrint info $ScriptName ("Attempting to renew certificate '" . ($CertVal->"name") . "'.");
:local ImportSuccess false;
:set LastName ($CertVal->"common-name");
:set FetchName $LastName;
:set ImportSuccess [ $CheckCertificatesDownloadImport $ScriptName $LastName $FetchName ];
:foreach SAN in=($CertVal->"subject-alt-name") do={
:if ($ImportSuccess = false) do={
:set LastName [ :pick $SAN ([ :find $SAN ":" ] + 1) [ :len $SAN ] ];
:set FetchName $LastName;
:set ImportSuccess [ $CheckCertificatesDownloadImport $ScriptName $LastName $FetchName ];
:if ($ImportSuccess = false && [ :pick $LastName 0 2 ] = "*.") do={
:set FetchName ("star." . [ :pick $LastName 2 [ :len $LastName ] ]);
:set ImportSuccess [ $CheckCertificatesDownloadImport $ScriptName $LastName $FetchName ];
}
}
}
:if ($ImportSuccess = false) do={ :error false; }
:if ([ :len ($CertVal->"fingerprint") ] > 0 && $CertVal->"fingerprint" != [ /certificate/get $Cert fingerprint ]) do={
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was updated in place.");
:set CertVal [ /certificate/get $Cert ];
} else={
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>$CertRenewTime ];
:local CertNewVal [ /certificate/get $CertNew ];
:if ([ $CertificateAvailable ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") ] = false) do={
$LogPrint warning $ScriptName ("The certificate chain is not available!");
}
:if (($CertVal->"private-key") = true && ($CertVal->"private-key") != ($CertNewVal->"private-key")) do={
/certificate/remove $CertNew;
$LogPrint warning $ScriptName ("Old certificate '" . ($CertVal->"name") . "' has a private key, new certificate does not. Aborting renew.");
:error false;
}
/ip/service/set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
/ip/ipsec/identity/set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
/ip/ipsec/identity/set remote-certificate=($CertNewVal->"name") [ find where remote-certificate=($CertVal->"name") ];
/ip/hotspot/profile/set ssl-certificate=($CertNewVal->"name") [ find where ssl-certificate=($CertVal->"name") ];
/certificate/remove $Cert;
/certificate/set $CertNew name=($CertVal->"name");
:set Cert $CertNew;
:set CertVal [ /certificate/get $CertNew ];
}
$SendNotification2 ({ origin=$ScriptName; silent=true; \
subject=([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed: " . ($CertVal->"name")); \
message=("A certificate on " . $Identity . " has been renewed.\n\n" . [ $FormatInfo $Cert ]) });
$LogPrint info $ScriptName ("The certificate '" . ($CertVal->"name") . "' has been renewed.");
} on-error={
$LogPrint debug $ScriptName ("Could not renew certificate '" . ($CertVal->"name") . "'.");
}
}
:foreach Cert in=[ /certificate/find where !revoked !scep-url !(expires-after=[]) \
expires-after<$CertWarnTime !(fingerprint=[]) ] do={
:local CertVal [ /certificate/get $Cert ];
:if ([ :len [ /certificate/scep-server/find where ca-cert=($CertVal->"ca") ] ] > 0) do={
$LogPrint debug $ScriptName ("Certificate '" . ($CertVal->"name") . "' is handled by SCEP, skipping.");
} else={
:local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ];
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "warning-sign" ] . "Certificate warning: " . ($CertVal->"name")); \
message=("A certificate on " . $Identity . " " . $State . ".\n\n" . [ $FormatInfo $Cert ]) });
$LogPrint info $ScriptName ("The certificate '" . ($CertVal->"name") . "' " . $State . \
", it is invalid after " . ($CertVal->"invalid-after") . ".");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

48
check-health.d/state.rsc Normal file
View file

@ -0,0 +1,48 @@
#!rsc by RouterOS
# RouterOS script: check-health.d/state
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# check for RouterOS health state - state plugin
# https://rsc.eworm.de/doc/check-health.md
:global CheckHealthPlugins;
:set ($CheckHealthPlugins->[ :jobname ]) do={
:local FuncName [ :tostr $0 ];
:global CheckHealthLast;
:global Identity;
:global LogPrint;
:global SendNotification2;
:global SymbolForNotification;
:if ([ :len [ /system/health/find where type="" name~"-state\$"] ] = 0) do={
$LogPrint debug $FuncName ("Your device does not provide any state health values.");
:return false;
}
:foreach State in=[ /system/health/find where type="" name~"-state\$" ] do={
:local Name [ /system/health/get $State name ];
:local Value [ /system/health/get $State value ];
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
:if ($CheckHealthLast->$Name = "ok" && \
$Value != "ok") do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
message=("The device '" . $Name . "' on " . $Identity . " failed!") });
}
:if ($CheckHealthLast->$Name != "ok" && \
$Value = "ok") do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
message=("The device '" . $Name . "' on " . $Identity . " recovered!") });
}
}
:set ($CheckHealthLast->$Name) $Value;
}
}

View file

@ -0,0 +1,74 @@
#!rsc by RouterOS
# RouterOS script: check-health.d/temperature
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# check for RouterOS health state - temperature plugin
# https://rsc.eworm.de/doc/check-health.md
:global CheckHealthPlugins;
:set ($CheckHealthPlugins->[ :jobname ]) do={
:local FuncName [ :tostr $0 ];
:global CheckHealthLast;
:global CheckHealthTemperature;
:global CheckHealthTemperatureDeviation;
:global CheckHealthTemperatureNotified;
:global Identity;
:global LogPrint;
:global SendNotification2;
:global SymbolForNotification;
:if ([ :len [ /system/health/find where type="C" ] ] = 0) do={
$LogPrint debug $FuncName ("Your device does not provide any voltage health values.");
:return false;
}
:local TempToNum do={
:global CharacterReplace;
:local T [ :toarray [ $CharacterReplace $1 "." "," ] ];
:return ($T->0 * 10 + $T->1);
}
:if ([ :typeof $CheckHealthTemperatureNotified ] != "array") do={
:set CheckHealthTemperatureNotified ({});
}
:foreach Temperature in=[ /system/health/find where type="C" ] do={
:local Name [ /system/health/get $Temperature name ];
:local Value [ /system/health/get $Temperature value ];
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
:if ([ :typeof ($CheckHealthTemperature->$Name) ] != "num" ) do={
$LogPrint info $FuncName ("No threshold given for " . $Name . ", assuming 50C.");
:set ($CheckHealthTemperature->$Name) 50;
}
:local Validate [ /system/health/get [ find where name=$Name ] value ];
:while ($Value != $Validate) do={
:set Value $Validate;
:set Validate [ /system/health/get [ find where name=$Name ] value ];
}
:if ($Value > $CheckHealthTemperature->$Name && \
$CheckHealthTemperatureNotified->$Name != true) do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \
message=("The " . $Name . " on " . $Identity . " is above threshold: " . \
$Value . "\C2\B0" . "C") });
:set ($CheckHealthTemperatureNotified->$Name) true;
}
:if ($Value <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \
$CheckHealthTemperatureNotified->$Name = true) do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \
$Value . "\C2\B0" . "C") });
:set ($CheckHealthTemperatureNotified->$Name) false;
}
}
:set ($CheckHealthLast->$Name) $Value;
}
}

View file

@ -0,0 +1,63 @@
#!rsc by RouterOS
# RouterOS script: check-health.d/voltage
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# check for RouterOS health state - voltage plugin
# https://rsc.eworm.de/doc/check-health.md
:global CheckHealthPlugins;
:set ($CheckHealthPlugins->[ :jobname ]) do={
:local FuncName [ :tostr $0 ];
:global CheckHealthLast;
:global CheckHealthVoltageLow;
:global CheckHealthVoltagePercent;
:global Identity;
:global FormatLine;
:global IfThenElse;
:global LogPrint;
:global SendNotification2;
:global SymbolForNotification;
:if ([ :len [ /system/health/find where type="V" ] ] = 0) do={
$LogPrint debug $FuncName ("Your device does not provide any voltage health values.");
:return false;
}
:foreach Voltage in=[ /system/health/find where type="V" ] do={
:local Name [ /system/health/get $Voltage name ];
:local Value [ /system/health/get $Voltage value ];
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
:local NumCurr [ $TempToNum $Value ];
:local NumLast [ $TempToNum ($CheckHealthLast->$Name) ];
:if ($NumLast * (100 + $CheckHealthVoltagePercent) < $NumCurr * 100 || \
$NumLast * 100 > $NumCurr * (100 + $CheckHealthVoltagePercent)) do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification ("high-voltage-sign,chart-" . [ $IfThenElse ($NumLast < \
$NumCurr) "in" "de" ] . "creasing") ] . "Health warning: " . $Name); \
message=("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
[ $FormatLine "old value" ($CheckHealthLast->$Name . " V") 12 ] . "\n" . \
[ $FormatLine "new value" ($Value . " V") 12 ]) });
} else={
:if ($NumCurr <= $CheckHealthVoltageLow && $NumLast > $CheckHealthVoltageLow) do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "high-voltage-sign,chart-decreasing" ] . "Health warning: Low " . $Name); \
message=("The " . $Name . " on " . $Identity . " dropped to " . $Value . " V below hard limit.") });
}
:if ($NumCurr > $CheckHealthVoltageLow && $NumLast <= $CheckHealthVoltageLow) do={
$SendNotification2 ({ origin=$FuncName; \
subject=([ $SymbolForNotification "high-voltage-sign,chart-increasing" ] . "Health recovery: Low " . $Name); \
message=("The " . $Name . " on " . $Identity . " recovered to " . $Value . " V above hard limit.") });
}
}
}
:set ($CheckHealthLast->$Name) $Value;
}
}

110
check-health.rsc Normal file
View file

@ -0,0 +1,110 @@
#!rsc by RouterOS
# RouterOS script: check-health
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# check for RouterOS health state
# https://rsc.eworm.de/doc/check-health.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global CheckHealthCPUUtilization;
:global CheckHealthCPUUtilizationNotified;
:global CheckHealthLast;
:global CheckHealthRAMUtilizationNotified;
:global Identity;
:global FormatLine;
:global HumanReadableNum;
:global IfThenElse;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global ValidateSyntax;
:local TempToNum do={
:global CharacterReplace;
:local T [ :toarray [ $CharacterReplace $1 "." "," ] ];
:return ($T->0 * 10 + $T->1);
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:local Resource [ /system/resource/get ];
:set CheckHealthCPUUtilization (($CheckHealthCPUUtilization * 4 + ($Resource->"cpu-load") * 10) / 5);
:if ($CheckHealthCPUUtilization > 750 && $CheckHealthCPUUtilizationNotified != true) do={
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "abacus,chart-increasing" ] . "Health warning: CPU utilization"); \
message=("The average CPU utilization on " . $Identity . " is at " . ($CheckHealthCPUUtilization / 10) . "%!") });
:set CheckHealthCPUUtilizationNotified true;
}
:if ($CheckHealthCPUUtilization < 650 && $CheckHealthCPUUtilizationNotified = true) do={
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "abacus,chart-decreasing" ] . "Health recovery: CPU utilization"); \
message=("The average CPU utilization on " . $Identity . " decreased to " . ($CheckHealthCPUUtilization / 10) . "%.") });
:set CheckHealthCPUUtilizationNotified false;
}
:local CheckHealthRAMUtilization (($Resource->"total-memory" - $Resource->"free-memory") * 100 / $Resource->"total-memory");
:if ($CheckHealthRAMUtilization >=80 && $CheckHealthRAMUtilizationNotified != true) do={
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "card-file-box,chart-increasing" ] . "Health warning: RAM utilization"); \
message=("The RAM utilization on " . $Identity . " is at " . $CheckHealthRAMUtilization . "%!\n\n" . \
[ $FormatLine "total" ([ $HumanReadableNum ($Resource->"total-memory") 1024 ] . "B") 8 ] . "\n" . \
[ $FormatLine "used" ([ $HumanReadableNum ($Resource->"total-memory" - $Resource->"free-memory") 1024 ] . "B") 8 ] . "\n" . \
[ $FormatLine "free" ([ $HumanReadableNum ($Resource->"free-memory") 1024 ] . "B") 8 ]) });
:set CheckHealthRAMUtilizationNotified true;
}
:if ($CheckHealthRAMUtilization < 70 && $CheckHealthRAMUtilizationNotified = true) do={
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "card-file-box,chart-decreasing" ] . "Health recovery: RAM utilization"); \
message=("The RAM utilization on " . $Identity . " decreased to " . $CheckHealthRAMUtilization . "%.") });
:set CheckHealthRAMUtilizationNotified false;
}
:local Plugins [ /system/script/find where name~"^check-health.d/." ];
:if ([ :len $Plugins ] = 0) do={
$LogPrint debug $ScriptName ("No plugins installed.");
:set ExitOK true;
:error true;
}
:global CheckHealthPlugins ({});
:if ([ :typeof $CheckHealthLast ] != "array") do={
:set CheckHealthLast ({});
}
:foreach Plugin in=$Plugins do={
:local PluginVal [ /system/script/get $Plugin ];
:if ([ $ValidateSyntax ($PluginVal->"source") ] = true) do={
:do {
/system/script/run $Plugin;
} on-error={
$LogPrint error $ScriptName ("Plugin '" . $ScriptVal->"name" . "' failed to run.");
}
} else={
$LogPrint error $ScriptName ("Plugin '" . $ScriptVal->"name" . "' failed syntax validation, skipping.");
}
}
:foreach PluginName,Discard in=$CheckHealthPlugins do={
($CheckHealthPlugins->$PluginName) \
("\$CheckHealthPlugins->\"" . $PluginName . "\"");
}
:set CheckHealthPlugins;
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,32 +0,0 @@
#!rsc
# RouterOS script: check-lte-firmware-upgrade
# Copyright (c) 2018-2019 Christian Hesse <mail@eworm.de>
#
# check for LTE firmware upgrade, send notification e-mails
:global Identity;
:global SentLteFirmwareUpgradeNotification;
:global SendNotification;
:foreach Interface in=[ / interface lte find ] do={
:local IntName [ / interface lte get $Interface name ];
:do {
:local Firmware [ / interface lte firmware-upgrade $Interface once as-value ];
:if ($SentLteFirmwareUpgradeNotification = ($Firmware->"latest")) do={
:log debug ("Already sent the LTE firmware upgrade notification for version " . \
($Firmware->"latest") . ".");
} else={
:if (($Firmware->"installed") != ($Firmware->"latest")) do={
$SendNotification ("LTE firmware upgrade notification") \
("A new firmware version " . ($Firmware->"latest") . " is available for " . \
"LTE interface " . $IntName . " on " . $Identity . ".");
:set SentLteFirmwareUpgradeNotification ($Firmware->"latest");
}
}
} on-error={
:log debug ("Could not get latest LTE firmware version for interface " . \
$IntName . ".");
}
}

View file

@ -0,0 +1,107 @@
#!rsc by RouterOS
# RouterOS script: check-lte-firmware-upgrade
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# check for LTE firmware upgrade, send notification
# https://rsc.eworm.de/doc/check-lte-firmware-upgrade.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global SentLteFirmwareUpgradeNotification;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :typeof $SentLteFirmwareUpgradeNotification ] != "array") do={
:global SentLteFirmwareUpgradeNotification ({});
}
:local CheckInterface do={
:local ScriptName $1;
:local Interface $2;
:global Identity;
:global SentLteFirmwareUpgradeNotification;
:global FormatLine;
:global IfThenElse;
:global LogPrint;
:global ScriptFromTerminal;
:global SendNotification2;
:global SymbolForNotification;
:local IntName [ /interface/lte/get $Interface name ];
:local Firmware;
:local Info;
:do {
:set Firmware [ /interface/lte/firmware-upgrade $Interface as-value ];
:set Info [ /interface/lte/monitor $Interface once as-value ];
} on-error={
$LogPrint debug $ScriptName ("Could not get latest LTE firmware version for interface " . \
$IntName . ".");
:return false;
}
:if ([ :len ($Firmware->"latest") ] = 0) do={
$LogPrint info $ScriptName ("An empty string is not a valid version.");
:return false;
}
:if (($Firmware->"installed") = ($Firmware->"latest")) do={
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
$LogPrint info $ScriptName ("No firmware upgrade available for LTE interface " . $IntName . ".");
}
:return true;
}
:if ([ $ScriptFromTerminal $ScriptName ] = true && \
[ :len [ /system/script/find where name="unattended-lte-firmware-upgrade" ] ] > 0) do={
:put ("Do you want to start unattended lte firmware upgrade for interface " . $IntName . "? [y/N]");
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
/system/script/run unattended-lte-firmware-upgrade;
$LogPrint info $ScriptName ("Scheduled lte firmware upgrade for interface " . $IntName . "...");
:return true;
} else={
:put "Canceled...";
}
}
:if (($SentLteFirmwareUpgradeNotification->$IntName) = ($Firmware->"latest")) do={
$LogPrint debug $ScriptName ("Already sent the LTE firmware upgrade notification for version " . \
($Firmware->"latest") . ".");
:return false;
}
$LogPrint info $ScriptName ("A new firmware version " . ($Firmware->"latest") . " is available for " . \
"LTE interface " . $IntName . ".");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "LTE firmware upgrade"); \
message=("A new firmware version " . ($Firmware->"latest") . " is available for " . \
"LTE interface " . $IntName . " on " . $Identity . ".\n\n" . \
[ $IfThenElse ([ :len ($Info->"manufacturer") ] > 0) ([ $FormatLine "Manufacturer" ($Info->"manufacturer") ] . "\n") ] . \
[ $IfThenElse ([ :len ($Info->"model") ] > 0) ([ $FormatLine "Model" ($Info->"model") ] . "\n") ] . \
[ $IfThenElse ([ :len ($Info->"revision") ] > 0) ([ $FormatLine "Revision" ($Info->"revision") ] . "\n") ] . \
"Firmware version:\n" . \
[ $FormatLine " Installed" ($Firmware->"installed") ] . "\n" . \
[ $FormatLine " Available" ($Firmware->"latest") ]); silent=true });
:set ($SentLteFirmwareUpgradeNotification->$IntName) ($Firmware->"latest");
}
:foreach Interface in=[ /interface/lte/find ] do={
$CheckInterface $ScriptName $Interface;
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,82 +0,0 @@
#!rsc
# RouterOS script: check-routeros-update
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# check for RouterOS update, send notification e-mails
:global Identity;
:global SafeUpdateUrl;
:global SentRouterosUpdateNotification;
:global SendNotification;
:local Update do={
:if ([ / system script print count-only where name="packages-update" ] > 0) do={
/ system script run packages-update;
} else={
/ system package update install without-paging;
}
:error "Waiting for system to reboot.";
}
:if ([ / system package print count-only where name="wireless" disabled=no ] > 0) do={
:if ([ / interface wireless cap get enabled ] = true && \
[ / caps-man manager get enabled ] = false) do={
:error "System is managed by CAPsMAN, not checking.";
}
}
/ system package update check-for-updates without-paging;
:local InstalledVersion [ / system package update get installed-version ];
:local LatestVersion [ / system package update get latest-version ];
:if ($InstalledVersion != $LatestVersion) do={
:local Channel [ / system package update get channel ];
:local BoardName [ / system resource get board-name ];
:local Model [ / system routerboard get model ];
:local SerialNumber [ / system routerboard get serial-number ];
:if ([ :len $SafeUpdateUrl ] > 0) do={
:local Result;
:do {
:set Result [ / tool fetch check-certificate=yes-without-crl \
($SafeUpdateUrl . $Channel . "?installed=" . $InstalledVersion . \
"&latest=" . $LatestVersion) output=user as-value ];
} on-error={
:log warning ("Failed receiving safe version for " . $Channel . ".");
}
:if ($Result->"status" = "finished" && $Result->"data" = $LatestVersion) do={
:log info ("Version " . $LatestVersion . " is considered safe, updating...");
$SendNotification ("RouterOS update notification") \
("Version " . $LatestVersion . " is considered safe for " . $Channel . \
", updating on " . $Identity . "...");
$Update;
}
}
:if ([ / system script job print count-only where script="check-routeros-update" parent~"." ] > 0) do={
:put ("Do you want to install RouterOS version " . $LatestVersion . "? [y/N]");
:if ([ :terminal inkey timeout=60 ] = 121) do={
$Update;
} else={
:put "Canceled...";
}
}
:if ($SentRouterosUpdateNotification = $LatestVersion) do={
:error ("Already sent the RouterOS update notification for version " . \
$LatestVersion . ".");
}
$SendNotification ("RouterOS update notification") \
("There is a RouterOS update available\n\n" . \
"Board name: " . $BoardName . "\n" . \
"Model: " . $Model . "\n" . \
"Serial number: " . $SerialNumber . "\n" . \
"Hostname: " . $Identity . "\n" . \
"Channel: " . $Channel . "\n" . \
"Installed: " . $InstalledVersion . "\n" . \
"Available: " . $LatestVersion . "\n\n" .\
"https://upgrade.mikrotik.com/routeros/" . $LatestVersion . "/CHANGELOG");
:set SentRouterosUpdateNotification $LatestVersion;
}

239
check-routeros-update.rsc Normal file
View file

@ -0,0 +1,239 @@
#!rsc by RouterOS
# RouterOS script: check-routeros-update
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
# requires device-mode, fetch, scheduler
#
# check for RouterOS update, send notification and/or install
# https://rsc.eworm.de/doc/check-routeros-update.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global Identity;
:global SafeUpdateAll;
:global SafeUpdateNeighbor;
:global SafeUpdateNeighborIdentity;
:global SafeUpdatePatch;
:global SafeUpdateUrl;
:global SentRouterosUpdateNotification;
:global DeviceInfo;
:global EscapeForRegEx;
:global FetchUserAgentStr;
:global LogPrint;
:global ScriptFromTerminal;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global VersionToNum;
:global WaitFullyConnected;
:local DoUpdate do={
:local ScriptName [ :tostr $1 ];
:global LogPrint;
:if ([ :len [ /system/script/find where name="packages-update" ] ] > 0) do={
/system/script/run packages-update;
} else={
/system/package/update/install without-paging;
}
$LogPrint info $ScriptName ("Waiting for system to reboot.");
}
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :len [ /system/scheduler/find where name="running-from-backup-partition" ] ] > 0) do={
$LogPrint warning $ScriptName ("Running from backup partition, refusing to act.");
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
:if ([ :len [ /system/scheduler/find where name="_RebootForUpdate" ] ] > 0) do={
:set ExitOK true;
:error "A reboot for update is already scheduled.";
}
:local License [ /system/license/get ];
:if ([ :typeof ($License->"deadline-at") ] = "str") do={
:if ([ :len ($License->"next-renewal-at") ] = 0 && ($License->"limited-upgrades") = true) do={
$LogPrint warning $ScriptName ("Your license expired on " . ($License->"deadline-at") . "!");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "warning-sign" ] . "License expired!"); \
message=("Your license expired on " . ($License->"deadline-at") . \
", can no longer update RouterOS on " . $Identity . "...") });
:set ExitOK true;
:error false;
}
:if ([ :totime ($License->"deadline-at") ] - 3w < [ :timestamp ]) do={
$LogPrint warning $ScriptName ("Your license will expire on " . ($License->"deadline-at") . "!");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "warning-sign" ] . "License about to expire!"); \
message=("Your license failed to renew and is about to expire on " . \
($License->"deadline-at") . " on " . $Identity . "...") });
}
}
$LogPrint debug $ScriptName ("Checking for updates...");
/system/package/update/check-for-updates without-paging as-value;
:local Update [ /system/package/update/get ];
:if (($Update->"installed-version") = ($Update->"latest-version")) do={
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
$LogPrint info $ScriptName ("System is already up to date.");
}
:set ExitOK true;
:error true;
}
:if ([ :len ($Update->"latest-version") ] = 0) do={
$LogPrint info $ScriptName ("Received an empty version string from server.");
:set ExitOK true;
:error false;
}
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
:local BitMask [ $VersionToNum "255.255zero0" ];
:local NumInstalledFeature ($NumInstalled & $BitMask);
:local NumLatestFeature ($NumLatest & $BitMask);
:local Link ("https://mikrotik.com/download/changelogs/" . $Update->"channel" . "-release-tree");
:if ($NumLatest < [ $VersionToNum "7.0" ]) do={
$LogPrint warning $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.");
:set ExitOK true;
:error false;
}
:if ($NumInstalled < $NumLatest) do={
:if ($SafeUpdateAll ~ "^YES,? ?PLEASE!?\$") do={
$LogPrint info $ScriptName ("Installing ALL versions automatically, including " . \
$Update->"latest-version" . "...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Installing ALL versions automatically, including " . $Update->"latest-version" . \
"... Updating on " . $Identity . "..."); link=$Link; silent=true });
$DoUpdate $ScriptName;
:set ExitOK true;
:error true;
}
:if ($SafeUpdatePatch = true && $NumInstalledFeature = $NumLatestFeature) do={
$LogPrint info $ScriptName ("Version " . $Update->"latest-version" . " is a patch release, updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Version " . $Update->"latest-version" . " is a patch update for " . $Update->"channel" . \
", updating on " . $Identity . "..."); link=$Link; silent=true });
$DoUpdate $ScriptName;
:set ExitOK true;
:error true;
}
:if ($SafeUpdateNeighbor = true) do={
:local Neighbors [ /ip/neighbor/find where platform="MikroTik" identity~$SafeUpdateNeighborIdentity \
version~("^" . [ $EscapeForRegEx ($Update->"latest-version") ] . "\\b") ];
:if ([ :len $Neighbors ] > 0) do={
:local Neighbor [ /ip/neighbor/get ($Neighbors->0) identity ];
$LogPrint info $ScriptName ("Seen a neighbor (" . $Neighbor . ") running version " . \
$Update->"latest-version" . " from " . $Update->"channel" . ", updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Seen a neighbor (" . $Neighbor . ") running version " . $Update->"latest-version" . \
" from " . $Update->"channel" . ", updating on " . $Identity . "..."); link=$Link; silent=true });
$DoUpdate $ScriptName;
:set ExitOK true;
:error true;
}
}
:if ([ :len $SafeUpdateUrl ] > 0) do={
:local Result;
:do {
:set Result [ /tool/fetch check-certificate=yes-without-crl \
($SafeUpdateUrl . $Update->"channel" . "?installed=" . $Update->"installed-version" . \
"&latest=" . $Update->"latest-version") http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \
output=user as-value ];
} on-error={
$LogPrint warning $ScriptName ("Failed receiving safe version for " . $Update->"channel" . ".");
}
:if ($Result->"status" = "finished" && $Result->"data" = $Update->"latest-version") do={
$LogPrint info $ScriptName ("Version " . $Update->"latest-version" . " is considered safe, updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Version " . $Update->"latest-version" . " is considered safe for " . $Update->"channel" . \
", updating on " . $Identity . "..."); link=$Link; silent=true });
$DoUpdate $ScriptName;
:set ExitOK true;
:error true;
}
}
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
:if (($Update->"channel") = "testing" && $NumInstalledFeature < $NumLatestFeature) do={
:put ("This is a feature update in testing channel. Switch to channel 'stable'? [y/N]");
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
/system/package/update/set channel=stable;
$LogPrint info $ScriptName ("Switched to channel 'stable', please re-run!");
:set ExitOK true;
:error true;
}
}
:put ("Do you want to install RouterOS version " . $Update->"latest-version" . "? [y/N]");
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
$DoUpdate $ScriptName;
:set ExitOK true;
:error true;
} else={
:put "Canceled...";
}
}
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
$LogPrint info $ScriptName ("Already sent the RouterOS update notification for version " . \
$Update->"latest-version" . ".");
:set ExitOK true;
:error true;
}
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("A new RouterOS version " . ($Update->"latest-version") . \
" is available for " . $Identity . ".\n\n" . \
[ $DeviceInfo ]); link=$Link; silent=true });
:set SentRouterosUpdateNotification ($Update->"latest-version");
}
:if ($NumInstalled > $NumLatest) do={
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
$LogPrint info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
$Update->"latest-version" . ".");
:set ExitOK true;
:error true;
}
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "warning-sign" ] . "RouterOS version: " . $Update->"latest-version"); \
message=("A different RouterOS version " . ($Update->"latest-version") . \
" is available for " . $Identity . ", but it is a downgrade.\n\n" . \
[ $DeviceInfo ]); link=$Link; silent=true });
$LogPrint info $ScriptName ("A different RouterOS version " . ($Update->"latest-version") . \
" is available for downgrade.");
:set SentRouterosUpdateNotification ($Update->"latest-version");
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,62 +0,0 @@
#!rsc
# RouterOS script: collect-wireless-mac.capsman
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# collect wireless mac adresses in access list
#
# !! Do not edit this file, it is generated from template!
:global Identity;
:global GetMacVendor;
:global SendNotification;
:global ScriptLock;
$ScriptLock "collect-wireless-mac.capsman";
:local PlaceBefore [ / caps-man access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $PlaceBefore ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'";
}
:foreach RegTbl in=[ / caps-man registration-table find ] do={
:local Mac [ / caps-man registration-table get $RegTbl mac-address ];
:local AccessList ([ / caps-man access-list find where mac-address=$Mac ]->0);
:if ([ :len $AccessList ] = 0) do={
:local HostName "no dhcp lease";
:local Address "no dhcp lease";
:local Lease [ / ip dhcp-server lease find where mac-address=$Mac ];
:if ([ :len $Lease ] > 0) do={
:set HostName [ / ip dhcp-server lease get $Lease host-name ];
:set Address [ / ip dhcp-server lease get $Lease address ];
}
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:if ([ :len $Address ] = 0) do={
:set Address "no address";
}
:local RegEntry [ / caps-man registration-table find where mac-address=$Mac ];
:local Interface [ / caps-man registration-table get $RegEntry interface ];
:local Ssid [ / caps-man registration-table get $RegEntry ssid ];
:local DateTime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local Vendor [ $GetMacVendor $Mac ];
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
/ log info $Message;
/ caps-man access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
$SendNotification ($Mac . " connected to " . $Ssid) \
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
"Controller: " . $Identity . "\n" . \
"Interface: " . $Interface . "\n" . \
"SSID: " . $Ssid . "\n" . \
"MAC: " . $Mac . "\n" . \
"Vendor: " . $Vendor . "\n" . \
"Hostname: " . $HostName . "\n" . \
"Address: " . $Address . "\n" . \
"Date: " . $DateTime);
} else={
:local Comment [ / caps-man access-list get $AccessList comment ];
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
}
}

View file

@ -0,0 +1,100 @@
#!rsc by RouterOS
# RouterOS script: collect-wireless-mac.capsman
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: lease-script, order=40
# requires RouterOS, version=7.15
#
# collect wireless mac adresses in access list
# https://rsc.eworm.de/doc/collect-wireless-mac.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global Identity;
:global EitherOr;
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :len [ /caps-man/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- collected above ---" disabled=yes;
$LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- collected above ---" disabled ]->0);
:foreach Reg in=[ /caps-man/registration-table/find ] do={
:local RegVal;
:do {
:set RegVal [ /caps-man/registration-table/get $Reg ];
} on-error={
$LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /caps-man/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
$LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
[ /caps-man/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
:local Address "no dhcp lease";
:local DnsName "no dhcp lease";
:local HostName "no dhcp lease";
:local Lease ([ /ip/dhcp-server/lease/find where active-mac-address=($RegVal->"mac-address") dynamic=yes status=bound ]->0);
:if ([ :len $Lease ] > 0) do={
:set Address [ /ip/dhcp-server/lease/get $Lease active-address ];
:set HostName [ $EitherOr [ /ip/dhcp-server/lease/get $Lease host-name ] "no hostname" ];
:set DnsName "no dns name";
:local DnsRec ([ /ip/dns/static/find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName ({ [ /ip/dns/static/get $DnsRec name ] });
:foreach CName in=[ /ip/dns/static/find where type=CNAME cname=($DnsName->0) ] do={
:set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]);
}
}
}
:local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]);
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
$LogPrint info $ScriptName $Message;
/caps-man/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
message=("A device with unknown MAC address connected to " . $RegVal->"ssid" . " on " . $Identity . ".\n\n" . \
[ $FormatLine "Controller" $Identity ] . "\n" . \
[ $FormatLine "Interface" ($RegVal->"interface") ] . "\n" . \
[ $FormatLine "SSID" ($RegVal->"ssid") ] . "\n" . \
[ $FormatLine "MAC" ($RegVal->"mac-address") ] . "\n" . \
[ $FormatLine "Vendor" $Vendor ] . "\n" . \
[ $FormatLine "Hostname" $HostName ] . "\n" . \
[ $FormatLine "Address" $Address ] . "\n" . \
[ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \
[ $FormatLine "Date" $DateTime ]) });
}
} else={
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,62 +0,0 @@
#!rsc
# RouterOS script: collect-wireless-mac.local
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# collect wireless mac adresses in access list
#
# !! Do not edit this file, it is generated from template!
:global Identity;
:global GetMacVendor;
:global SendNotification;
:global ScriptLock;
$ScriptLock "collect-wireless-mac.local";
:local PlaceBefore [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $PlaceBefore ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'";
}
:foreach RegTbl in=[ / interface wireless registration-table find ] do={
:local Mac [ / interface wireless registration-table get $RegTbl mac-address ];
:local AccessList ([ / interface wireless access-list find where mac-address=$Mac ]->0);
:if ([ :len $AccessList ] = 0) do={
:local HostName "no dhcp lease";
:local Address "no dhcp lease";
:local Lease [ / ip dhcp-server lease find where mac-address=$Mac ];
:if ([ :len $Lease ] > 0) do={
:set HostName [ / ip dhcp-server lease get $Lease host-name ];
:set Address [ / ip dhcp-server lease get $Lease address ];
}
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:if ([ :len $Address ] = 0) do={
:set Address "no address";
}
:local RegEntry [ / interface wireless registration-table find where mac-address=$Mac ];
:local Interface [ / interface wireless registration-table get $RegEntry interface ];
:local Ssid [ / interface wireless get [ find where name=$Interface ] ssid ];
:local DateTime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local Vendor [ $GetMacVendor $Mac ];
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
/ log info $Message;
/ interface wireless access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
$SendNotification ($Mac . " connected to " . $Ssid) \
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
"Controller: " . $Identity . "\n" . \
"Interface: " . $Interface . "\n" . \
"SSID: " . $Ssid . "\n" . \
"MAC: " . $Mac . "\n" . \
"Vendor: " . $Vendor . "\n" . \
"Hostname: " . $HostName . "\n" . \
"Address: " . $Address . "\n" . \
"Date: " . $DateTime);
} else={
:local Comment [ / interface wireless access-list get $AccessList comment ];
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
}
}

View file

@ -0,0 +1,101 @@
#!rsc by RouterOS
# RouterOS script: collect-wireless-mac.local
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: lease-script, order=40
# requires RouterOS, version=7.15
#
# collect wireless mac adresses in access list
# https://rsc.eworm.de/doc/collect-wireless-mac.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global Identity;
:global EitherOr;
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :len [ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wireless/access-list/add comment="--- collected above ---" disabled=yes;
$LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ]->0);
:foreach Reg in=[ /interface/wireless/registration-table/find where ap=no ] do={
:local RegVal;
:do {
:set RegVal [ /interface/wireless/registration-table/get $Reg ];
} on-error={
$LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /interface/wireless/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
$LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
[ /interface/wireless/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
:local Address "no dhcp lease";
:local DnsName "no dhcp lease";
:local HostName "no dhcp lease";
:local Lease ([ /ip/dhcp-server/lease/find where active-mac-address=($RegVal->"mac-address") dynamic=yes status=bound ]->0);
:if ([ :len $Lease ] > 0) do={
:set Address [ /ip/dhcp-server/lease/get $Lease active-address ];
:set HostName [ $EitherOr [ /ip/dhcp-server/lease/get $Lease host-name ] "no hostname" ];
:set DnsName "no dns name";
:local DnsRec ([ /ip/dns/static/find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName ({ [ /ip/dns/static/get $DnsRec name ] });
:foreach CName in=[ /ip/dns/static/find where type=CNAME cname=($DnsName->0) ] do={
:set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]);
}
}
}
:set ($RegVal->"ssid") [ /interface/wireless/get [ find where name=($RegVal->"interface") ] ssid ];
:local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]);
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
$LogPrint info $ScriptName $Message;
/interface/wireless/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
message=("A device with unknown MAC address connected to " . $RegVal->"ssid" . " on " . $Identity . ".\n\n" . \
[ $FormatLine "Controller" $Identity ] . "\n" . \
[ $FormatLine "Interface" ($RegVal->"interface") ] . "\n" . \
[ $FormatLine "SSID" ($RegVal->"ssid") ] . "\n" . \
[ $FormatLine "MAC" ($RegVal->"mac-address") ] . "\n" . \
[ $FormatLine "Vendor" $Vendor ] . "\n" . \
[ $FormatLine "Hostname" $HostName ] . "\n" . \
[ $FormatLine "Address" $Address ] . "\n" . \
[ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \
[ $FormatLine "Date" $DateTime ]) });
}
} else={
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,64 +0,0 @@
#!rsc
# RouterOS script: collect-wireless-mac%TEMPL%
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# collect wireless mac adresses in access list
#
# !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'!
:global Identity;
:global GetMacVendor;
:global SendNotification;
:global ScriptLock;
$ScriptLock "collect-wireless-mac%TEMPL%";
:local PlaceBefore [ / %PATH% access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $PlaceBefore ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'";
}
:foreach RegTbl in=[ / %PATH% registration-table find ] do={
:local Mac [ / %PATH% registration-table get $RegTbl mac-address ];
:local AccessList ([ / %PATH% access-list find where mac-address=$Mac ]->0);
:if ([ :len $AccessList ] = 0) do={
:local HostName "no dhcp lease";
:local Address "no dhcp lease";
:local Lease [ / ip dhcp-server lease find where mac-address=$Mac ];
:if ([ :len $Lease ] > 0) do={
:set HostName [ / ip dhcp-server lease get $Lease host-name ];
:set Address [ / ip dhcp-server lease get $Lease address ];
}
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:if ([ :len $Address ] = 0) do={
:set Address "no address";
}
:local RegEntry [ / %PATH% registration-table find where mac-address=$Mac ];
:local Interface [ / %PATH% registration-table get $RegEntry interface ];
:local Ssid [ / caps-man registration-table get $RegEntry ssid ];
:local Ssid [ / interface wireless get [ find where name=$Interface ] ssid ];
:local DateTime ([ / system clock get date ] . " " . [ / system clock get time ]);
:local Vendor [ $GetMacVendor $Mac ];
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
/ log info $Message;
/ %PATH% access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
$SendNotification ($Mac . " connected to " . $Ssid) \
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
"Controller: " . $Identity . "\n" . \
"Interface: " . $Interface . "\n" . \
"SSID: " . $Ssid . "\n" . \
"MAC: " . $Mac . "\n" . \
"Vendor: " . $Vendor . "\n" . \
"Hostname: " . $HostName . "\n" . \
"Address: " . $Address . "\n" . \
"Date: " . $DateTime);
} else={
:local Comment [ / %PATH% access-list get $AccessList comment ];
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
}
}

View file

@ -0,0 +1,118 @@
#!rsc by RouterOS
# RouterOS script: collect-wireless-mac%TEMPL%
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: lease-script, order=40
# requires RouterOS, version=7.15
#
# collect wireless mac adresses in access list
# https://rsc.eworm.de/doc/collect-wireless-mac.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global Identity;
:global EitherOr;
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :len [ /caps-man/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
:if ([ :len [ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
:if ([ :len [ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- collected above ---" disabled=yes;
/interface/wifi/access-list/add comment="--- collected above ---" disabled=yes;
/interface/wireless/access-list/add comment="--- collected above ---" disabled=yes;
$LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- collected above ---" disabled ]->0);
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ]->0);
:local PlaceBefore ([ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ]->0);
:foreach Reg in=[ /caps-man/registration-table/find ] do={
:foreach Reg in=[ /interface/wifi/registration-table/find ] do={
:foreach Reg in=[ /interface/wireless/registration-table/find where ap=no ] do={
:local RegVal;
:do {
:set RegVal [ /caps-man/registration-table/get $Reg ];
:set RegVal [ /interface/wifi/registration-table/get $Reg ];
:set RegVal [ /interface/wireless/registration-table/get $Reg ];
} on-error={
$LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /caps-man/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:local AccessList ([ /interface/wifi/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:local AccessList ([ /interface/wireless/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
$LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
[ /caps-man/access-list/get $AccessList comment ]);
[ /interface/wifi/access-list/get $AccessList comment ]);
[ /interface/wireless/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
:local Address "no dhcp lease";
:local DnsName "no dhcp lease";
:local HostName "no dhcp lease";
:local Lease ([ /ip/dhcp-server/lease/find where active-mac-address=($RegVal->"mac-address") dynamic=yes status=bound ]->0);
:if ([ :len $Lease ] > 0) do={
:set Address [ /ip/dhcp-server/lease/get $Lease active-address ];
:set HostName [ $EitherOr [ /ip/dhcp-server/lease/get $Lease host-name ] "no hostname" ];
:set DnsName "no dns name";
:local DnsRec ([ /ip/dns/static/find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName ({ [ /ip/dns/static/get $DnsRec name ] });
:foreach CName in=[ /ip/dns/static/find where type=CNAME cname=($DnsName->0) ] do={
:set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]);
}
}
}
:set ($RegVal->"ssid") [ /interface/wireless/get [ find where name=($RegVal->"interface") ] ssid ];
:local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]);
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
$LogPrint info $ScriptName $Message;
/caps-man/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
/interface/wifi/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
/interface/wireless/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
message=("A device with unknown MAC address connected to " . $RegVal->"ssid" . " on " . $Identity . ".\n\n" . \
[ $FormatLine "Controller" $Identity ] . "\n" . \
[ $FormatLine "Interface" ($RegVal->"interface") ] . "\n" . \
[ $FormatLine "SSID" ($RegVal->"ssid") ] . "\n" . \
[ $FormatLine "MAC" ($RegVal->"mac-address") ] . "\n" . \
[ $FormatLine "Vendor" $Vendor ] . "\n" . \
[ $FormatLine "Hostname" $HostName ] . "\n" . \
[ $FormatLine "Address" $Address ] . "\n" . \
[ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \
[ $FormatLine "Date" $DateTime ]) });
}
} else={
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -0,0 +1,100 @@
#!rsc by RouterOS
# RouterOS script: collect-wireless-mac.wifi
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# provides: lease-script, order=40
# requires RouterOS, version=7.15
#
# collect wireless mac adresses in access list
# https://rsc.eworm.de/doc/collect-wireless-mac.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global Identity;
:global EitherOr;
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:set ExitOK true;
:error false;
}
:if ([ :len [ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wifi/access-list/add comment="--- collected above ---" disabled=yes;
$LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ]->0);
:foreach Reg in=[ /interface/wifi/registration-table/find ] do={
:local RegVal;
:do {
:set RegVal [ /interface/wifi/registration-table/get $Reg ];
} on-error={
$LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /interface/wifi/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
$LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
[ /interface/wifi/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
:local Address "no dhcp lease";
:local DnsName "no dhcp lease";
:local HostName "no dhcp lease";
:local Lease ([ /ip/dhcp-server/lease/find where active-mac-address=($RegVal->"mac-address") dynamic=yes status=bound ]->0);
:if ([ :len $Lease ] > 0) do={
:set Address [ /ip/dhcp-server/lease/get $Lease active-address ];
:set HostName [ $EitherOr [ /ip/dhcp-server/lease/get $Lease host-name ] "no hostname" ];
:set DnsName "no dns name";
:local DnsRec ([ /ip/dns/static/find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName ({ [ /ip/dns/static/get $DnsRec name ] });
:foreach CName in=[ /ip/dns/static/find where type=CNAME cname=($DnsName->0) ] do={
:set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]);
}
}
}
:local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]);
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
$LogPrint info $ScriptName $Message;
/interface/wifi/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
message=("A device with unknown MAC address connected to " . $RegVal->"ssid" . " on " . $Identity . ".\n\n" . \
[ $FormatLine "Controller" $Identity ] . "\n" . \
[ $FormatLine "Interface" ($RegVal->"interface") ] . "\n" . \
[ $FormatLine "SSID" ($RegVal->"ssid") ] . "\n" . \
[ $FormatLine "MAC" ($RegVal->"mac-address") ] . "\n" . \
[ $FormatLine "Vendor" $Vendor ] . "\n" . \
[ $FormatLine "Hostname" $HostName ] . "\n" . \
[ $FormatLine "Address" $Address ] . "\n" . \
[ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \
[ $FormatLine "Date" $DateTime ]) });
}
} else={
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -0,0 +1,12 @@
function invertHex(hex) {
return (Number("0x1" + hex) ^ 0xffffff).toString(16).substr(1);
}
function color() {
var svg = document.querySelector(".logo").getSVGDocument();
svg.getElementById("dark-1").setAttribute("stop-color", document.getElementById("color1").value);
svg.getElementById("dark-2").setAttribute("stop-color", document.getElementById("color2").value);
var background = document.getElementById("color3").value;
svg.getElementById("background").setAttribute("fill", background);
svg.getElementById("hexagon").setAttribute("stroke", "#" + invertHex(background.substring(1)));
}

View file

@ -0,0 +1,5 @@
body {
font-family: fira-sans, sans-serif;
font-size: 10pt;
background-color: transparent;
}

40
contrib/logo-color.html Normal file
View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RouterOS-Scripts Logo Color Changer</title>
<link rel="stylesheet" type="text/css" href="logo-color.d/style.css">
<script src="logo-color.d/script.js"></script>
</head>
<body>
<h1>RouterOS-Scripts Logo Color Changer</h1>
<p>You want the logo for your own notifications? But you joined the
<a href="https://t.me/routeros_scripts">Telegram Group</a> and want
something that differentiates? Color it!</p>
<embed class="logo" src="../logo.svg" width="192" height="192" type="image/svg+xml">
<p>Select the colors here:
<input id="color1" type="color" value="#222222" onchange="color();">
<input id="color2" type="color" value="#444444" onchange="color();">
<input id="color3" type="color" value="#ffffff" onchange="color();"></p>
<p>Then right-click, click "<i>Take Screenshot</i>" and finally select the
logo and download it.</p>
<p><img src="logo-color.d/browser-01.avif" width=533 height=482 alt="Screenshot Browser 01">
<img src="logo-color.d/browser-02.avif" width=533 height=482 alt="Screenshot Browser 02">
<img src="logo-color.d/browser-03.avif" width=533 height=482 alt="Screenshot Browser 03"></p>
<p>(This example is with
<a href="https://www.mozilla.org/de/firefox/new/">Firefox</a>. The workflow
for other browsers may differ.)</p>
<p>See how to
<a href="../../about/doc/mod/notification-telegram.md#set-a-profile-photo">Set
a profile photo</a> for your Telegram bot.</p>
</body>
</html>

View file

@ -0,0 +1,6 @@
function visible(cb, element) {
document.getElementById(element).style.display = cb.checked ? "block" : "none";
}
function update(cb, element) {
document.getElementById(element).innerHTML = cb.value;
}

View file

@ -0,0 +1,36 @@
body {
font-family: fira-sans, sans-serif;
font-size: 10pt;
background-color: transparent;
}
div.notification {
position: relative;
float: right;
width: 600px;
border: 3px outset #6c5d53;
/* border-radius: 5px; */
padding: 10px;
background-color: #e6e6e6;
}
div.content {
padding-left: 60px;
}
img.logo {
float: left;
border-radius: 50%;
}
p.heading {
margin: 0px;
font-weight: bold;
text-decoration: underline;
}
p.hint {
display: none;
}
pre {
font-family: fira-mono, monospace;
white-space: pre-wrap;
}
span.link {
color: #863600;
}

35
contrib/notification.html Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RouterOS-Scripts Notification Generator</title>
<link rel="stylesheet" type="text/css" href="notification.d/style.css">
<script src="notification.d/script.js"></script>
</head>
<body>
<h1>RouterOS-Scripts Notification Generator</h1>
<div class="notification">
<img src="../logo.svg" alt="logo" class="logo" width=48 height=48>
<div class="content">
<p id="heading" class="heading">[<span id="hostname">MikroTik</span>] <span id="subject"> Subject</span></p>
<pre id="message">Message</pre>
<p id="link" class="hint">🔗 <span id="link-text" class="link">https://eworm.de/</span></p>
<p id="queued" class="hint">⏰ This message was queued since <span id="queued-since">oct/18/2022 18:30:48</span> and may be obsolete.</p>
<p id="cut" class="hint">✂️ The message was too long and has been truncated, cut off <span id="cut-percent">13</span>%!</p>
</div>
</div>
<p>Hostname: <input type="text" value="MikroTik" onchange="update(this, 'hostname')"></p>
<p>Subject: <input type="text" size=50 value=" Subject" onchange="update(this, 'subject')"></p>
<p>Message: <textarea id="w3review" name="w3review" rows="4" cols="50" onchange="update(this, 'message')">Message</textarea></p>
<p><input type="checkbox" onclick="visible(this, 'link')"> Show link: <input type="text" value="https://eworm.de/" onchange="update(this, 'link-text')"></p>
<p><input type="checkbox" onclick="visible(this, 'queued')"> Queued since <input type="text" value="oct/18/2022 18:30:48" onchange="update(this, 'queued-since')"></p>
<p><input type="checkbox" onclick="visible(this, 'cut')"> Cut-off with <input type="number" min=1 max=99 value=13 onchange="update(this, 'cut-percent')"> percent</p>
<p>Then right-click, click "<i>Take Screenshot</i>" and finally select the
notification and download it.</p>
</body>
</html>

View file

@ -1,23 +0,0 @@
#!rsc
# RouterOS script: daily-psk-schedule
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# schedule daily-psk on startup
:local Scheduler [ / system scheduler find where name="daily-psk-schedule" ];
:if ([ / system scheduler get $Scheduler interval ] = 0s) do={
/ system scheduler set interval=15s $Scheduler;
} else={
:if ([ / tool netwatch get [ find where comment=[ / tool e-mail get address ] ] status ] != "up") do={
:error "Mail server is not up.";
}
:if ([ / system ntp client get status ] != "synchronized") do={
:error "Time is not yet synchronized from ntp.";
}
/ system script run [ find where name~"daily-psk\\.(capsman|local)" ];
/ system scheduler set interval=0s $Scheduler;
}

View file

@ -1,90 +0,0 @@
#!rsc
# RouterOS script: daily-psk.capsman
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
#
# update daily PSK (pre shared key)
:global Identity;
:global DailyPskMatchComment;
:global UrlEncode;
:global SendNotification;
:local Seen [ :toarray "" ];
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:local Months { "jan"; "feb"; "mar"; "apr"; "may"; "jun";
"jul"; "aug"; "sep"; "oct"; "nov"; "dec" };
:local Month [ :pick $Date 0 3 ];
:local Day [ :tonum [ :pick $Date 4 6 ] ];
:local Year [ :pick $Date 7 11 ];
:for MIndex from=0 to=[ :len $Months ] do={
:if ($Months->$MIndex = $Month) do={
:set Month ($MIndex + 1);
}
}
:local A ((14 - $Month) / 12);
:local B ($Year - $A);
:local C ($Month + 12 * $A - 2);
:local WeekDay (7000 + $Day + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->($Day - 1)) . \
($DailyPskSecrets->1->($Month - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ / caps-man access-list find where comment~$DailyPskMatchComment ] do={
:local Ssid [ / caps-man access-list get $AccList ssid-regexp ];
:local Configuration [ / caps-man configuration get [ find where ssid=$Ssid ] name ];
:local OldPsk [ / caps-man access-list get $AccList private-passphrase ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
:log info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/ caps-man access-list set $AccList private-passphrase=$NewPsk;
:if ([ / caps-man interface print count-only where configuration=$Configuration ] > 0) do={
:foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={
:log debug ("Already sent a mail for SSID " . $Ssid . ", skipping.");
:set Skip 1;
}
}
:if ($Skip = 0) do={
:set Seen ($Seen, $Ssid);
:local Url ("https://www.eworm.de/cgi-bin/cqrlogo-wifi.cgi" . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
:local Attach "qrcode-daily.png";
:do {
/ tool fetch mode=https check-certificate=yes-without-crl \
$Url dst-path=$Attach;
} on-error={
:set Attach "";
}
$SendNotification ("daily PSK " . $Ssid) \
("This is the daily PSK on " . $Identity . ":\n\n" . \
"SSID: " . $Ssid . "\n" . \
"PSK: " . $NewPsk . "\n" . \
"Date: " . $Date . "\n\n" . \
$Url) $Attach;
}
}
}
}

96
daily-psk.capsman.rsc Normal file
View file

@ -0,0 +1,96 @@
#!rsc by RouterOS
# RouterOS script: daily-psk.capsman
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# update daily PSK (pre shared key)
# https://rsc.eworm.de/doc/daily-psk.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global DailyPskMatchComment;
:global DailyPskQrCodeUrl;
:global Identity;
:global FormatLine;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:global ParseDate;
:set Date [ $ParseDate $Date ];
:local A ((14 - ($Date->"month")) / 12);
:local B (($Date->"year") - $A);
:local C (($Date->"month") + 12 * $A - 2);
:local WeekDay (7000 + ($Date->"day") + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->(($Date->"day") - 1)) . \
($DailyPskSecrets->1->(($Date->"month") - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Seen ({});
:local Date [ /system/clock/get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ /caps-man/access-list/find where comment~$DailyPskMatchComment ] do={
:local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ];
:local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0);
:local Ssid [ /caps-man/configuration/get $Configuration ssid ];
:local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
$LogPrint info $ScriptName ("Updating daily PSK for '" . $Ssid . "' to '" . $NewPsk . "' (was '" . $OldPsk . "')");
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
:if ($Seen->$Ssid = 1) do={
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
[ $FormatLine "SSID" $Ssid 8 ] . "\n" . \
[ $FormatLine "PSK" $NewPsk 8 ] . "\n" . \
[ $FormatLine "Date" $Date 8 ] . "\n\n" . \
"A client device specific rule must not exist!"); link=$Link });
:set ($Seen->$Ssid) 1;
}
}
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,90 +0,0 @@
#!rsc
# RouterOS script: daily-psk.local
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
#
# update daily PSK (pre shared key)
:global Identity;
:global DailyPskMatchComment;
:global UrlEncode;
:global SendNotification;
:local Seen [ :toarray "" ];
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:local Months { "jan"; "feb"; "mar"; "apr"; "may"; "jun";
"jul"; "aug"; "sep"; "oct"; "nov"; "dec" };
:local Month [ :pick $Date 0 3 ];
:local Day [ :tonum [ :pick $Date 4 6 ] ];
:local Year [ :pick $Date 7 11 ];
:for MIndex from=0 to=[ :len $Months ] do={
:if ($Months->$MIndex = $Month) do={
:set Month ($MIndex + 1);
}
}
:local A ((14 - $Month) / 12);
:local B ($Year - $A);
:local C ($Month + 12 * $A - 2);
:local WeekDay (7000 + $Day + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->($Day - 1)) . \
($DailyPskSecrets->1->($Month - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ / interface wireless access-list find where comment~$DailyPskMatchComment ] do={
:local IntName [ / interface wireless access-list get $AccList interface ];
:local Ssid [ / interface wireless get $IntName ssid ];
:local OldPsk [ / interface wireless access-list get $AccList private-pre-shared-key ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
:log info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/ interface wireless access-list set $AccList private-pre-shared-key=$NewPsk;
:if ([ / interface wireless print count-only where name=$IntName disabled=no ] = 1) do={
:foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={
:log debug ("Already sent a mail for SSID " . $Ssid . ", skipping.");
:set Skip 1;
}
}
:if ($Skip = 0) do={
:set Seen ($Seen, $Ssid);
:local Url ("https://www.eworm.de/cgi-bin/cqrlogo-wifi.cgi" . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
:local Attach "qrcode-daily.png";
:do {
/ tool fetch mode=https check-certificate=yes-without-crl \
$Url dst-path=$Attach;
} on-error={
:set Attach "";
}
$SendNotification ("daily PSK " . $Ssid) \
("This is the daily PSK on " . $Identity . ":\n\n" . \
"SSID: " . $Ssid . "\n" . \
"PSK: " . $NewPsk . "\n" . \
"Date: " . $Date . "\n\n" . \
$Url) $Attach;
}
}
}
}

95
daily-psk.local.rsc Normal file
View file

@ -0,0 +1,95 @@
#!rsc by RouterOS
# RouterOS script: daily-psk.local
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# update daily PSK (pre shared key)
# https://rsc.eworm.de/doc/daily-psk.md
#
# !! Do not edit this file, it is generated from template!
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global DailyPskMatchComment;
:global DailyPskQrCodeUrl;
:global Identity;
:global FormatLine;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:global ParseDate;
:set Date [ $ParseDate $Date ];
:local A ((14 - ($Date->"month")) / 12);
:local B (($Date->"year") - $A);
:local C (($Date->"month") + 12 * $A - 2);
:local WeekDay (7000 + ($Date->"day") + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->(($Date->"day") - 1)) . \
($DailyPskSecrets->1->(($Date->"month") - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Seen ({});
:local Date [ /system/clock/get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ /interface/wireless/access-list/find where comment~$DailyPskMatchComment ] do={
:local IntName [ /interface/wireless/access-list/get $AccList interface ];
:local Ssid [ /interface/wireless/get $IntName ssid ];
:local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
$LogPrint info $ScriptName ("Updating daily PSK for '" . $Ssid . "' to '" . $NewPsk . "' (was '" . $OldPsk . "')");
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ($Seen->$Ssid = 1) do={
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
[ $FormatLine "SSID" $Ssid 8 ] . "\n" . \
[ $FormatLine "PSK" $NewPsk 8 ] . "\n" . \
[ $FormatLine "Date" $Date 8 ] . "\n\n" . \
"A client device specific rule must not exist!"); link=$Link });
:set ($Seen->$Ssid) 1;
}
}
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

View file

@ -1,96 +0,0 @@
#!rsc
# RouterOS script: daily-psk%TEMPL%
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
#
# update daily PSK (pre shared key)
:global Identity;
:global DailyPskMatchComment;
:global UrlEncode;
:global SendNotification;
:local Seen [ :toarray "" ];
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:local Months { "jan"; "feb"; "mar"; "apr"; "may"; "jun";
"jul"; "aug"; "sep"; "oct"; "nov"; "dec" };
:local Month [ :pick $Date 0 3 ];
:local Day [ :tonum [ :pick $Date 4 6 ] ];
:local Year [ :pick $Date 7 11 ];
:for MIndex from=0 to=[ :len $Months ] do={
:if ($Months->$MIndex = $Month) do={
:set Month ($MIndex + 1);
}
}
:local A ((14 - $Month) / 12);
:local B ($Year - $A);
:local C ($Month + 12 * $A - 2);
:local WeekDay (7000 + $Day + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->($Day - 1)) . \
($DailyPskSecrets->1->($Month - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ / interface wireless access-list find where comment~$DailyPskMatchComment ] do={
:foreach AccList in=[ / caps-man access-list find where comment~$DailyPskMatchComment ] do={
:local IntName [ / interface wireless access-list get $AccList interface ];
:local Ssid [ / interface wireless get $IntName ssid ];
:local Ssid [ / caps-man access-list get $AccList ssid-regexp ];
:local Configuration [ / caps-man configuration get [ find where ssid=$Ssid ] name ];
:local OldPsk [ / interface wireless access-list get $AccList private-pre-shared-key ];
:local OldPsk [ / caps-man access-list get $AccList private-passphrase ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
:log info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/ interface wireless access-list set $AccList private-pre-shared-key=$NewPsk;
/ caps-man access-list set $AccList private-passphrase=$NewPsk;
:if ([ / interface wireless print count-only where name=$IntName disabled=no ] = 1) do={
:if ([ / caps-man interface print count-only where configuration=$Configuration ] > 0) do={
:foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={
:log debug ("Already sent a mail for SSID " . $Ssid . ", skipping.");
:set Skip 1;
}
}
:if ($Skip = 0) do={
:set Seen ($Seen, $Ssid);
:local Url ("https://www.eworm.de/cgi-bin/cqrlogo-wifi.cgi" . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
:local Attach "qrcode-daily.png";
:do {
/ tool fetch mode=https check-certificate=yes-without-crl \
$Url dst-path=$Attach;
} on-error={
:set Attach "";
}
$SendNotification ("daily PSK " . $Ssid) \
("This is the daily PSK on " . $Identity . ":\n\n" . \
"SSID: " . $Ssid . "\n" . \
"PSK: " . $NewPsk . "\n" . \
"Date: " . $Date . "\n\n" . \
$Url) $Attach;
}
}
}
}

111
daily-psk.template.rsc Normal file
View file

@ -0,0 +1,111 @@
#!rsc by RouterOS
# RouterOS script: daily-psk%TEMPL%
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.15
#
# update daily PSK (pre shared key)
# https://rsc.eworm.de/doc/daily-psk.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
:global DailyPskMatchComment;
:global DailyPskQrCodeUrl;
:global Identity;
:global FormatLine;
:global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
:global UrlEncode;
:global WaitForFile;
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
:set ExitOK true;
:error false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK
:local GeneratePSK do={
:local Date [ :tostr $1 ];
:global DailyPskSecrets;
:global ParseDate;
:set Date [ $ParseDate $Date ];
:local A ((14 - ($Date->"month")) / 12);
:local B (($Date->"year") - $A);
:local C (($Date->"month") + 12 * $A - 2);
:local WeekDay (7000 + ($Date->"day") + $B + ($B / 4) - ($B / 100) + ($B / 400) + ((31 * $C) / 12));
:set WeekDay ($WeekDay - (($WeekDay / 7) * 7));
:return (($DailyPskSecrets->0->(($Date->"day") - 1)) . \
($DailyPskSecrets->1->(($Date->"month") - 1)) . \
($DailyPskSecrets->2->$WeekDay));
}
:local Seen ({});
:local Date [ /system/clock/get date ];
:local NewPsk [ $GeneratePSK $Date ];
:foreach AccList in=[ /caps-man/access-list/find where comment~$DailyPskMatchComment ] do={
:foreach AccList in=[ /interface/wifi/access-list/find where comment~$DailyPskMatchComment ] do={
:foreach AccList in=[ /interface/wireless/access-list/find where comment~$DailyPskMatchComment ] do={
:local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ];
:local SsidRegExp [ /interface/wifi/access-list/get $AccList ssid-regexp ];
:local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0);
:local Configuration ([ /interface/wifi/configuration/find where ssid~$SsidRegExp ]->0);
:local Ssid [ /caps-man/configuration/get $Configuration ssid ];
:local Ssid [ /interface/wifi/configuration/get $Configuration ssid ];
:local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ];
:local OldPsk [ /interface/wifi/access-list/get $AccList passphrase ];
# /caps-man/ /interface/wifi/ above - /interface/wireless/ below
:local IntName [ /interface/wireless/access-list/get $AccList interface ];
:local Ssid [ /interface/wireless/get $IntName ssid ];
:local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
$LogPrint info $ScriptName ("Updating daily PSK for '" . $Ssid . "' to '" . $NewPsk . "' (was '" . $OldPsk . "')");
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
/interface/wifi/access-list/set $AccList passphrase=$NewPsk;
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
:if ([ :len [ /interface/wifi/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ($Seen->$Ssid = 1) do={
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "calendar" ] . "daily PSK " . $Ssid); \
message=("This is the daily PSK on " . $Identity . ":\n\n" . \
[ $FormatLine "SSID" $Ssid 8 ] . "\n" . \
[ $FormatLine "PSK" $NewPsk 8 ] . "\n" . \
[ $FormatLine "Date" $Date 8 ] . "\n\n" . \
"A client device specific rule must not exist!"); link=$Link });
:set ($Seen->$Ssid) 1;
}
}
}
}
} on-error={
:global ExitError; $ExitError $ExitOK [ :jobname ];
}

Some files were not shown because too many files have changed in this diff Show more