Commit graph

424 commits

Author SHA1 Message Date
Christian Hesse
ef7360453f global-functions: $IsTimeSync: no cloud with CHR free license 2022-11-22 22:23:51 +01:00
Christian Hesse
c2a29da9f2 global-functions: $ScriptLock: use shorter random string
... but with all characters from alphabet with $GetRandom20CharAlNum.
2022-11-22 19:05:29 +01:00
Christian Hesse
3c4595e82b global-functions: $MkDir: use shorter random string
... but with all characters from alphabet with $GetRandom20CharAlNum.
2022-11-22 19:05:02 +01:00
Christian Hesse
10182949ea global-functions: $ScriptInstallUpdate: disable notification only...
... if requested, but keep output and logs.
2022-09-28 09:17:32 +02:00
Christian Hesse
b18ca62dbd global-functions: $ScriptInstallUpdate: drop dead code... 2022-09-28 09:17:12 +02:00
Christian Hesse
5120aa096f global-functions: $ScriptInstallUpdate: drop code for permission workaround
This is no longer used as 'netwatch-syslog' is gone.
2022-09-25 22:18:44 +02:00
Christian Hesse
bfe2cbf575 drop 'netwatch-syslog'
To filter in firewall you should use something like this:

/ip/firewall/filter/add action=reject chain=output out-interface-list=WAN port=514 protocol=udp reject-with=icmp-admin-prohibited;
/ip/firewall/filter/add action=reject chain=forward out-interface-list=WAN port=514 protocol=udp reject-with=icmp-admin-prohibited;
2022-09-25 22:18:44 +02:00
Christian Hesse
eccc187014 introduce 'mod/notification-email', split off from global-functions 2022-09-25 22:10:05 +02:00
Christian Hesse
562c565fcf global-functions: $FlushEmailQueue: do not flush if sending 2022-09-25 18:44:14 +02:00
Christian Hesse
84b5e77860 global-functions: $GetMacVendor: detect locally administered addresses
https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local_(U/L_bit)
2022-09-20 09:30:33 +02:00
Christian Hesse
3f92edb5c1 global-functions: $FlushEmailQueue: use $0 for scheduler name 2022-09-15 22:25:59 +02:00
Christian Hesse
f245751339 global-functions: $FlushEmailQueue: do not flush with resolver issues
Flushing the mail queue with resolver issues can flood the log with
messages like:

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

Try to avoid this...
2022-09-15 22:03:19 +02:00
Christian Hesse
e927c6b08b global-functions: $GetMacVendor: switched to Let's Encrypt (R3)
So let's check for the correct one, and drop the other.
2022-09-13 15:18:28 +02:00
Christian Hesse
a1af9577ca global-functions: $ScriptInstallUpdate: prepare for future certificate chain 2022-09-09 14:02:02 +02:00
Christian Hesse
8f32887a1a global-functions: introduce $GetRandom20CharAlNum 2022-09-07 12:28:45 +02:00
Christian Hesse
ff0b05ea20 global-functions: $GetRandom20CharHex: add optional parameter for length 2022-09-07 12:22:45 +02:00
Christian Hesse
8f7a0c2a06 global-functions: $SymbolByUnicodeName: add 'earth' 2022-08-25 12:51:07 +02:00
Michael Gisbers
28be6d097d global-functions: $GetRandomNumber: use :rndnum
This is available in RouterOS 7.x...

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

Signed-off-by: Christian Hesse <mail@eworm.de>
2022-08-05 22:58:55 +02:00
Christian Hesse
82f27268b3 global-functions: $IsTimeSync: cache a positive result
The functions do not rely on perfectly synced time. About the right time
is fine, that should make sure certificates are valid and mails are sent
with reasonable headers. So cache the result if system is fine for later
use.
2022-07-21 14:04:44 +02:00
Christian Hesse
329e606b93 global-functions: $IsTimeSync: drop the extra condition...
... as ddns is not required to be enabled. The public address is
available anyway, but not set in DNS.
2022-07-21 14:04:44 +02:00
Christian Hesse
ed7b48061a global-functions: $IsTimeSync: drop old code
In RouterOS 7.x the ntp client and server are bundled and unique and
can not be unavailable.
Also it does no longer have a 'last-adjustment' property...
2022-07-21 14:03:11 +02:00
Christian Hesse
518cc24108 global-functions: $IsFullyConnected: remove trailing space 2022-07-21 13:21:51 +02:00
Christian Hesse
9a89cd5407 global-functions: update initialization of empty array
Having the parenthesis here is important for valid syntax!
2022-07-13 11:32:44 +02:00
Christian Hesse
a1606402d1 global-config: new setting to disable news and change notifications...
... and also drop the version from global-config and
global-config-overlay.
2022-07-06 21:46:52 +02:00
Christian Hesse
19103cd345 netwatch-notify: rename parameter: hostname -> name
Starting with RouterOS 7.4 the netwatch tool has been extended, it can
now do tcp and http probes. Rename the parameter for reasonable naming
with services.
2022-07-06 11:37:02 +02:00
Christian Hesse
eda75f0bbc global-functions: introduce function $PrettyPrint
... to add trailing carriage return when printing to terminal:

[admin@MikroTik] > $PrettyPrint [ $DeviceInfo ]
Hostname:       MikroTik
Board name:     hAP ac^2
Architecture:   arm
Model:          RouterBOARD D52G-5HacD2HnD-TC
Serial number:  8A2A09A221A1
RouterOS:
    Channel:    testing
    Installed:  7.4rc1
RouterOS-Scripts:
    Current:    81
2022-07-05 12:43:57 +02:00
Christian Hesse
fcd6e61849 global-functions: $ScriptInstallUpdate: remove script on failure when installing 2022-06-28 21:40:00 +02:00
Christian Hesse
d8d7ace5e5 global-functions: introduce function $IsFullyConnected 2022-06-20 11:29:49 +02:00
Christian Hesse
b1ad89b1b5 global-functions: rename internal function: $TimeIsSync -> $IsTimeSync 2022-06-20 11:29:49 +02:00
Christian Hesse
9aa82316c8 global-functions: rename internal function: $DNSIsResolving -> $IsDNSResolving 2022-06-20 11:29:49 +02:00
Christian Hesse
0ee38a4303 global-functions: rename internal function: $DefaultRouteIsReachable -> $IsDefaultRouteReachable 2022-06-20 11:29:49 +02:00
Christian Hesse
f628ef73fd global-functions: $WaitTimeSync: drop declaration of unused function 2022-06-17 00:04:24 +02:00
Christian Hesse
3002990319 fix typos: 'at lease' -> 'at least' 2022-06-16 23:56:36 +02:00
Christian Hesse
b3de1fad34 drop script 'rotate-ntp'
For RouterOS 6.x a separate package 'ntp' exists. This adds server
functionality, but allows ip addresses for the client only. I added the
script 'rotate-ntp' to update addresses from names...

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

This adds migration code, that...
 * removes the script from configuration
 * removes a scheduler from configuration
 * sets the configured ntp pool name for ntp client
2022-06-15 16:39:49 +02:00
Christian Hesse
89f4c91ccf log-forward: change symbol for notification 2022-05-20 08:33:22 +02:00
Christian Hesse
3139b14c67 global-functions: $FlushEmailQueue: return if time is not synced
The local system time is used in the mail header. We do not want the
mails to be sent in the past, so return early (and thus wait for time
being synced).
2022-05-17 21:11:03 +02:00
Christian Hesse
5e481a768b notify about freeze of routeros-v7 branch 2022-05-12 11:05:10 +02:00
Christian Hesse
0ccebc39c7 global-functions: RouterOS v7 path syntax 2022-05-11 13:48:27 +02:00
Christian Hesse
f417bcbcd4 global-functions: $LogPrintExit2: handle empty name 2022-04-28 11:04:34 +02:00
Christian Hesse
e74bec7e5b global-functions: catch runtime error when loading modules 2022-04-28 10:19:07 +02:00
Christian Hesse
7c8e230521 global-functions: validate syntax of modules 2022-04-28 10:19:07 +02:00
Christian Hesse
9bc2123ee5 global-functions: set $0 with script name
Now that we have some active code at the bottom...
2022-04-28 10:18:51 +02:00
Christian Hesse
a36aa441ed global-functions: $DefaultRouteIsReachable: update properties for ROS 7.x 2022-04-26 16:41:15 +02:00
Christian Hesse
a058c9e1ed global-functions: $ScriptInstallUpdate: support giving comment...
... for new scripts. This allows to have extra settings from the
beginning, for example:

$ScriptInstallUpdate script1,script2 "base-url=https://example.com/your/custom/repository/"
2022-04-26 16:41:15 +02:00
Christian Hesse
71b69fc189 introduce backup-partition 2022-03-30 18:24:14 +02:00
Christian Hesse
07cc38e973 global-functions: (re-)introduce global $Read
... to interactively read input from user on terminal.
2022-03-08 22:28:48 +01:00
Christian Hesse
c9b6cee83f global-functions: $FlushEmailQueue: delay if "in-progress"...
Something else is sending a mail... Let's wait and hope the status is
not confused.
2022-03-01 12:47:23 +01:00
Christian Hesse
a00e912bb5 global-functions: $DeviceInfo: firmware only if upgrade pending 2022-02-24 12:04:19 +01:00
Christian Hesse
d74aac8f6a doc/mod: notify about new documentation 2022-02-21 12:53:26 +01:00