Compare commits

..

9 commits

Author SHA1 Message Date
Christian Hesse
66764ed0b2 global-functions: drop $HexToNum 2026-01-14 16:10:35 +01:00
Christian Hesse
e694477fdc log-forward: fix indention 2026-01-14 16:10:35 +01:00
Christian Hesse
875ac9f7c3 log-forward: use comparison for ids
This was introduced with RouterOS 7.22beta1.

Initializing $LogForwardLast with boolean value looks odd, but this is
reuqired to match the very first message.
2026-01-14 16:09:45 +01:00
Christian Hesse
49d3a448c6 check-certificates: drop the compatibility workaround...
... and make it depend in RouterOS 7.19 and its builtin certificates.
2026-01-14 15:30:21 +01:00
Christian Hesse
9b2099e402 global-functions: $CertificateAvailable: drop the compatibility workaround...
... and make it depend in RouterOS 7.19 and its builtin certificates.
2026-01-14 15:30:21 +01:00
Christian Hesse
679583bbbf INITIAL-COMMANDS: drop the compatibility workaround...
... and make it depend in RouterOS 7.19 and its builtin certificates.
2026-01-14 15:30:21 +01:00
Christian Hesse
df8d0370c5 doc/mod/ssh-keys-import: reverse old and new 2026-01-14 15:30:21 +01:00
Christian Hesse
cc56680206 log-forward: try to mitigate a race condition
The old code looped over all new messages, then updated the variable
to the newest message - at that time! Messages in between were lost.
2026-01-14 15:19:12 +01:00
Christian Hesse
6fd28bf8f7 netwatch-dns: check the certificate is available for fetch
That trust is not needed for DNS functionality (that was checked before),
but for our hacky check with fetch.
2026-01-14 15:05:07 +01:00
3 changed files with 10 additions and 8 deletions

View file

@ -4,7 +4,7 @@ Forward log messages via notification
[![GitHub stars](https://img.shields.io/github/stars/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=red)](https://github.com/eworm-de/routeros-scripts/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=green)](https://github.com/eworm-de/routeros-scripts/network)
[![GitHub watchers](https://img.shields.io/github/watchers/eworm-de/routeros-scripts?logo=GitHub&style=flat&color=blue)](https://github.com/eworm-de/routeros-scripts/watchers)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.17-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![required RouterOS version](https://img.shields.io/badge/RouterOS-7.22beta1-yellow?style=flat)](https://mikrotik.com/download/changelogs/)
[![Telegram group @routeros_scripts](https://img.shields.io/badge/Telegram-%40routeros__scripts-%2326A5E4?logo=telegram&style=flat)](https://t.me/routeros_scripts)
[![donate with PayPal](https://img.shields.io/badge/Like_it%3F-Donate!-orange?logo=githubsponsors&logoColor=orange&style=flat)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)

View file

@ -3,7 +3,7 @@
# Copyright (c) 2020-2026 Christian Hesse <mail@eworm.de>
# https://rsc.eworm.de/COPYING.md
#
# requires RouterOS, version=7.17
# requires RouterOS, version=7.22beta1
#
# forward log messages via notification
# https://rsc.eworm.de/doc/log-forward.md
@ -37,8 +37,9 @@
:error false;
}
# LogForwardLast is not initialized, by intention: we want
# to catch *0 on first invocation!
:if ([ :typeof $LogForwardLast ] = "nothing") do={
:set LogForwardLast false;
}
:if ([ :typeof $LogForwardRateLimit ] = "nothing") do={
:set LogForwardRateLimit 0;
@ -64,10 +65,10 @@
:set LogForwardIncludeMessage [ $EitherOr $LogForwardIncludeMessage [] ];
:local LogAll [ /log/find ];
:local LogForwardMax ($LogAll->([ :len $LogAll ] - 1) );
:local Max ($LogAll->([ :len $LogAll ] - 1));
:local LogForwardFilterLogForwardingCached [ $EitherOr [ $LogForwardFilterLogForwarding ] ("\$^") ];
:foreach Message in=[ /log/find where .id>$LogForwardLast and .id<=$LogForwardMax and \
:foreach Message in=[ /log/find where .id>$LogForwardLast and .id<=$Max and \
((!(message="") and !(message~$LogForwardFilterLogForwardingCached) and \
!(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \
topics~$LogForwardInclude or message~$LogForwardIncludeMessage) ] do={
@ -108,7 +109,7 @@
:set LogForwardRateLimit [ $MAX 0 ($LogForwardRateLimit - 1) ];
}
:set LogForwardLast $LogForwardMax;
:set LogForwardLast $Max;
} do={
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
}

View file

@ -104,7 +104,8 @@
:foreach DohServer in=$DohServers do={
:if ([ :len ($DohServer->"doh-cert") ] > 0) do={
:if ([ $CertificateAvailable ($DohServer->"doh-cert") "dns" ] = false) do={
:if ([ $CertificateAvailable ($DohServer->"doh-cert") "fetch" ] = false || \
[ $CertificateAvailable ($DohServer->"doh-cert") "dns" ] = false) do={
$LogPrint warning $ScriptName ("Downloading certificate failed, trying without.");
}
}