Commit graph

435 commits

Author SHA1 Message Date
Christian Hesse
a953a8fa59 mod/notification-email: move $QuotedPrintable (from global-functions)
This is used for e-mail only...
2023-01-11 12:28:31 +01:00
Anatoly Bubenkov
ea09a18d3f sms-forward: support hooks 2023-01-10 08:58:33 +01:00
Christian Hesse
2f774f723d update copyright for 2023 2023-01-02 23:49:26 +01:00
Christian Hesse
16bfe4de7e global-functions: $MkDir: create a tmpfs (RAM disk)...
... if the path starts with "tmpfs/". This helps to mitigate flash wear.
2022-12-13 21:50:32 +01:00
Christian Hesse
1579330864 global-functions: $MkDir: create directories recursively 2022-12-13 21:25:07 +01:00
Christian Hesse
58f769ac00 global-functions: $MkDir: rename internal variable 2022-12-13 10:37:56 +01:00
Christian Hesse
446d5c89fc global-functions: $MkDir: fail if non-directory path exists 2022-12-13 10:31:41 +01:00
Christian Hesse
9c42263988 global-functions: check RouterOS version before loading modules 2022-12-12 15:16:36 +01:00
Christian Hesse
7f7c3a7a70 global-functions: $SymbolByUnicodeName: append variation selector-16...
... to specify that the preceding character should be displayed with emoji
presentation.

https://unicode-table.com/en/FE0F/
2022-12-06 16:41:14 +01:00
Christian Hesse
8854d03ea2 global-functions: introduce $IsMacLocallyAdministered...
... and use it in $GetMacVendor.
2022-11-29 17:07:40 +01:00
Christian Hesse
ad85f22540 global-functions: $IsTimeSync: no cloud on x86 2022-11-22 22:24:59 +01:00
Christian Hesse
ef7360453f global-functions: $IsTimeSync: no cloud with CHR free license 2022-11-22 22:23:51 +01:00
Christian Hesse
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