Compare commits
283 commits
routeros-7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce39b79f69 | ||
|
|
20bf609c44 | ||
|
|
b63e0fcb2f | ||
|
|
1555426687 | ||
|
|
97b99316b2 | ||
|
|
788400c458 | ||
|
|
eb59dd21ca | ||
|
|
79a4b369cb | ||
|
|
f0e6cbcfe1 | ||
|
|
d71ea804b0 | ||
|
|
e148df9e57 | ||
|
|
2f55bfaf00 | ||
|
|
ea6de35699 | ||
|
|
fb343c99e3 | ||
|
|
7be26a0712 | ||
|
|
6d718ec987 | ||
|
|
e341e1c30c | ||
|
|
b43b1b3955 | ||
|
|
1b46a5fd9b | ||
|
|
b13360e4b8 | ||
|
|
c9de6d8579 | ||
|
|
10374afc18 | ||
|
|
0c1d96f89d | ||
|
|
3ccaafd1b3 | ||
|
|
469f783a92 | ||
|
|
33c02e0609 | ||
|
|
6331505dbe | ||
|
|
0c4fb42616 | ||
|
|
f5189b8bd7 | ||
|
|
e2fe653035 | ||
|
|
b11be59b08 | ||
|
|
24de060904 | ||
|
|
14195c51ca | ||
|
|
e833dfcf25 | ||
|
|
512c54bd59 | ||
|
|
3d40b4419d | ||
|
|
a6d4e7e82c | ||
|
|
f6c2225f68 | ||
|
|
53b13b295a | ||
|
|
4eafcaa3ac | ||
|
|
c33eb41c9c | ||
|
|
78f9687558 | ||
|
|
e5de9de391 | ||
|
|
7928c5f054 | ||
|
|
757fa60e6f | ||
|
|
a22b62f588 | ||
|
|
cad104879c | ||
|
|
58da92e36a | ||
|
|
2c92c78b46 | ||
|
|
75633872aa | ||
|
|
dafcc1a0cb | ||
|
|
0199ea8884 | ||
|
|
584e507fd1 | ||
|
|
5715bc7b57 | ||
|
|
1c957dbc6d | ||
|
|
b7b3b43f3b | ||
|
|
df631b987d | ||
|
|
c8759381e9 | ||
|
|
d41f758550 | ||
|
|
e1c561dd91 | ||
|
|
4d0b4a1ff4 | ||
|
|
8af67af462 | ||
|
|
da280586b5 | ||
|
|
2e42f7963c | ||
|
|
fc3beac83b | ||
|
|
fefe11d1e8 | ||
|
|
b156fc43cf | ||
|
|
0fea300fea | ||
|
|
6570a84904 | ||
|
|
63db96bdcc | ||
|
|
88ff031368 | ||
|
|
81ba47a07d | ||
|
|
d748b69142 | ||
|
|
f5f00b70e3 | ||
|
|
4760515add | ||
|
|
d19b90df08 | ||
|
|
ea8ec6b580 | ||
|
|
dbdf295244 | ||
|
|
82020ddd73 | ||
|
|
a8e5b5226b | ||
|
|
4bfb591fa0 | ||
|
|
49d9fb1ffd | ||
|
|
7233dea5bb | ||
|
|
727495d9c4 | ||
|
|
4542c2b19e | ||
|
|
0fb5fd0323 | ||
|
|
dbdc3e4718 | ||
|
|
dafd95d44a | ||
|
|
7b660d0952 | ||
|
|
23d38927bc | ||
|
|
84ba3a463a | ||
|
|
27c92b4382 | ||
|
|
6501c98c82 | ||
|
|
bfe5f20920 | ||
|
|
3024b246b5 | ||
|
|
61f3c26199 | ||
|
|
3ad7ccd3d6 | ||
|
|
eabe3f6e95 | ||
|
|
75e5ddec52 | ||
|
|
44d0c852f1 | ||
|
|
0eb91b6bfa | ||
|
|
87fb70534f | ||
|
|
fcb5347e33 | ||
|
|
aa294b4c67 | ||
|
|
414c83ef81 | ||
|
|
8b19e74736 | ||
|
|
3c8ec5169f | ||
|
|
d921af9a6b | ||
|
|
9421566352 | ||
|
|
ef48b8d39e | ||
|
|
8dc1e1ea6b | ||
|
|
3ef4588601 | ||
|
|
59c9d0ce4b | ||
|
|
378a8978df | ||
|
|
9f2f54b479 | ||
|
|
9a12934202 | ||
|
|
370e81321f | ||
|
|
56e74268b0 | ||
|
|
5f1cbe6de5 | ||
|
|
1ad4d05be8 | ||
|
|
e29ef31eb8 | ||
|
|
bc0227c49b | ||
|
|
43f6c0b975 | ||
|
|
95b675f67e | ||
|
|
d81a786e82 | ||
|
|
aebc4e37da | ||
|
|
b177e298d7 | ||
|
|
106a9bddef | ||
|
|
546e3cdab6 | ||
|
|
c04ee5aadf | ||
|
|
49aef0606b | ||
|
|
32ac10e6ef | ||
|
|
e3ca37ad9a | ||
|
|
dd2854e983 | ||
|
|
7addf2e53a | ||
|
|
1f5aea9fca | ||
|
|
867e504c94 | ||
|
|
90a148a9d8 | ||
|
|
3b0ea3a238 | ||
|
|
719079c5c1 | ||
|
|
563aeb8f71 | ||
|
|
299b34883f | ||
|
|
ed18444578 | ||
|
|
66ab2a8511 | ||
|
|
27144a428a | ||
|
|
6e7f311269 | ||
|
|
6567a94a4f | ||
|
|
631f63836b | ||
|
|
828f68be3c | ||
|
|
078d5368fb | ||
|
|
18fcecd211 | ||
|
|
d5a50d824f | ||
|
|
6920842d15 | ||
|
|
b8841a7135 | ||
|
|
b75a35417a | ||
|
|
bf11489d11 | ||
|
|
5e60d2e1b7 | ||
|
|
5ead61cb62 | ||
|
|
71316f7377 | ||
|
|
02cc581aff | ||
|
|
453d80a121 | ||
|
|
9474102c62 | ||
|
|
996602bfe9 | ||
|
|
72db13c0ab | ||
|
|
0431b02324 | ||
|
|
7be415d0ed | ||
|
|
b7923485bd | ||
|
|
ac62b8f24f | ||
|
|
39c5aeda13 | ||
|
|
7b760d9fa4 | ||
|
|
632d294a98 | ||
|
|
61dee21776 | ||
|
|
96fa76f07d | ||
|
|
f8058eaf71 | ||
|
|
36c87c91ea | ||
|
|
7484663b92 | ||
|
|
231be730ae | ||
|
|
1239ac3104 | ||
|
|
1b7458ac95 | ||
|
|
26dbf5805a | ||
|
|
b938847030 | ||
|
|
38b5fbab9c | ||
|
|
c70b6a8eb3 | ||
|
|
08ff07d037 | ||
|
|
5281b4ba02 | ||
|
|
1dda59034e | ||
|
|
500054535c | ||
|
|
a446f31262 | ||
|
|
d4acc5aa59 | ||
|
|
ccf17a438c | ||
|
|
e8b1e19b28 | ||
|
|
98791f48fd | ||
|
|
ce2d090e99 | ||
|
|
665516b33d | ||
|
|
d9693f4d5f | ||
|
|
6c990079a6 | ||
|
|
303c393900 | ||
|
|
db508ddcd1 | ||
|
|
9e3729c279 | ||
|
|
b98b245714 | ||
|
|
191cc1b952 | ||
|
|
3ada3055ff | ||
|
|
ef3ce7cc6c | ||
|
|
8212bd6c95 | ||
|
|
ba39c29648 | ||
|
|
6bee467550 | ||
|
|
d1b9b1b410 | ||
|
|
a7878d664f | ||
|
|
b66332eb46 | ||
|
|
8c8c75ca66 | ||
|
|
1e2ca3d214 | ||
|
|
5310673152 | ||
|
|
009a6bd762 | ||
|
|
8231c3e833 | ||
|
|
d70efe910a | ||
|
|
c311e58d99 | ||
|
|
42bcc63d29 | ||
|
|
bceabebf9c | ||
|
|
519cb85e28 | ||
|
|
e51191035b | ||
|
|
210ef26b93 | ||
|
|
f8a55860af | ||
|
|
1788c05998 | ||
|
|
3866ea1923 | ||
|
|
73e0ac75f1 | ||
|
|
48bcf8ee6e | ||
|
|
ee030740cb | ||
|
|
4968b79fc1 | ||
|
|
d4ea0e18a7 | ||
|
|
e89867be15 | ||
|
|
adbefca0e4 | ||
|
|
e76ae11b02 | ||
|
|
a78fe98fd0 | ||
|
|
aac723e2a1 | ||
|
|
ede351f47e | ||
|
|
de9dee83be | ||
|
|
be05480071 | ||
|
|
1994b23e46 | ||
|
|
81f59f9894 | ||
|
|
1927dc505a | ||
|
|
eeb76c227c | ||
|
|
5450618723 | ||
|
|
bdc15eaefb | ||
|
|
34172e4c78 | ||
|
|
d89a369485 | ||
|
|
05cb87f475 | ||
|
|
b7ce6aee71 | ||
|
|
495232b299 | ||
|
|
da7a031081 | ||
|
|
5db686a15c | ||
|
|
177a1e798a | ||
|
|
1fe90a6e9a | ||
|
|
82de8bd935 | ||
|
|
5b9031ccca | ||
|
|
a6fd6bd80c | ||
|
|
8c5bd8f5e2 | ||
|
|
8e12453058 | ||
|
|
ff00c27f99 | ||
|
|
f7b96aa3e9 | ||
|
|
90cfa83d95 | ||
|
|
923a6385bf | ||
|
|
590030d391 | ||
|
|
c8d423c7d5 | ||
|
|
87cde2cc2f | ||
|
|
f9a6916827 | ||
|
|
bf322781d1 | ||
|
|
9d17beef03 | ||
|
|
91c8d30655 | ||
|
|
451df78dd8 | ||
|
|
00487f93d4 | ||
|
|
dc7642c1fd | ||
|
|
172d43288e | ||
|
|
c909bef613 | ||
|
|
268743ef6b | ||
|
|
95030b9b74 | ||
|
|
2c4053cff5 | ||
|
|
52b5490bab | ||
|
|
36b81fab94 | ||
|
|
ed6739b8bc | ||
|
|
0d69f8952c | ||
|
|
09e8b1d219 | ||
|
|
6548f83ef4 | ||
|
|
e851cd5ad0 |
139 changed files with 1851 additions and 836 deletions
|
|
@ -4,7 +4,7 @@ Installing from branches
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -22,13 +22,13 @@ for testing.
|
|||
|
||||
To install a single script from `next` branch:
|
||||
|
||||
$ScriptInstallUpdate script-name "url-suffix=?h=next";
|
||||
$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="url-suffix=?h=next" script-name;
|
||||
/system/script/set comment="base-url=https://rsc.eworm.de/next/" script-name;
|
||||
$ScriptInstallUpdate;
|
||||
|
||||
## Switch installation
|
||||
|
|
@ -36,7 +36,7 @@ Alternatively switch an existing script to update from `next` branch:
|
|||
Last but not least - to switch the complete installation to the `next`
|
||||
branch edit `global-config-overlay` and add:
|
||||
|
||||
:global ScriptUpdatesUrlSuffix "?h=next";
|
||||
:global ScriptUpdatesBaseUrl "https://rsc.eworm.de/next/";
|
||||
|
||||
... then reload the configuration and update:
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Certificate name from browser
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Past Contributions
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ for details!
|
|||
* [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)
|
||||
|
|
|
|||
63
DEBUG.md
Normal file
63
DEBUG.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
Debug output and logs
|
||||
=====================
|
||||
|
||||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](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)
|
||||
|
|
@ -4,7 +4,7 @@ Initial commands
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ 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="";
|
||||
/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!";
|
||||
};
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -4,7 +4,7 @@ RouterOS Scripts
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -34,6 +34,12 @@ 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
|
||||
|
|
@ -81,7 +87,7 @@ file to your MikroTik device.
|
|||
|
||||
Then we import the certificate.
|
||||
|
||||
/certificate/import file-name=isrg-root-x2.pem passphrase="";
|
||||
/certificate/import file-name="isrg-root-x2.pem" passphrase="";
|
||||
|
||||
Do not worry that the command is not shown - that happens because it contains
|
||||
a sensitive property, the passphrase.
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: accesslist-duplicates.capsman
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/accesslist-duplicates.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,4 +32,6 @@
|
|||
}
|
||||
:set ($Seen->$Mac) 1;
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: accesslist-duplicates.local
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/accesslist-duplicates.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,4 +32,6 @@
|
|||
}
|
||||
:set ($Seen->$Mac) 1;
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: accesslist-duplicates%TEMPL%
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/accesslist-duplicates.md
|
||||
# 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.
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -40,4 +41,6 @@
|
|||
}
|
||||
:set ($Seen->$Mac) 1;
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: accesslist-duplicates.wifi
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/accesslist-duplicates.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,4 +32,6 @@
|
|||
}
|
||||
:set ($Seen->$Mac) 1;
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: backup-cloud
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: backup-script, order=40
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# upload backup to MikroTik cloud
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/backup-cloud.md
|
||||
# https://rsc.eworm.de/doc/backup-cloud.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RandomDelay;
|
||||
:global RmDir;
|
||||
:global ScriptFromTerminal;
|
||||
:global ScriptLock;
|
||||
:global SendNotification2;
|
||||
|
|
@ -34,8 +36,17 @@
|
|||
|
||||
: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={
|
||||
|
|
@ -44,6 +55,7 @@
|
|||
|
||||
:if ([ $MkDir ("tmpfs/backup-cloud") ] = false) do={
|
||||
$LogPrint error $ScriptName ("Failed creating directory!");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -86,5 +98,7 @@
|
|||
$LogPrint error $ScriptName ("Failed uploading backup for " . $Identity . " to cloud!");
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
}
|
||||
/file/remove "tmpfs/backup-cloud";
|
||||
} on-error={ }
|
||||
$RmDir "tmpfs/backup-cloud";
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: backup-email
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: backup-script, order=20
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# create and email backup and config file
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/backup-email.md
|
||||
# https://rsc.eworm.de/doc/backup-email.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -39,19 +40,30 @@
|
|||
|
||||
: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={
|
||||
|
|
@ -69,6 +81,7 @@
|
|||
|
||||
:if ([ $MkDir $DirName ] = false) do={
|
||||
$LogPrint error $ScriptName ("Failed creating directory!");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -116,9 +129,12 @@
|
|||
: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={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: backup-partition
|
||||
# Copyright (c) 2022-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2022-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: backup-script, order=70
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
# requires device-mode, scheduler
|
||||
#
|
||||
# save configuration to fallback partition
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/backup-partition.md
|
||||
# https://rsc.eworm.de/doc/backup-partition.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -42,12 +44,21 @@
|
|||
|
||||
: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;
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +67,7 @@
|
|||
:if ([ :len $ActiveRunning ] < 1) do={
|
||||
$LogPrint error $ScriptName ("Device is not running from active partition.");
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +77,7 @@
|
|||
:if ([ :len $FallbackTo ] < 1) do={
|
||||
$LogPrint error $ScriptName ("There is no inactive partition named '" . $FallbackToName . "'.");
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +87,7 @@
|
|||
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
|
||||
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,6 +100,7 @@
|
|||
($NumInstalled & $BitMask) != ($NumLatest & $BitMask)) do={
|
||||
:if ([ $CopyTo $ScriptName $FallbackTo $FallbackToName ] = false) do={
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,6 +118,9 @@
|
|||
/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={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: backup-upload
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: backup-script, order=50
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
# requires device-mode, fetch
|
||||
#
|
||||
# create and upload backup and config file
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/backup-upload.md
|
||||
# https://rsc.eworm.de/doc/backup-upload.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -33,6 +35,8 @@
|
|||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RandomDelay;
|
||||
:global RmDir;
|
||||
:global RmFile;
|
||||
:global ScriptFromTerminal;
|
||||
:global ScriptLock;
|
||||
:global SendNotification2;
|
||||
|
|
@ -43,13 +47,23 @@
|
|||
: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={
|
||||
|
|
@ -67,6 +81,7 @@
|
|||
|
||||
:if ([ $MkDir $DirName ] = false) do={
|
||||
$LogPrint error $ScriptName ("Failed creating directory!");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +101,7 @@
|
|||
:set Failed 1;
|
||||
}
|
||||
|
||||
/file/remove ($FilePath . ".backup");
|
||||
$RmFile ($FilePath . ".backup");
|
||||
}
|
||||
|
||||
# create configuration export
|
||||
|
|
@ -105,7 +120,7 @@
|
|||
:set Failed 1;
|
||||
}
|
||||
|
||||
/file/remove ($FilePath . ".rsc");
|
||||
$RmFile ($FilePath . ".rsc");
|
||||
}
|
||||
|
||||
# global-config-overlay
|
||||
|
|
@ -126,7 +141,7 @@
|
|||
:set Failed 1;
|
||||
}
|
||||
|
||||
/file/remove ($FilePath . ".conf");
|
||||
$RmFile ($FilePath . ".conf");
|
||||
}
|
||||
|
||||
:local FileInfo do={
|
||||
|
|
@ -157,5 +172,7 @@
|
|||
:if ($Failed = 1) do={
|
||||
:set PackagesUpdateBackupFailure true;
|
||||
}
|
||||
/file/remove $DirName;
|
||||
} on-error={ }
|
||||
$RmDir $DirName;
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-download-packages.capsman
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-download-packages.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -21,10 +22,12 @@
|
|||
:global DownloadPackage;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
:global ScriptLock;
|
||||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -35,6 +38,7 @@
|
|||
|
||||
:if ([ :len $PackagePath ] = 0) do={
|
||||
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +46,7 @@
|
|||
: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 . \
|
||||
|
|
@ -57,7 +62,7 @@
|
|||
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
|
||||
($File->"package-architecture") $PackagePath ] = true) do={
|
||||
:set Updated true;
|
||||
/file/remove $Package;
|
||||
$RmFile ($File->"name");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,4 +87,6 @@
|
|||
/caps-man/remote-cap/upgrade [ find where version!=$InstalledVersion ];
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-download-packages%TEMPL%
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-download-packages.md
|
||||
# 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.
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -22,10 +23,12 @@
|
|||
:global DownloadPackage;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
:global ScriptLock;
|
||||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -37,6 +40,7 @@
|
|||
|
||||
:if ([ :len $PackagePath ] = 0) do={
|
||||
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +48,7 @@
|
|||
: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 . \
|
||||
|
|
@ -59,7 +64,7 @@
|
|||
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
|
||||
($File->"package-architecture") $PackagePath ] = true) do={
|
||||
:set Updated true;
|
||||
/file/remove $Package;
|
||||
$RmFile ($File->"name");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,4 +98,6 @@
|
|||
/interface/wifi/capsman/remote-cap/upgrade [ find where version!=$InstalledVersion ];
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-download-packages.wifi
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# download and cleanup packages for CAP installation from CAPsMAN
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-download-packages.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -21,10 +22,12 @@
|
|||
:global DownloadPackage;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
:global ScriptLock;
|
||||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -35,6 +38,7 @@
|
|||
|
||||
:if ([ :len $PackagePath ] = 0) do={
|
||||
$LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +46,7 @@
|
|||
: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 . \
|
||||
|
|
@ -57,7 +62,7 @@
|
|||
:if ([ $DownloadPackage ($File->"package-name") $InstalledVersion \
|
||||
($File->"package-architecture") $PackagePath ] = true) do={
|
||||
:set Updated true;
|
||||
/file/remove $Package;
|
||||
$RmFile ($File->"name");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,4 +89,6 @@
|
|||
/interface/wifi/capsman/remote-cap/upgrade [ find where version!=$InstalledVersion ];
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-rolling-upgrade.capsman
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: capsman-rolling-upgrade.capsman
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# upgrade CAPs one after another
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-rolling-upgrade.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -43,4 +45,6 @@
|
|||
:delay ($Delay . "s");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-rolling-upgrade%TEMPL%
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: capsman-rolling-upgrade%TEMPL%
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# upgrade CAPs one after another
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-rolling-upgrade.md
|
||||
# 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.
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +53,6 @@
|
|||
:delay ($Delay . "s");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: capsman-rolling-upgrade.wifi
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: capsman-rolling-upgrade.wifi
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# upgrade CAPs one after another
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-rolling-upgrade.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -44,4 +46,6 @@
|
|||
:delay ($Delay . "s");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: certificate-renew-issued
|
||||
# Copyright (c) 2019-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# renew locally issued certificates
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/certificate-renew-issued.md
|
||||
# https://rsc.eworm.de/doc/certificate-renew-issued.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -45,4 +47,6 @@
|
|||
$LogPrint info $ScriptName ("Issued a new certificate for '" . $CertVal->"common-name" . "'.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3
|
||||
# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3
|
||||
# Label: "GlobalSign Root CA - R3"
|
||||
# Serial: 4835703278459759426209954
|
||||
# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28
|
||||
# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad
|
||||
# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
|
||||
A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
|
||||
Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
|
||||
MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
|
||||
A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
|
||||
hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
|
||||
RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
|
||||
gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
|
||||
KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
|
||||
QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
|
||||
XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
|
||||
DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
|
||||
LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
|
||||
RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
|
||||
jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
|
||||
6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
|
||||
mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
|
||||
Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
|
||||
WD9f
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -1,32 +1,58 @@
|
|||
# Makefile to check certificates
|
||||
|
||||
DOMAINS = \
|
||||
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.macvendors.com/GTS-Root-R4 \
|
||||
api.mullvad.net/ISRG-Root-X1 \
|
||||
api.telegram.org/Go-Daddy-Root-Certificate-Authority-G2 \
|
||||
cloudflare-dns.com/DigiCert-Global-Root-G2 \
|
||||
dns.google/GTS-Root-R1 \
|
||||
dns.quad9.net/DigiCert-Global-Root-G3 \
|
||||
feodotracker.abuse.ch/GlobalSign \
|
||||
git.eworm.de/ISRG-Root-X2 \
|
||||
ipv4.showipv6.de/ISRG-Root-X1 \
|
||||
ipv4.tunnelbroker.net/Starfield-Root-Certificate-Authority-G2 \
|
||||
ipv6.showipv6.de/ISRG-Root-X1 \
|
||||
lists.blocklist.de/Certum-Trusted-Network-CA \
|
||||
matrix.org/GTS-Root-R4 \
|
||||
mkcert.org/ISRG-Root-X1 \
|
||||
ntfy.sh/ISRG-Root-X1 \
|
||||
sslbl.abuse.ch/GlobalSign \
|
||||
upgrade.mikrotik.com/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)
|
||||
.PHONY: $(DOMAINS_DUAL) $(DOMAINS_IPV4) $(DOMAINS_IPV6)
|
||||
|
||||
all: $(DOMAINS)
|
||||
all: $(DOMAINS_DUAL) $(DOMAINS_IPV4) $(DOMAINS_IPV6)
|
||||
|
||||
$(DOMAINS):
|
||||
curl --output /dev/null --silent --connect-timeout 5 --cacert $(notdir $@).pem https://$(dir $@)
|
||||
$(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
|
||||
|
|
|
|||
41
certs/USERTrust-RSA-Certification-Authority.pem
Normal file
41
certs/USERTrust-RSA-Certification-Authority.pem
Normal 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-----
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: check-certificates
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
# requires device-mode, fetch
|
||||
#
|
||||
# check for certificate validity
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-certificates.md
|
||||
# https://rsc.eworm.de/doc/check-certificates.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -32,7 +34,8 @@
|
|||
|
||||
:local CheckCertificatesDownloadImport do={
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local Name [ :tostr $2 ];
|
||||
:local CertName [ :tostr $2 ];
|
||||
:local FetchName [ :tostr $3 ];
|
||||
|
||||
:global CertRenewUrl;
|
||||
:global CertRenewPass;
|
||||
|
|
@ -41,43 +44,51 @@
|
|||
:global EscapeForRegEx;
|
||||
:global FetchUserAgentStr;
|
||||
:global LogPrint;
|
||||
:global RmFile;
|
||||
:global UrlEncode;
|
||||
:global WaitForFile;
|
||||
|
||||
:local Return false;
|
||||
:foreach Type in={ "p12"; "pem" } do={
|
||||
:local CertFileName ([ $UrlEncode $FetchName ] . "." . $Type);
|
||||
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
|
||||
"' (file '" . $CertFileName . "')...");
|
||||
|
||||
:foreach Type in={ ".pem"; ".p12" } do={
|
||||
:local CertFileName ([ $UrlEncode $Name ] . $Type);
|
||||
: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 PassPhrase in=$CertRenewPass do={
|
||||
:local Result [ /certificate/import file-name=$CertFileName passphrase=$PassPhrase as-value ];
|
||||
:if ($Result->"decryption-failures" = 0) do={
|
||||
:set DecryptionFailed false;
|
||||
}
|
||||
: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={ }
|
||||
}
|
||||
/file/remove [ find where name=$CertFileName ];
|
||||
$RmFile $CertFileName;
|
||||
|
||||
:if ($DecryptionFailed = true) do={
|
||||
$LogPrint warning $ScriptName ("Decryption failed for certificate file '" . $CertFileName . "'.");
|
||||
}
|
||||
|
||||
:foreach CertInChain in=[ /certificate/find where name~("^" . [ $EscapeForRegEx $CertFileName ] . "_[0-9]+\$") \
|
||||
common-name!=$Name !(subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $Name ] . "(\\W|\$)")) !(common-name=[]) ] do={
|
||||
: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 ];
|
||||
}
|
||||
|
||||
:set Return true;
|
||||
:return true;
|
||||
} on-error={
|
||||
$LogPrint debug $ScriptName ("Could not download certificate file '" . $CertFileName . "'.");
|
||||
}
|
||||
}
|
||||
|
||||
:return $Return;
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local FormatInfo do={
|
||||
|
|
@ -133,6 +144,7 @@
|
|||
}
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -140,6 +152,7 @@
|
|||
: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={
|
||||
|
|
@ -150,11 +163,17 @@
|
|||
|
||||
:local ImportSuccess false;
|
||||
:set LastName ($CertVal->"common-name");
|
||||
:set ImportSuccess [ $CheckCertificatesDownloadImport $ScriptName $LastName ];
|
||||
: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 ImportSuccess [ $CheckCertificatesDownloadImport $ScriptName $LastName ];
|
||||
: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; }
|
||||
|
|
@ -165,7 +184,7 @@
|
|||
} else={
|
||||
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
|
||||
|
||||
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $LastName ] ] . "\\.(p12|pem)_[0-9]+\$") \
|
||||
: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 ];
|
||||
|
|
@ -218,4 +237,6 @@
|
|||
", it is invalid after " . ($CertVal->"invalid-after") . ".");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
48
check-health.d/state.rsc
Normal file
48
check-health.d/state.rsc
Normal 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;
|
||||
}
|
||||
}
|
||||
74
check-health.d/temperature.rsc
Normal file
74
check-health.d/temperature.rsc
Normal 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;
|
||||
}
|
||||
}
|
||||
63
check-health.d/voltage.rsc
Normal file
63
check-health.d/voltage.rsc
Normal 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;
|
||||
}
|
||||
}
|
||||
124
check-health.rsc
124
check-health.rsc
|
|
@ -1,16 +1,17 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: check-health
|
||||
# Copyright (c) 2019-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2019-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# check for RouterOS health state
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-health.md
|
||||
# https://rsc.eworm.de/doc/check-health.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -18,11 +19,6 @@
|
|||
:global CheckHealthCPUUtilizationNotified;
|
||||
:global CheckHealthLast;
|
||||
:global CheckHealthRAMUtilizationNotified;
|
||||
:global CheckHealthTemperature;
|
||||
:global CheckHealthTemperatureDeviation;
|
||||
:global CheckHealthTemperatureNotified;
|
||||
:global CheckHealthVoltageLow;
|
||||
:global CheckHealthVoltagePercent;
|
||||
:global Identity;
|
||||
|
||||
:global FormatLine;
|
||||
|
|
@ -32,6 +28,7 @@
|
|||
:global ScriptLock;
|
||||
:global SendNotification2;
|
||||
:global SymbolForNotification;
|
||||
:global ValidateSyntax;
|
||||
|
||||
:local TempToNum do={
|
||||
:global CharacterReplace;
|
||||
|
|
@ -40,6 +37,7 @@
|
|||
}
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -76,103 +74,37 @@
|
|||
:set CheckHealthRAMUtilizationNotified false;
|
||||
}
|
||||
|
||||
:if ([ :len [ /system/health/find ] ] = 0) do={
|
||||
$LogPrint debug $ScriptName ("Your device does not provide any health values.");
|
||||
: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 ({});
|
||||
}
|
||||
:if ([ :typeof $CheckHealthTemperatureNotified ] != "array") do={
|
||||
:set CheckHealthTemperatureNotified ({});
|
||||
}
|
||||
|
||||
|
||||
: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=$ScriptName; \
|
||||
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=$ScriptName; \
|
||||
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=$ScriptName; \
|
||||
subject=([ $SymbolForNotification "high-voltage-sign,chart-increasing" ] . "Health recovery: Low " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " recovered to " . $Value . " V above hard limit.") });
|
||||
}
|
||||
: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.");
|
||||
}
|
||||
:set ($CheckHealthLast->$Name) $Value;
|
||||
}
|
||||
|
||||
:foreach PSU in=[ /system/health/find where name~"^psu.*-state\$" ] do={
|
||||
:local Name [ /system/health/get $PSU name ];
|
||||
:local Value [ /system/health/get $PSU value ];
|
||||
|
||||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||
:if ($CheckHealthLast->$Name = "ok" && \
|
||||
$Value != "ok") do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
|
||||
message=("The power supply unit '" . $Name . "' on " . $Identity . " failed!") });
|
||||
}
|
||||
:if ($CheckHealthLast->$Name != "ok" && \
|
||||
$Value = "ok") do={
|
||||
$SendNotification2 ({ origin=$ScriptName; \
|
||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||
message=("The power supply unit '" . $Name . "' on " . $Identity . " recovered!") });
|
||||
}
|
||||
}
|
||||
:set ($CheckHealthLast->$Name) $Value;
|
||||
:foreach PluginName,Discard in=$CheckHealthPlugins do={
|
||||
($CheckHealthPlugins->$PluginName) \
|
||||
("\$CheckHealthPlugins->\"" . $PluginName . "\"");
|
||||
}
|
||||
|
||||
: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 $ScriptName ("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=$ScriptName; \
|
||||
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=$ScriptName; \
|
||||
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;
|
||||
}
|
||||
} on-error={ }
|
||||
:set CheckHealthPlugins;
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: check-lte-firmware-upgrade
|
||||
# Copyright (c) 2018-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2018-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# check for LTE firmware upgrade, send notification
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-lte-firmware-upgrade.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -19,6 +20,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -100,4 +102,6 @@
|
|||
:foreach Interface in=[ /interface/lte/find ] do={
|
||||
$CheckInterface $ScriptName $Interface;
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: check-routeros-update
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
# requires device-mode, fetch, scheduler
|
||||
#
|
||||
# check for RouterOS update, send notification and/or install
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-routeros-update.md
|
||||
# https://rsc.eworm.de/doc/check-routeros-update.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -34,23 +36,57 @@
|
|||
: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;
|
||||
}
|
||||
:error "Waiting for system to reboot.";
|
||||
$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 ];
|
||||
|
|
@ -59,11 +95,13 @@
|
|||
: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;
|
||||
}
|
||||
|
||||
|
|
@ -76,6 +114,7 @@
|
|||
|
||||
:if ($NumLatest < [ $VersionToNum "7.0" ]) do={
|
||||
$LogPrint warning $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.");
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +126,9 @@
|
|||
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;
|
||||
$DoUpdate $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
:if ($SafeUpdatePatch = true && $NumInstalledFeature = $NumLatestFeature) do={
|
||||
|
|
@ -96,7 +137,9 @@
|
|||
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;
|
||||
$DoUpdate $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
:if ($SafeUpdateNeighbor = true) do={
|
||||
|
|
@ -110,7 +153,9 @@
|
|||
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;
|
||||
$DoUpdate $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +175,9 @@
|
|||
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;
|
||||
$DoUpdate $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,13 +187,16 @@
|
|||
: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;
|
||||
$DoUpdate $ScriptName;
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
} else={
|
||||
:put "Canceled...";
|
||||
}
|
||||
|
|
@ -155,6 +205,7 @@
|
|||
: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;
|
||||
}
|
||||
|
||||
|
|
@ -170,6 +221,7 @@
|
|||
: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;
|
||||
}
|
||||
|
||||
|
|
@ -182,4 +234,6 @@
|
|||
" is available for downgrade.");
|
||||
:set SentRouterosUpdateNotification ($Update->"latest-version");
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: collect-wireless-mac.capsman
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=40
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# collect wireless mac adresses in access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
:global SymbolForNotification;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -93,4 +95,6 @@
|
|||
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: collect-wireless-mac.local
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=40
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# collect wireless mac adresses in access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
:global SymbolForNotification;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -94,4 +96,6 @@
|
|||
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: collect-wireless-mac%TEMPL%
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=40
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# collect wireless mac adresses in access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
|
||||
# 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.
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
:global SymbolForNotification;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -111,4 +113,6 @@
|
|||
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: collect-wireless-mac.wifi
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=40
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# collect wireless mac adresses in access list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
:global SymbolForNotification;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -93,4 +95,6 @@
|
|||
$LogPrint debug $ScriptName ("No mac address available... Ignoring.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: daily-psk.capsman
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update daily PSK (pre shared key)
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -89,4 +91,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: daily-psk.local
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update daily PSK (pre shared key)
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -88,4 +90,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: daily-psk%TEMPL%
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update daily PSK (pre shared key)
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
|
||||
# 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.
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -104,4 +106,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: daily-psk.wifi
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update daily PSK (pre shared key)
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
|
||||
# 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 ];
|
||||
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
:global WaitFullyConnected;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -89,4 +91,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: dhcp-lease-comment.capsman
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=60
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md
|
||||
# https://rsc.eworm.de/doc/dhcp-lease-comment.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 ];
|
||||
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -36,4 +38,6 @@
|
|||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: dhcp-lease-comment.local
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=60
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md
|
||||
# https://rsc.eworm.de/doc/dhcp-lease-comment.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 ];
|
||||
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -36,4 +38,6 @@
|
|||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: dhcp-lease-comment%TEMPL%
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=60
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md
|
||||
# https://rsc.eworm.de/doc/dhcp-lease-comment.md
|
||||
#
|
||||
# !! This is just a template to generate the real script!
|
||||
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -41,4 +43,6 @@
|
|||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: dhcp-lease-comment.wifi
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=60
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# update dhcp-server lease comment with infos from access-list
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md
|
||||
# https://rsc.eworm.de/doc/dhcp-lease-comment.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 ];
|
||||
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -36,4 +38,6 @@
|
|||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: dhcp-to-dns
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=20
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.16
|
||||
#
|
||||
# check DHCP leases and add/remove/update DNS entries
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md
|
||||
# https://rsc.eworm.de/doc/dhcp-to-dns.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
:global ScriptLock;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +42,7 @@
|
|||
}
|
||||
:local PlaceBefore ([ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ]->0);
|
||||
|
||||
:foreach DnsRecord in=[ /ip/dns/static/find where comment~("^" . $CommentPrefix . "\\b") (!type or type=A) ] do={
|
||||
:foreach DnsRecord in=[ /ip/dns/static/find where comment~("^" . $CommentPrefix . "\\b") type=A ] do={
|
||||
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
||||
:local DnsRecordInfo [ $ParseKeyValueStore ($DnsRecordVal->"comment") ];
|
||||
:local MacInServer ($DnsRecordInfo->"macaddress" . " in " . $DnsRecordInfo->"server");
|
||||
|
|
@ -83,7 +85,7 @@
|
|||
:local FullCN ($HostName . "." . $NetDomain);
|
||||
:local MacInServer ($LeaseVal->"active-mac-address" . " in " . $LeaseVal->"server");
|
||||
|
||||
:local DnsRecord [ /ip/dns/static/find where comment=$Comment (!type or type=A) ];
|
||||
:local DnsRecord [ /ip/dns/static/find where comment=$Comment type=A ];
|
||||
:if ([ :len $DnsRecord ] > 0) do={
|
||||
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
||||
|
||||
|
|
@ -116,11 +118,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /ip/dns/static/find where name=$FullA (!type or type=A) ] ] > 1) do={
|
||||
:if ([ :len [ /ip/dns/static/find where name=$FullA type=A ] ] > 1) do={
|
||||
$LogPrintOnce warning $ScriptName ("The name '" . $FullA . "' appeared in more than one A record!");
|
||||
}
|
||||
} else={
|
||||
$LogPrint debug $ScriptName ("No address available... Ignoring.");
|
||||
}
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Find and remove access list duplicates
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Upload backup to Mikrotik cloud
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Send backup via e-mail
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Save configuration to fallback partition
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Upload backup to server
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Download packages for CAP upgrade from CAPsMAN
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Run rolling CAP upgrades from CAPsMAN
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Renew locally issued certificates
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Renew certificates and notify on expiration
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
|
@ -4,7 +4,7 @@ Notify about health state
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -17,22 +17,24 @@ Description
|
|||
-----------
|
||||
|
||||
This script is run from scheduler periodically, sending notification on
|
||||
health related events:
|
||||
health related events. Monitoring CPU and RAM utilization (available
|
||||
processing and memory resources) works on all devices:
|
||||
|
||||
* high CPU utilization
|
||||
* high RAM utilization (low available RAM)
|
||||
|
||||
With additional plugins functionality can be extended, depending on
|
||||
sensors available in hardware:
|
||||
|
||||
* voltage jumps up or down more than configured threshold
|
||||
* voltage drops below hard lower limit
|
||||
* fan failed or recovered
|
||||
* power supply failed or recovered
|
||||
* temperature is above or below threshold
|
||||
|
||||
Note that bad initial state will not trigger an event.
|
||||
|
||||
Monitoring CPU and RAM utilization (available processing and memory
|
||||
resources) works on all devices. Other than that only sensors available
|
||||
in hardware can be checked. See what your hardware supports:
|
||||
|
||||
/system/health/print;
|
||||
> ⚠️ **Warning**: Note that bad initial state will not trigger an event! For
|
||||
> example rebooting a device that is already too hot will not trigger an
|
||||
> alert on high temperature.
|
||||
|
||||
### Sample notifications
|
||||
|
||||
|
|
@ -57,8 +59,8 @@ in hardware can be checked. See what your hardware supports:
|
|||
|
||||
#### PSU state
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
Requirements and installation
|
||||
-----------------------------
|
||||
|
|
@ -72,6 +74,30 @@ Just install the script and create a scheduler:
|
|||
> precision of cpu utilization, escpecially on devices with limited
|
||||
> resources. Thus an unusual interval is used here.
|
||||
|
||||
### Plugins
|
||||
|
||||
Additional plugins are available for sensors available in hardware. First
|
||||
check what your hardware supports:
|
||||
|
||||
/system/health/print;
|
||||
|
||||
Then install the plugin for *fan* and *power supply unit* *state*:
|
||||
|
||||
$ScriptInstallUpdate check-health,check-health.d/state;
|
||||
|
||||
... or *temperature*:
|
||||
|
||||
$ScriptInstallUpdate check-health,check-health.d/temperature;
|
||||
|
||||
... or *voltage*:
|
||||
|
||||
$ScriptInstallUpdate check-health,check-health.d/voltage;
|
||||
|
||||
You can also combine the commands and install all or a subset of plugins
|
||||
in one go:
|
||||
|
||||
$ScriptInstallUpdate check-health,check-health.d/state,check-health.d/temperature,check-health.d/voltage;
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Notify on LTE firmware upgrade
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Notify on RouterOS update
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Collect MAC addresses in wireless access list
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Comment DHCP leases with info from access list
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Create DNS records for DHCP leases
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Automatically upgrade firmware and reboot
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ Description
|
|||
|
||||
This script downloads, imports and updates firewall address-lists. Its main
|
||||
purpose is to block attacking ip addresses, spam hosts, command-and-control
|
||||
servers and similar malicious entities. The default configuration contains
|
||||
lists from [abuse.ch](https://abuse.ch/), [dshield.org](https://dshield.org/)
|
||||
and [blocklist.de](https://www.blocklist.de/), and
|
||||
lists from [spamhaus.org](https://spamhaus.org/) are prepared.
|
||||
servers and similar malicious entities. The default configuration contains a
|
||||
[collective list by GitHub user @stamparm](https://github.com/stamparm/ipsum),
|
||||
lists from [dshield.org](https://dshield.org/) and
|
||||
[blocklist.de](https://www.blocklist.de/), and lists from
|
||||
[spamhaus.org](https://spamhaus.org/) are prepared.
|
||||
|
||||
The address-lists are updated in place, so after initial import you will not
|
||||
see situation when the lists are not populated.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Wait for global functions and modules
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Send GPS position to server
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Use WPA network with hotspot credentials
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage IP addresses with bridge status
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Create DNS records for IPSec peers
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Update configuration on IPv6 prefix change
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Run other scripts on DHCP lease
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage LEDs dark mode
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Forward log messages via notification
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -22,15 +22,15 @@ server (see `/system/logging`). This has some limitation, however:
|
|||
* does not work early after boot if network connectivity is not
|
||||
yet established, or breaks intermittently
|
||||
* lots of messages generate a flood of mails
|
||||
* Matrix and Telegram are not supported
|
||||
* Matrix, Ntfy and Telegram are not supported
|
||||
|
||||
The script works around the limitations, for example it does:
|
||||
|
||||
* read from `/log`, including messages from early boot
|
||||
* skip multi-repeated messages
|
||||
* rate-limit itself to mitigate flooding
|
||||
* forward via notification (which includes *e-mail*, *Matrix* and *Telegram*
|
||||
when installed and configured, see below)
|
||||
* forward via notification (which includes *e-mail*, *Matrix*, *Ntfy* and
|
||||
*Telegram* when installed and configured, see below)
|
||||
|
||||
It is intended to be run periodically from scheduler, then collects new
|
||||
log messages and forwards them via notification.
|
||||
|
|
@ -53,6 +53,12 @@ Just install the script:
|
|||
Configuration
|
||||
-------------
|
||||
|
||||
The default configuration should provide reasonable presets, filtering
|
||||
*info*, and effectively forwarding *warning* and *error*.
|
||||
|
||||
> 💡️ **Hint**: Please try with defaults first, especially if you are not
|
||||
> familiar with regular expressions!
|
||||
|
||||
The configuration goes to `global-config-overlay`, these are the parameters:
|
||||
|
||||
* `LogForwardFilter`: define topics *not* to be forwarded
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage ports in bridge
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage VLANs on bridge ports
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Inspect variables
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ IP address calculation
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Send notifications via e-mail
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Send notifications via Matrix
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Send notifications via Ntfy
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -52,6 +52,8 @@ basic authentication. Configure `NtfyServerUser` and `NtfyServerPass` for this.
|
|||
Even authentication via access token is possible, adding it as password with
|
||||
a blank username.
|
||||
|
||||
Also available is `NtfyServerToken` to add a bearer token for authentication.
|
||||
|
||||
For a custom service installing an additional certificate may be required.
|
||||
You may want to install that certificate manually, after finding the
|
||||
[certificate name from browser](../../CERTIFICATES.md).
|
||||
|
|
|
|||
BIN
doc/mod/notification-telegram.d/getchatid.avif
Normal file
BIN
doc/mod/notification-telegram.d/getchatid.avif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -4,7 +4,7 @@ Send notifications via Telegram
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -38,14 +38,21 @@ create your own bot:
|
|||
|
||||

|
||||
|
||||
Now open a chat with your bot and start it by clicking the `START` button.
|
||||
Set that token from *BotFather* (use your own!) to `TelegramTokenId`, for
|
||||
now just temporarily:
|
||||
|
||||
Open just another chat with [GetIDs Bot](https://t.me/getidsbot), again start
|
||||
with the `START` button. It will send you some information, including the
|
||||
`id`, just below `You`.
|
||||
:set TelegramTokenId "5214364459:AAHLwf1o7ybbKDo6pY24Kd2bZ5rjCakDXTc";
|
||||
|
||||
Now open a chat with your bot and start it by clicking the `START` button,
|
||||
then send your first message. Any text will do. On your device run
|
||||
`$GetTelegramChatId` to retrieve the chat id:
|
||||
|
||||
$GetTelegramChatId;
|
||||
|
||||

|
||||
|
||||
Finally edit `global-config-overlay`, add `TelegramTokenId` with the token
|
||||
from *BotFather* and `TelegramChatId` with your id from *GetIDs Bot*. Then
|
||||
from *BotFather* and `TelegramChatId` with your retrieved chat id. Then
|
||||
reload the configuration.
|
||||
|
||||
> ℹ️ **Info**: Copy relevant configuration from
|
||||
|
|
@ -54,9 +61,13 @@ reload the configuration.
|
|||
|
||||
### Notifications to a group
|
||||
|
||||
Sending notifications to a group is possible as well. Add your bot and the
|
||||
*GetIDs Bot* to a group, then use the group's id (which starts with a dash)
|
||||
for `TelegramChatId`. Then remove *GetIDs Bot* from group.
|
||||
Sending notifications to a group is possible as well. Add your bot to a group
|
||||
and make it an admin (required for read access!) and send a message and run
|
||||
`$GetTelegramChatId` again. Then use that chat id (which starts with a dash)
|
||||
for `TelegramChatId`.
|
||||
|
||||
Groups can enable the `Topics` feature. Use `TelegramThreadId` to send to a
|
||||
specific topic in a group.
|
||||
|
||||
Usage and invocation
|
||||
--------------------
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Download script and run it once
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Import ssh keys for public key authentication
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Mode button with multiple presses
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage DNS and DoH servers from netwatch
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ Note that using a name in DoH url may introduce a chicken-and-egg issue!
|
|||
Adding a static DNS record has the same result for the url, but always
|
||||
resolves to the same address.
|
||||
|
||||
/ip/dns/static/add name="dns.nextdns.io" address=199.247.16.158;
|
||||
/tool/netwatch/add comment="doh" host=199.247.16.158;
|
||||
/ip/dns/static/add name="cloudflare-dns.com" address=1.1.1.1;
|
||||
/tool/netwatch/add comment="doh" host=1.1.1.1;
|
||||
|
||||
Be aware that you have to keep the ip address in sync with real world
|
||||
manually!
|
||||
|
|
@ -66,6 +66,10 @@ Importing a certificate automatically is possible. You may want to find the
|
|||
/tool/netwatch/add comment="doh, doh-cert=DigiCert Global Root G3" host=9.9.9.9;
|
||||
/tool/netwatch/add comment="doh, doh-cert=GTS Root R1" host=8.8.8.8;
|
||||
|
||||
> ⚠️ **Warning**: Combining these techniques can cause some confusion and
|
||||
> troubles! Chances are that a service uses different certificates based
|
||||
> on indicated server name.
|
||||
|
||||
Sometimes using just one specific (possibly internal) DNS server may be
|
||||
desired, with fallback in case it fails. This is possible as well:
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Visualize OSPF state via LEDs
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Manage system update
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Run scripts on ppp connection
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Act on received SMS
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Forward received SMS
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Play Super Mario theme
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Install LTE firmware upgrade
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Update GRE configuration with dynamic addresses
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Update tunnelbroker configuration
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: firmware-upgrade-reboot
|
||||
# Copyright (c) 2022-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2022-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# install firmware upgrade, and reboot
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/firmware-upgrade-reboot.md
|
||||
# https://rsc.eworm.de/doc/firmware-upgrade-reboot.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -19,6 +20,7 @@
|
|||
:global VersionToNum;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
|
|
@ -26,10 +28,12 @@
|
|||
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
|
||||
$LogPrint info $ScriptName ("Current and upgrade firmware match with version " . \
|
||||
$RouterBoard->"current-firmware" . ".");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={
|
||||
$LogPrint info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.");
|
||||
:set ExitOK true;
|
||||
:error true;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +55,6 @@
|
|||
|
||||
$LogPrint info $ScriptName ("Firmware upgrade successful, rebooting.");
|
||||
/system/reboot;
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: fw-addr-lists
|
||||
# Copyright (c) 2023-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2023-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.16
|
||||
#
|
||||
# download, import and update firewall address-lists
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/fw-addr-lists.md
|
||||
# https://rsc.eworm.de/doc/fw-addr-lists.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:local ExitOK false;
|
||||
:do {
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
:global HumanReadableNum;
|
||||
:global LogPrint;
|
||||
:global LogPrintOnce;
|
||||
:global LogPrintVerbose;
|
||||
:global ScriptLock;
|
||||
:global WaitFullyConnected;
|
||||
|
||||
|
|
@ -35,7 +37,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
:local GetBranch do={
|
||||
:global EitherOr;
|
||||
:return [ :pick [ :convert transform=md5 to=hex [ :pick $1 0 [ $EitherOr [ :find $1 "/" ] [ :len $1 ] ] ] ] 0 2 ];
|
||||
}
|
||||
|
||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
$WaitFullyConnected;
|
||||
|
|
@ -90,22 +98,31 @@
|
|||
:set Line ($Line->0);
|
||||
:local Address;
|
||||
:if ([ :pick $Line 0 1 ] = "{") do={
|
||||
:set Address [ :tostr ([ :deserialize from=json $Line ]->"cidr") ];
|
||||
:do {
|
||||
:set Address [ :tostr ([ :deserialize from=json $Line ]->"cidr") ];
|
||||
} on-error={ }
|
||||
} else={
|
||||
:set Address ([ :pick $Line 0 [ $FindDelim $Line ] ] . ($List->"cidr"));
|
||||
}
|
||||
:do {
|
||||
:local Branch [ $GetBranch $Address ];
|
||||
:if ($Address ~ "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?\$") do={
|
||||
:set ($IPv4Addresses->$Address) $TimeOut;
|
||||
:if ($Address ~ "/32\$") do={
|
||||
:set Address [ :pick $Address 0 ([ :len $Address ] - 3) ];
|
||||
}
|
||||
:set ($IPv4Addresses->$Branch->$Address) $TimeOut;
|
||||
:error true;
|
||||
}
|
||||
:if ($Address ~ "^[0-9a-zA-Z]*:[0-9a-zA-Z:\\.]+(/[0-9]{1,3})?\$") do={
|
||||
:set ($IPv6Addresses->$Address) $TimeOut;
|
||||
:if ($Address ~ "/128\$") do={
|
||||
:set Address [ :pick $Address 0 ([ :len $Address ] - 4) ];
|
||||
}
|
||||
:set ($IPv6Addresses->$Branch->$Address) $TimeOut;
|
||||
:error true;
|
||||
}
|
||||
:if ($Address ~ "^[\\.a-zA-Z0-9-]+\\.[a-zA-Z]{2,}\$") do={
|
||||
:set ($IPv4Addresses->$Address) $TimeOut;
|
||||
:set ($IPv6Addresses->$Address) $TimeOut;
|
||||
:set ($IPv4Addresses->$Branch->$Address) $TimeOut;
|
||||
:set ($IPv6Addresses->$Branch->$Address) $TimeOut;
|
||||
:error true;
|
||||
}
|
||||
} on-error={ }
|
||||
|
|
@ -115,15 +132,17 @@
|
|||
:foreach Entry in=[ /ip/firewall/address-list/find where \
|
||||
list=$FwListName comment=$ListComment ] do={
|
||||
:local Address [ /ip/firewall/address-list/get $Entry address ];
|
||||
:if ([ :typeof ($IPv4Addresses->$Address) ] = "time") do={
|
||||
$LogPrint debug $ScriptName ("Renewing IPv4 address in list '" . $FwListName . \
|
||||
"' with " . ($IPv4Addresses->$Address) . ": " . $Address);
|
||||
/ip/firewall/address-list/set $Entry timeout=($IPv4Addresses->$Address);
|
||||
:set ($IPv4Addresses->$Address);
|
||||
:local Branch [ $GetBranch $Address ];
|
||||
:local TimeOut ($IPv4Addresses->$Branch->$Address);
|
||||
:if ([ :typeof $TimeOut ] = "time") do={
|
||||
$LogPrintVerbose debug $ScriptName ("Renewing IPv4 address in list '" . $FwListName . \
|
||||
"' with " . $TimeOut . ": " . $Address);
|
||||
/ip/firewall/address-list/set $Entry timeout=$TimeOut;
|
||||
:set ($IPv4Addresses->$Branch->$Address);
|
||||
:set CntRenew ($CntRenew + 1);
|
||||
} else={
|
||||
:if ($Failure = false) do={
|
||||
$LogPrint debug $ScriptName ("Removing IPv4 address from list '" . $FwListName . \
|
||||
$LogPrintVerbose debug $ScriptName ("Removing IPv4 address from list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
/ip/firewall/address-list/remove $Entry;
|
||||
:set CntRemove ($CntRemove + 1);
|
||||
|
|
@ -134,15 +153,17 @@
|
|||
:foreach Entry in=[ /ipv6/firewall/address-list/find where \
|
||||
list=$FwListName comment=$ListComment ] do={
|
||||
:local Address [ /ipv6/firewall/address-list/get $Entry address ];
|
||||
:if ([ :typeof ($IPv6Addresses->$Address) ] = "time") do={
|
||||
$LogPrint debug $ScriptName ("Renewing IPv6 address in list '" . $FwListName . \
|
||||
"' with " . ($IPv6Addresses->$Address) . ": " . $Address);
|
||||
/ipv6/firewall/address-list/set $Entry timeout=($IPv6Addresses->$Address);
|
||||
:set ($IPv6Addresses->$Address);
|
||||
:local Branch [ $GetBranch $Address ];
|
||||
:local TimeOut ($IPv6Addresses->$Branch->$Address);
|
||||
:if ([ :typeof $TimeOut ] = "time") do={
|
||||
$LogPrintVerbose debug $ScriptName ("Renewing IPv6 address in list '" . $FwListName . \
|
||||
"' with " . $TimeOut . ": " . $Address);
|
||||
/ipv6/firewall/address-list/set $Entry timeout=$TimeOut;
|
||||
:set ($IPv6Addresses->$Branch->$Address);
|
||||
:set CntRenew ($CntRenew + 1);
|
||||
} else={
|
||||
:if ($Failure = false) do={
|
||||
$LogPrint debug $ScriptName ("Removing IPv6 address from list '" . $FwListName . \
|
||||
$LogPrintVerbose debug $ScriptName ("Removing IPv6 address from list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
/ipv6/firewall/address-list/remove $Entry;
|
||||
:set CntRemove ($CntRemove + 1);
|
||||
|
|
@ -150,31 +171,35 @@
|
|||
}
|
||||
}
|
||||
|
||||
:foreach Address,Timeout in=$IPv4Addresses do={
|
||||
$LogPrint debug $ScriptName ("Adding IPv4 address to list '" . $FwListName . \
|
||||
"' with " . $Timeout . ": " . $Address);
|
||||
:do {
|
||||
/ip/firewall/address-list/add list=$FwListName comment=$ListComment \
|
||||
address=$Address timeout=$Timeout;
|
||||
:set ($IPv4Addresses->$Address);
|
||||
:set CntAdd ($CntAdd + 1);
|
||||
} on-error={
|
||||
$LogPrint warning $ScriptName ("Failed to add IPv4 address to list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
:foreach BranchName,Branch in=$IPv4Addresses do={
|
||||
$LogPrintVerbose debug $ScriptName ("Handling branch: " . $BranchName);
|
||||
:foreach Address,Timeout in=$Branch do={
|
||||
$LogPrintVerbose debug $ScriptName ("Adding IPv4 address to list '" . $FwListName . \
|
||||
"' with " . $Timeout . ": " . $Address);
|
||||
:do {
|
||||
/ip/firewall/address-list/add list=$FwListName comment=$ListComment \
|
||||
address=$Address timeout=$Timeout;
|
||||
:set CntAdd ($CntAdd + 1);
|
||||
} on-error={
|
||||
$LogPrint warning $ScriptName ("Failed to add IPv4 address to list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:foreach Address,Timeout in=$IPv6Addresses do={
|
||||
$LogPrint debug $ScriptName ("Adding IPv6 address to list '" . $FwListName . \
|
||||
"' with " . $Timeout . ": " . $Address);
|
||||
:do {
|
||||
/ipv6/firewall/address-list/add list=$FwListName comment=$ListComment \
|
||||
address=$Address timeout=$Timeout;
|
||||
:set ($IPv6Addresses->$Address);
|
||||
:set CntAdd ($CntAdd + 1);
|
||||
} on-error={
|
||||
$LogPrint warning $ScriptName ("Failed to add IPv6 address to list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
:foreach BranchName,Branch in=$IPv6Addresses do={
|
||||
$LogPrintVerbose debug $ScriptName ("Handling branch: " . $BranchName);
|
||||
:foreach Address,Timeout in=$Branch do={
|
||||
$LogPrintVerbose debug $ScriptName ("Adding IPv6 address to list '" . $FwListName . \
|
||||
"' with " . $Timeout . ": " . $Address);
|
||||
:do {
|
||||
/ipv6/firewall/address-list/add list=$FwListName comment=$ListComment \
|
||||
address=$Address timeout=$Timeout;
|
||||
:set CntAdd ($CntAdd + 1);
|
||||
} on-error={
|
||||
$LogPrint warning $ScriptName ("Failed to add IPv6 address to list '" . $FwListName . \
|
||||
"': " . $Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,4 +209,6 @@
|
|||
" - renewed: " . [ $HumanReadableNum $CntRenew 1000 ] . \
|
||||
" - removed: " . [ $HumanReadableNum $CntRemove 1000 ]);
|
||||
}
|
||||
} on-error={ }
|
||||
} on-error={
|
||||
:global ExitError; $ExitError $ExitOK [ :jobname ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# Overlay for global configuration by RouterOS Scripts
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# global configuration, custom overlay
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/#editing-configuration
|
||||
# https://rsc.eworm.de/#editing-configuration
|
||||
|
||||
# Copy relevant configuration from global-config, paste and modify it here.
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/global-config.rsc
|
||||
# https://rsc.eworm.de/global-config.rsc
|
||||
|
||||
|
||||
# End of global-config-overlay
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: global-config
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# global configuration
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||
# https://rsc.eworm.de/
|
||||
|
||||
# Set this to 'true' to disable news and change notifications.
|
||||
:global NoNewsAndChangesNotification false;
|
||||
|
|
@ -33,6 +33,8 @@
|
|||
:global TelegramChatId "";
|
||||
#:global TelegramTokenId "123456:ABCDEF-GHI";
|
||||
#:global TelegramChatId "12345678";
|
||||
# Use this to send notifications to a specific topic in group.
|
||||
:global TelegramThreadId "";
|
||||
# Using telegram-chat you have to define trusted chat ids (not group ids!)
|
||||
# or user names. Groups allow to chat with devices simultaneously.
|
||||
#:global TelegramChatIdsTrusted {
|
||||
|
|
@ -56,8 +58,9 @@
|
|||
# install the module:
|
||||
# $ScriptInstallUpdate mod/notification-ntfy
|
||||
:global NtfyServer "ntfy.sh";
|
||||
:global NtfyServerUser [];
|
||||
:global NtfyServerPass [];
|
||||
:global NtfyServerUser "";
|
||||
:global NtfyServerPass "";
|
||||
:global NtfyServerToken "";
|
||||
:global NtfyTopic "";
|
||||
|
||||
# It is possible to override e-mail, Telegram, Matrix and Ntfy setting
|
||||
|
|
@ -89,18 +92,18 @@
|
|||
:global BackupPartitionCopyBeforeFeatureUpdate false;
|
||||
|
||||
# This defines the settings for firewall address-lists (fw-addr-lists).
|
||||
# Warning: Mind your device's resources - memory and processing!
|
||||
:global FwAddrLists {
|
||||
# "allow"={
|
||||
# { url="https://git.eworm.de/cgit/routeros-scripts/plain/fw-addr-lists.d/allow";
|
||||
# { url="https://rsc.eworm.de/main/fw-addr-lists.d/allow";
|
||||
# cert="ISRG Root X2"; timeout=1w };
|
||||
# };
|
||||
"block"={
|
||||
# { url="https://git.eworm.de/cgit/routeros-scripts/plain/fw-addr-lists.d/block";
|
||||
# { url="https://rsc.eworm.de/main/fw-addr-lists.d/block";
|
||||
# cert="ISRG Root X2" };
|
||||
{ url="https://feodotracker.abuse.ch/downloads/ipblocklist_recommended.txt";
|
||||
cert="GlobalSign" };
|
||||
{ url="https://sslbl.abuse.ch/blacklist/sslipblacklist.txt";
|
||||
cert="GlobalSign" };
|
||||
{ url="https://raw.githubusercontent.com/stamparm/ipsum/refs/heads/master/levels/4.txt";
|
||||
# # higher level (decrease the numerical value) for more addresses, and vice versa
|
||||
cert="USERTrust RSA Certification Authority" };
|
||||
{ url="https://www.dshield.org/block.txt"; cidr="/24";
|
||||
cert="ISRG Root X1" };
|
||||
{ url="https://lists.blocklist.de/lists/strongips.txt";
|
||||
|
|
@ -111,24 +114,24 @@
|
|||
# cert="GTS Root R4" };
|
||||
};
|
||||
# "mikrotik"={
|
||||
# { url="https://git.eworm.de/cgit/routeros-scripts/plain/fw-addr-lists.d/mikrotik";
|
||||
# { url="https://rsc.eworm.de/main/fw-addr-lists.d/mikrotik";
|
||||
# cert="ISRG Root X2"; timeout=1w };
|
||||
# };
|
||||
};
|
||||
:global FwAddrListTimeOut 1d;
|
||||
|
||||
# This defines what log messages to filter or include by topic or message
|
||||
# text. Regular expressions are supported. Do *NOT* set an empty string,
|
||||
# that will filter or include everything!
|
||||
# text. Regular expressions are supported. An empty string has a special
|
||||
# meaning not to filter or include anything.
|
||||
# These are filters, so excluding messages from forwarding.
|
||||
:global LogForwardFilter "(debug|info|packet|raw)";
|
||||
:global LogForwardFilterMessage [];
|
||||
:global LogForwardFilterMessage "";
|
||||
#:global LogForwardFilterMessage "message text";
|
||||
#:global LogForwardFilterMessage "(message text|another text|...)";
|
||||
# ... and another setting with reverse logic. This includes messages even
|
||||
# if filtered above.
|
||||
:global LogForwardInclude [];
|
||||
:global LogForwardIncludeMessage [];
|
||||
:global LogForwardInclude "";
|
||||
:global LogForwardIncludeMessage "";
|
||||
#:global LogForwardInclude "account";
|
||||
#:global LogForwardIncludeMessage "message text";
|
||||
|
||||
|
|
@ -186,7 +189,7 @@
|
|||
|
||||
# Run different commands with multiple mode-button presses.
|
||||
:global ModeButton {
|
||||
1="/system/script/run leds-toggle-mode;";
|
||||
1="/system/leds/settings/set all-leds-off=(({ \"never\"=\"immediate\"; \"immediate\"=\"never\" })->[ get all-leds-off ]);";
|
||||
2=":global Identity; :global SendNotification; :global SymbolForNotification; \$SendNotification ([ \$SymbolForNotification \"earth\" ] . \"Hello...\") (\"Hello world, \" . \$Identity . \" calling!\");";
|
||||
3="/system/shutdown;";
|
||||
4="/system/reboot;";
|
||||
|
|
@ -216,14 +219,16 @@
|
|||
:global GpsTrackUrl "https://example.com/index.php";
|
||||
|
||||
# This is the base url to fetch scripts from.
|
||||
:global ScriptUpdatesBaseUrl "https://git.eworm.de/cgit/routeros-scripts/plain/";
|
||||
:global ScriptUpdatesBaseUrl "https://rsc.eworm.de/main/";
|
||||
# alternative urls - main: stable code - next: currently in development
|
||||
#:global ScriptUpdatesBaseUrl "https://rsc.eworm.de/next/";
|
||||
#:global ScriptUpdatesBaseUrl "https://git.eworm.de/cgit/routeros-scripts/plain/";
|
||||
#:global ScriptUpdatesBaseUrl "https://raw.githubusercontent.com/eworm-de/routeros-scripts/main/";
|
||||
#:global ScriptUpdatesBaseUrl "https://raw.githubusercontent.com/eworm-de/routeros-scripts/next/";
|
||||
#:global ScriptUpdatesBaseUrl "https://gitlab.com/eworm-de/routeros-scripts/raw/main/";
|
||||
#:global ScriptUpdatesBaseUrl "https://gitlab.com/eworm-de/routeros-scripts/raw/next/";
|
||||
:global ScriptUpdatesUrlSuffix "";
|
||||
# use next branch with default url (git.eworm.de)
|
||||
# use next branch with my git url (git.eworm.de)
|
||||
#:global ScriptUpdatesUrlSuffix "?h=next";
|
||||
|
||||
# Use this for defaults with $ScriptRunOnce
|
||||
|
|
@ -235,7 +240,7 @@
|
|||
# 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 a donation:
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/#donate
|
||||
# https://rsc.eworm.de/#donate
|
||||
# Enable this to silence donation hint.
|
||||
:global IDonate false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: global-functions
|
||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||
# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
|
||||
# Michael Gisbers <michael@gisbers.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
# requires device-mode, fetch, scheduler
|
||||
#
|
||||
# global functions
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||
# https://rsc.eworm.de/
|
||||
|
||||
:local ScriptName [ :jobname ];
|
||||
|
||||
# expected configuration version
|
||||
:global ExpectedConfigVersion 131;
|
||||
# Git commit id & info, expected configuration version
|
||||
:global CommitId "unknown";
|
||||
:global CommitInfo "unknown";
|
||||
:global ExpectedConfigVersion 135;
|
||||
|
||||
# global variables not to be changed by user
|
||||
:global GlobalFunctionsReady false;
|
||||
|
|
@ -32,6 +35,7 @@
|
|||
:global DownloadPackage;
|
||||
:global EitherOr;
|
||||
:global EscapeForRegEx;
|
||||
:global ExitError;
|
||||
:global FetchHuge;
|
||||
:global FetchUserAgentStr;
|
||||
:global FormatLine;
|
||||
|
|
@ -51,6 +55,7 @@
|
|||
:global IsTimeSync;
|
||||
:global LogPrint;
|
||||
:global LogPrintOnce;
|
||||
:global LogPrintVerbose;
|
||||
:global MAX;
|
||||
:global MIN;
|
||||
:global MkDir;
|
||||
|
|
@ -61,6 +66,8 @@
|
|||
:global ProtocolStrip;
|
||||
:global RandomDelay;
|
||||
:global RequiredRouterOS;
|
||||
:global RmDir;
|
||||
:global RmFile;
|
||||
:global ScriptFromTerminal;
|
||||
:global ScriptInstallUpdate;
|
||||
:global ScriptLock;
|
||||
|
|
@ -145,6 +152,7 @@
|
|||
:global CleanName;
|
||||
:global FetchUserAgentStr;
|
||||
:global LogPrint;
|
||||
:global RmFile;
|
||||
:global WaitForFile;
|
||||
|
||||
$LogPrint info $0 ("Downloading and importing certificate with " . \
|
||||
|
|
@ -168,7 +176,7 @@
|
|||
dst-path=$FileName as-value;
|
||||
$WaitForFile $FileName;
|
||||
:if ([ /file/get $FileName size ] = 0) do={
|
||||
/file/remove $FileName;
|
||||
$RmFile $FileName;
|
||||
:error false;
|
||||
}
|
||||
} on-error={
|
||||
|
|
@ -179,7 +187,7 @@
|
|||
|
||||
/certificate/import file-name=$FileName passphrase="" as-value;
|
||||
:delay 1s;
|
||||
/file/remove [ find where name=$FileName ];
|
||||
$RmFile $FileName;
|
||||
|
||||
:if ([ :len [ /certificate/find where common-name=$CommonName ] ] = 0) do={
|
||||
/certificate/remove [ find where name~("^" . $FileName . "_[0-9]+\$") ];
|
||||
|
|
@ -279,6 +287,8 @@
|
|||
|
||||
# get readable device info
|
||||
:set DeviceInfo do={
|
||||
:global CommitId;
|
||||
:global CommitInfo;
|
||||
:global ExpectedConfigVersion;
|
||||
:global Identity;
|
||||
|
||||
|
|
@ -300,16 +310,19 @@
|
|||
([ $FormatLine "Location" ($Snmp->"location") ] . "\n") ] . \
|
||||
[ $IfThenElse ([ :len ($Snmp->"contact") ] > 0) \
|
||||
([ $FormatLine "Contact" ($Snmp->"contact") ] . "\n") ] . \
|
||||
[ $FormatLine "Board name" ($Resource->"board-name") ] . "\n" . \
|
||||
[ $FormatLine "Architecture" ($Resource->"architecture-name") ] . "\n" . \
|
||||
"Hardware:\n" . \
|
||||
[ $FormatLine " Board" ($Resource->"board-name") ] . "\n" . \
|
||||
[ $FormatLine " Arch" ($Resource->"architecture-name") ] . "\n" . \
|
||||
[ $IfThenElse ($RouterBoard->"routerboard" = true) \
|
||||
([ $FormatLine "Model" ($RouterBoard->"model") ] . \
|
||||
([ $FormatLine " Model" ($RouterBoard->"model") ] . \
|
||||
[ $IfThenElse ([ :len ($RouterBoard->"revision") ] > 0) \
|
||||
(" " . $RouterBoard->"revision") ] . "\n" . \
|
||||
[ $FormatLine "Serial number" ($RouterBoard->"serial-number") ] . "\n") ] . \
|
||||
[ $IfThenElse ([ :len ($License->"level") ] > 0) \
|
||||
([ $FormatLine "License" ($License->"level") ] . "\n") ] . \
|
||||
[ $FormatLine " Serial" ($RouterBoard->"serial-number") ] . "\n") ] . \
|
||||
[ $IfThenElse ([ :len ($License->"nlevel") ] > 0) \
|
||||
([ $FormatLine " License" ("level " . ($License->"nlevel")) ] . "\n") ] . \
|
||||
"RouterOS:\n" . \
|
||||
[ $IfThenElse ([ :len ($License->"level") ] > 0) \
|
||||
([ $FormatLine " License" ("level " . ($License->"level")) ] . "\n") ] . \
|
||||
[ $FormatLine " Channel" ($Update->"channel") ] . "\n" . \
|
||||
[ $FormatLine " Installed" ($Update->"installed-version") ] . "\n" . \
|
||||
[ $IfThenElse ([ :typeof ($Update->"latest-version") ] != "nothing" && \
|
||||
|
|
@ -319,6 +332,8 @@
|
|||
$RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \
|
||||
([ $FormatLine " Firmware" ($RouterBoard->"current-firmware") ] . "\n") ] . \
|
||||
"RouterOS-Scripts:\n" . \
|
||||
[ $IfThenElse ($CommitId != "unknown") \
|
||||
([ $FormatLine " Commit" ($CommitInfo . "/" . [ :pick $CommitId 0 8 ]) ] . "\n") ] . \
|
||||
[ $FormatLine " Version" $ExpectedConfigVersion ]);
|
||||
}
|
||||
|
||||
|
|
@ -338,6 +353,7 @@
|
|||
:global CleanFilePath;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmFile;
|
||||
:global WaitForFile;
|
||||
|
||||
:if ([ :len $PkgName ] = 0) do={ :return false; }
|
||||
|
|
@ -381,7 +397,7 @@
|
|||
$LogPrint debug $0 ("Downloading package file failed.");
|
||||
}
|
||||
|
||||
/file/remove [ find where name=$PkgDest ];
|
||||
$RmFile $PkgDest;
|
||||
:set Retry ($Retry - 1);
|
||||
}
|
||||
|
||||
|
|
@ -425,11 +441,25 @@
|
|||
:return $Return;
|
||||
}
|
||||
|
||||
# simple macro to print error message on unintentional error
|
||||
:set ExitError do={
|
||||
:local ExitOK [ :tostr $1 ];
|
||||
:local Name [ :tostr $2 ];
|
||||
|
||||
:global IfThenElse;
|
||||
:global LogPrint;
|
||||
|
||||
:if ($ExitOK = "false") do={
|
||||
$LogPrint error $Name ([ $IfThenElse ([ :pick $Name 0 1 ] = "\$") \
|
||||
"Function" "Script" ] . " '" . $Name . "' exited with error.");
|
||||
}
|
||||
}
|
||||
|
||||
# fetch huge data to file, read in chunks
|
||||
:set FetchHuge do={
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local Url [ :tostr $2 ];
|
||||
:local CheckCert [ :tobool $3 ];
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
:local Url [ :tostr $2 ];
|
||||
:local CheckCert [ :tostr $3 ];
|
||||
|
||||
:global CleanName;
|
||||
:global FetchUserAgentStr;
|
||||
|
|
@ -437,9 +467,11 @@
|
|||
:global IfThenElse;
|
||||
:global LogPrint;
|
||||
:global MkDir;
|
||||
:global RmDir;
|
||||
:global RmFile;
|
||||
:global WaitForFile;
|
||||
|
||||
:set CheckCert [ $IfThenElse ($CheckCert = false) "no" "yes-without-crl" ];
|
||||
:set CheckCert [ $IfThenElse ($CheckCert = "false") "no" "yes-without-crl" ];
|
||||
|
||||
:local DirName ("tmpfs/" . [ $CleanName $ScriptName ]);
|
||||
:if ([ $MkDir $DirName ] = false) do={
|
||||
|
|
@ -453,10 +485,10 @@
|
|||
http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) as-value;
|
||||
} on-error={
|
||||
:if ([ $WaitForFile $FileName 500ms ] = true) do={
|
||||
/file/remove $FileName;
|
||||
$RmFile $FileName;
|
||||
}
|
||||
$LogPrint debug $0 ("Failed downloading from: " . $Url);
|
||||
/file/remove $DirName;
|
||||
$RmDir $DirName;
|
||||
:return false;
|
||||
}
|
||||
$WaitForFile $FileName;
|
||||
|
|
@ -464,11 +496,15 @@
|
|||
:local FileSize [ /file/get $FileName size ];
|
||||
:local Return "";
|
||||
:local VarSize 0;
|
||||
:while ($VarSize < $FileSize) do={
|
||||
:while ($VarSize != $FileSize) do={
|
||||
:set Return ($Return . ([ /file/read offset=$VarSize chunk-size=32768 file=$FileName as-value ]->"data"));
|
||||
:set FileSize [ /file/get $FileName size ];
|
||||
:set VarSize [ :len $Return ];
|
||||
:if ($VarSize > $FileSize) do={
|
||||
:delay 100ms;
|
||||
}
|
||||
}
|
||||
/file/remove $DirName;
|
||||
$RmDir $DirName;
|
||||
:return $Return;
|
||||
}
|
||||
|
||||
|
|
@ -813,6 +849,9 @@
|
|||
:return true;
|
||||
}
|
||||
|
||||
# The function $LogPrintVerbose is declared, but has no code, intentionally.
|
||||
# https://rsc.eworm.de/DEBUG.md#verbose-output
|
||||
|
||||
# get max value
|
||||
:set MAX do={
|
||||
:if ($1 > $2) do={ :return $1; }
|
||||
|
|
@ -831,6 +870,7 @@
|
|||
|
||||
:global CleanFilePath;
|
||||
:global LogPrint;
|
||||
:global RmDir;
|
||||
:global WaitForFile;
|
||||
|
||||
:local MkTmpfs do={
|
||||
|
|
@ -847,7 +887,7 @@
|
|||
}
|
||||
|
||||
$LogPrint info $0 ("Creating disk of type tmpfs.");
|
||||
/file/remove [ find where name="tmpfs" type="directory" ];
|
||||
$RmDir "tmpfs";
|
||||
:do {
|
||||
/disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3);
|
||||
$WaitForFile "tmpfs";
|
||||
|
|
@ -864,7 +904,10 @@
|
|||
:return true;
|
||||
}
|
||||
|
||||
$LogPrint debug $0 ("Making directory: " . $Path);
|
||||
|
||||
:if ([ :len [ /file/find where name=$Path type="directory" ] ] = 1) do={
|
||||
$LogPrint debug $0 ("... which already exists.");
|
||||
:return true;
|
||||
}
|
||||
|
||||
|
|
@ -875,10 +918,8 @@
|
|||
}
|
||||
|
||||
:do {
|
||||
:local File ($Path . "/file");
|
||||
/file/add name=$File;
|
||||
$WaitForFile $File;
|
||||
/file/remove $File;
|
||||
/file/add type="directory" name=$Path;
|
||||
$WaitForFile $Path;
|
||||
} on-error={
|
||||
$LogPrint warning $0 ("Making directory '" . $Path . "' failed!");
|
||||
:return false;
|
||||
|
|
@ -904,14 +945,24 @@
|
|||
# parse key value store
|
||||
:set ParseKeyValueStore do={
|
||||
:local Source $1;
|
||||
|
||||
:if ([ :pick $Source 0 1 ] = "{") do={
|
||||
:do {
|
||||
:return [ :deserialize from=json $Source ];
|
||||
} on-error={ }
|
||||
}
|
||||
|
||||
:if ([ :typeof $Source ] != "array") do={
|
||||
:set Source [ :tostr $1 ];
|
||||
}
|
||||
:local Result ({});
|
||||
:foreach KeyValue in=[ :toarray $Source ] do={
|
||||
:if ([ :find $KeyValue "=" ]) do={
|
||||
:set ($Result->[ :pick $KeyValue 0 [ :find $KeyValue "=" ] ]) \
|
||||
[ :pick $KeyValue ([ :find $KeyValue "=" ] + 1) [ :len $KeyValue ] ];
|
||||
:local Key [ :pick $KeyValue 0 [ :find $KeyValue "=" ] ];
|
||||
:local Value [ :pick $KeyValue ([ :find $KeyValue "=" ] + 1) [ :len $KeyValue ] ];
|
||||
:if ($Value="true") do={ :set Value true; }
|
||||
:if ($Value="false") do={ :set Value false; }
|
||||
:set ($Result->$Key) $Value;
|
||||
} else={
|
||||
:set ($Result->$KeyValue) true;
|
||||
}
|
||||
|
|
@ -976,6 +1027,62 @@
|
|||
:return true;
|
||||
}
|
||||
|
||||
# remove directory
|
||||
:set RmDir do={
|
||||
:local DirName [ :tostr $1 ];
|
||||
|
||||
:global LogPrint;
|
||||
|
||||
$LogPrint debug $0 ("Removing directory: ". $DirName);
|
||||
|
||||
:if ([ :len [ /file/find where name=$DirName type!=directory ] ] > 0) do={
|
||||
$LogPrint error $0 ("Directory '" . $DirName . "' is not a directory.");
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local Dir [ /file/find where name=$DirName type=directory ];
|
||||
:if ([ :len $Dir ] = 0) do={
|
||||
$LogPrint debug $0 ("... which does not exist.");
|
||||
:return true;
|
||||
}
|
||||
|
||||
:do {
|
||||
/file/remove $Dir;
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Removing directory '" . $DirName . "' (" . $Dir . ") failed.");
|
||||
:return false;
|
||||
}
|
||||
:return true;
|
||||
}
|
||||
|
||||
# remove file
|
||||
:set RmFile do={
|
||||
:local FileName [ :tostr $1 ];
|
||||
|
||||
:global LogPrint;
|
||||
|
||||
$LogPrint debug $0 ("Removing file: ". $FileName);
|
||||
|
||||
:if ([ :len [ /file/find where name=$FileName (type=directory or type=disk) ] ] > 0) do={
|
||||
$LogPrint error $0 ("File '" . $FileName . "' is not a file.");
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local File [ /file/find where name=$FileName !(type=directory or type=disk) ];
|
||||
:if ([ :len $File ] = 0) do={
|
||||
$LogPrint debug $0 ("... which does not exist.");
|
||||
:return true;
|
||||
}
|
||||
|
||||
:do {
|
||||
/file/remove $File;
|
||||
} on-error={
|
||||
$LogPrint error $0 ("Removing file '" . $FileName . "' (" . $File . ") failed.");
|
||||
:return false;
|
||||
}
|
||||
:return true;
|
||||
}
|
||||
|
||||
# check if script is run from terminal
|
||||
:set ScriptFromTerminal do={
|
||||
:local Script [ :tostr $1 ];
|
||||
|
|
@ -1003,10 +1110,12 @@
|
|||
}
|
||||
|
||||
# install new scripts, update existing scripts
|
||||
:set ScriptInstallUpdate do={
|
||||
:set ScriptInstallUpdate do={ :do {
|
||||
:local Scripts [ :toarray $1 ];
|
||||
:local NewComment [ :tostr $2 ];
|
||||
|
||||
:global CommitId;
|
||||
:global CommitInfo;
|
||||
:global ExpectedConfigVersion;
|
||||
:global Identity;
|
||||
:global IDonate;
|
||||
|
|
@ -1039,9 +1148,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
:local CommitIdBefore $CommitId;
|
||||
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
|
||||
:local ReloadGlobalFunctions false;
|
||||
:local ReloadGlobalConfig false;
|
||||
:local DeviceMode [ /system/device-mode/get ];
|
||||
|
||||
:local CheckSums ({});
|
||||
:do {
|
||||
:local Url ($ScriptUpdatesBaseUrl . "checksums.json" . $ScriptUpdatesUrlSuffix);
|
||||
$LogPrint debug $0 ("Fetching checksums from url: " . $Url);
|
||||
:set CheckSums [ :deserialize from=json ([ /tool/fetch check-certificate=yes-without-crl \
|
||||
http-header-field=({ [ $FetchUserAgentStr $0 ] }) $Url output=user as-value ]->"data") ];
|
||||
} on-error={ }
|
||||
|
||||
:foreach Script in=[ /system/script/find where source~"^#!rsc by RouterOS\r?\n" ] do={
|
||||
:local ScriptVal [ /system/script/get $Script ];
|
||||
|
|
@ -1056,7 +1175,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if (!($ScriptInfo->"ignore" = true)) do={
|
||||
:do {
|
||||
:if ($ScriptInfo->"ignore" = true) do={
|
||||
$LogPrint debug $0 ("Ignoring script '" . $ScriptVal->"name" . "', as requested.");
|
||||
:error true;
|
||||
}
|
||||
|
||||
:local CheckSum ($CheckSums->($ScriptVal->"name"));
|
||||
:if ([ :len ($ScriptInfo->"base-url") ] = 0 && [ :len ($ScriptInfo->"url-suffix") ] = 0 && \
|
||||
[ :convert transform=md5 to=hex [ :tolf ($ScriptVal->"source") ] ] = $CheckSum) do={
|
||||
$LogPrint debug $0 ("Checksum for script '" . $ScriptVal->"name" . "' matches, ignoring.");
|
||||
:error true;
|
||||
}
|
||||
|
||||
:do {
|
||||
:local BaseUrl [ $EitherOr ($ScriptInfo->"base-url") $ScriptUpdatesBaseUrl ];
|
||||
:local UrlSuffix [ $EitherOr ($ScriptInfo->"url-suffix") $ScriptUpdatesUrlSuffix ];
|
||||
|
|
@ -1075,43 +1206,61 @@
|
|||
} else={
|
||||
$LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "'!");
|
||||
}
|
||||
:error false;
|
||||
}
|
||||
}
|
||||
|
||||
:if ([ :len $SourceNew ] > 0) do={
|
||||
:local SourceCRLF [ :tocrlf $SourceNew ];
|
||||
:if ($SourceNew != $ScriptVal->"source" && $SourceCRLF != $ScriptVal->"source") do={
|
||||
:if ([ :pick $SourceNew 0 18 ] = "#!rsc by RouterOS\n") do={
|
||||
:local Required ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version");
|
||||
:if ([ $RequiredRouterOS $0 [ $EitherOr $Required "0.0" ] false ] = true) do={
|
||||
:if ([ $ValidateSyntax $SourceNew ] = true) do={
|
||||
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
|
||||
/system/script/set owner=($ScriptVal->"name") \
|
||||
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
|
||||
:if ($ScriptVal->"name" = "global-config") do={
|
||||
:set ReloadGlobalConfig true;
|
||||
}
|
||||
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobalFunctions true;
|
||||
}
|
||||
} else={
|
||||
$LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . \
|
||||
"' failed! Ignoring!");
|
||||
}
|
||||
} else={
|
||||
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \
|
||||
$Required . ", which is not met by your installation. Ignoring!");
|
||||
}
|
||||
} else={
|
||||
$LogPrint warning $0 ("Looks like new script '" . $ScriptVal->"name" . \
|
||||
"' is not valid (missing shebang). Ignoring!");
|
||||
}
|
||||
} else={
|
||||
$LogPrint debug $0 ("Script '" . $ScriptVal->"name" . "' did not change.");
|
||||
:if ([ :len $SourceNew ] = 0) do={
|
||||
$LogPrint debug $0 ("No update for script '" . $ScriptVal->"name" . "'.");
|
||||
:error false;
|
||||
}
|
||||
} else={
|
||||
$LogPrint debug $0 ("No update for script '" . $ScriptVal->"name" . "'.");
|
||||
}
|
||||
|
||||
:local SourceCRLF [ :tocrlf $SourceNew ];
|
||||
:if ($SourceNew = $ScriptVal->"source" || $SourceCRLF = $ScriptVal->"source") do={
|
||||
$LogPrint debug $0 ("Script '" . $ScriptVal->"name" . "' did not change.");
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if ([ :pick $SourceNew 0 18 ] != "#!rsc by RouterOS\n") do={
|
||||
$LogPrint warning $0 ("Looks like new script '" . $ScriptVal->"name" . \
|
||||
"' is not valid (missing shebang). Ignoring!");
|
||||
:error false;
|
||||
}
|
||||
|
||||
:local RequiredROS ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version");
|
||||
:if ([ $RequiredRouterOS $0 [ $EitherOr $RequiredROS "0.0" ] false ] = false) do={
|
||||
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \
|
||||
$RequiredROS . ", which is not met by your installation. Ignoring!");
|
||||
:error false;
|
||||
}
|
||||
|
||||
:local RequiredDM [ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires device-mode, ") ] ];
|
||||
:local MissingDM ({});
|
||||
:foreach Feature,Value in=$RequiredDM do={
|
||||
:if ([ :typeof ($DeviceMode->$Feature) ] = "bool" && ($DeviceMode->$Feature) = false) do={
|
||||
:set MissingDM ($MissingDM, $Feature);
|
||||
}
|
||||
}
|
||||
:if ([ :len $MissingDM ] > 0) do={
|
||||
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires disabled " . \
|
||||
"device-mode features (" . [ :tostr $MissingDM ] . "). Ignoring!");
|
||||
:error false;
|
||||
}
|
||||
|
||||
:if ([ $ValidateSyntax $SourceNew ] = false) do={
|
||||
$LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . "' failed! Ignoring!");
|
||||
:error false;
|
||||
}
|
||||
|
||||
$LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
|
||||
/system/script/set owner=($ScriptVal->"name") \
|
||||
source=[ $IfThenElse ($ScriptUpdatesCRLF = true) $SourceCRLF $SourceNew ] $Script;
|
||||
:if ($ScriptVal->"name" = "global-config") do={
|
||||
:set ReloadGlobalConfig true;
|
||||
}
|
||||
:if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={
|
||||
:set ReloadGlobalFunctions true;
|
||||
}
|
||||
} on-error={ }
|
||||
}
|
||||
|
||||
:if ($ReloadGlobalFunctions = true) do={
|
||||
|
|
@ -1133,6 +1282,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ($CommitId != "unknown" && $CommitIdBefore != $CommitId) do={
|
||||
$LogPrint info $0 ("Updated to commit: " . $CommitInfo . "/" . [ :pick $CommitId 0 8 ]);
|
||||
}
|
||||
|
||||
:if ($ExpectedConfigVersionBefore > $ExpectedConfigVersion) do={
|
||||
$LogPrint warning $0 ("The configuration version decreased from " . \
|
||||
$ExpectedConfigVersionBefore . " to " . $ExpectedConfigVersion . \
|
||||
|
|
@ -1171,18 +1324,24 @@
|
|||
:if ([ :len $GlobalConfigMigration ] > 0) do={
|
||||
:for I from=($ExpectedConfigVersionBefore + 1) to=$ExpectedConfigVersion do={
|
||||
:local Migration ($GlobalConfigMigration->[ :tostr $I ]);
|
||||
:if ([ :typeof $Migration ] = "str") do={
|
||||
:if ([ $ValidateSyntax $Migration ] = true) do={
|
||||
$LogPrint info $0 ("Applying migration for change " . $I . ": " . $Migration);
|
||||
:do {
|
||||
[ :parse $Migration ];
|
||||
} on-error={
|
||||
$LogPrint warning $0 ("Migration code for change " . $I . " failed to run!");
|
||||
}
|
||||
} else={
|
||||
$LogPrint warning $0 ("Migration code for change " . $I . " failed syntax validation!");
|
||||
:do {
|
||||
:if ([ :typeof $Migration ] != "str") do={
|
||||
$LogPrint debug $0 ("Migration code for change " . $I . " is not available.");
|
||||
:error false;
|
||||
}
|
||||
}
|
||||
|
||||
:if ([ $ValidateSyntax $Migration ] = false) do={
|
||||
$LogPrint warning $0 ("Migration code for change " . $I . " failed syntax validation!");
|
||||
:error false;
|
||||
}
|
||||
|
||||
$LogPrint info $0 ("Applying migration for change " . $I . ": " . $Migration);
|
||||
:do {
|
||||
[ :parse $Migration ];
|
||||
} on-error={
|
||||
$LogPrint warning $0 ("Migration code for change " . $I . " failed to run!");
|
||||
}
|
||||
} on-error={ }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1222,7 +1381,9 @@
|
|||
:set GlobalConfigChanges;
|
||||
:set GlobalConfigMigration;
|
||||
}
|
||||
}
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} }
|
||||
|
||||
# lock script against multiple invocation
|
||||
:set ScriptLock do={
|
||||
|
|
@ -1357,11 +1518,13 @@
|
|||
}
|
||||
|
||||
# send notification via NotificationFunctions - expects at least two string arguments
|
||||
:set SendNotification do={
|
||||
:set SendNotification do={ :do {
|
||||
:global SendNotification2;
|
||||
|
||||
$SendNotification2 ({ origin=$0; subject=$1; message=$2; link=$3; silent=$4 });
|
||||
}
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} }
|
||||
|
||||
# send notification via NotificationFunctions - expects one array argument
|
||||
:set SendNotification2 do={
|
||||
|
|
@ -1558,7 +1721,17 @@
|
|||
:delay $Delay;
|
||||
:set I ($I + 1);
|
||||
}
|
||||
:return true;
|
||||
|
||||
:while ([ :len [ /file/find where name=$FileName ] ] > 0) do={
|
||||
:do {
|
||||
/file/get $FileName;
|
||||
:return true;
|
||||
} on-error={ }
|
||||
:delay $Delay;
|
||||
:set Delay ($Delay * 3 / 2);
|
||||
}
|
||||
|
||||
:return false;
|
||||
}
|
||||
|
||||
# wait to be fully connected (default route is reachable, time is sync, DNS resolves)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: global-wait
|
||||
# Copyright (c) 2020-2024 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
# Copyright (c) 2020-2025 Christian Hesse <mail@eworm.de>
|
||||
# https://rsc.eworm.de/COPYING.md
|
||||
#
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.15
|
||||
#
|
||||
# wait for global-functions to finish
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/global-wait.md
|
||||
# https://rsc.eworm.de/doc/global-wait.md
|
||||
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue