Commit graph

1078 commits

Author SHA1 Message Date
Christian Hesse 9295d06fe2 global-functions.d/inspectvar: add $InspectVar...
to inspect variables. This is useful for variables with (nested) arrays,
for example inspecting $NetwatchNotify (from netwatch-notify):

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

$ScriptInstallUpdate global-functions.d/ipcalc

... and/or...

$ScriptInstallUpdate global-functions.d/scriptrunonce

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

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

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

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

Signed-off-by: Christian Hesse <mail@eworm.de>
2021-07-15 10:17:25 +02:00
Christian Hesse 29ececda9b collect-wireless-mac: check for existence of mac address
Chance are that $RegVal is an array with just an id - no idea why this
happens. So do not check for array but existence of mac address.
2021-07-11 22:30:00 +02:00
Christian Hesse 483506b189 global-functions: introduce $ScriptRunOnce 2021-07-10 23:18:04 +02:00
Christian Hesse d1ef710093 global-functions: $ScriptInstallUpdate: add error handling for changelog 2021-07-09 22:04:15 +02:00
Christian Hesse 574c50908b global-functions.d/notification-telegram: subject in bold & underline
This makes the subject visually delimited.
2021-07-09 21:21:30 +02:00
Christian Hesse dc7fc0d385 finally remove old scripts 2021-07-09 12:46:03 +02:00
Christian Hesse b864db1e38 global-functions: $ScriptInstallUpdate: add error handling for migration 2021-07-09 12:46:03 +02:00
Christian Hesse f694e1e54d global-functions: $ScriptInstallUpdate: drop unused variable
This was a left-over from re-run message.
2021-07-09 12:46:03 +02:00
Christian Hesse 81cba72bec global-functions: $ScriptInstallUpdate: drop the migration pattern 2021-07-09 12:46:03 +02:00
Christian Hesse d80a7efb7c doc/netwatch-notify: hint on escaping, with example 2021-07-09 12:46:03 +02:00
Christian Hesse bccb7c3452 netwatch-notify: implement pre-down hook 2021-07-09 12:46:03 +02:00
Christian Hesse 12d34e4a7c collect-wireless-mac: remove 'unknown' from message and comment
This was true, but the mac address is no longer unknown after it was
added to address list in comment.
2021-07-09 10:40:13 +02:00
Christian Hesse 4192d30d7e global-functions: $ScriptLock: drop variable, just return 2021-07-09 10:40:13 +02:00
Christian Hesse a4e548eb80 global-functions: $ScriptLock: make ticket management more reliable 2021-07-08 21:03:31 +02:00
Christian Hesse 6c9f733d96 lease-script: add the order in log 2021-07-08 21:03:31 +02:00
Christian Hesse 6bf8cd5fac lease-script: implement script order
The order may be important: `collect-wireless-mac` can add a dns name
in notification, thus `dhcp-to-dns` should run first.
2021-07-08 21:03:31 +02:00
Christian Hesse 623fd707c4 lease-script: modify the tag 2021-07-08 16:09:03 +02:00
Christian Hesse c5d49b37f3 netwatch-notify: run hook from a function 2021-07-08 13:38:21 +02:00
Christian Hesse 87ce4a86b7 netwatch-notify: add error handling for hooks
We already had syntax validation, but a script with valid synctax can
still fail to run...
2021-07-08 13:02:57 +02:00
Christian Hesse 1eb337d87f doc/lease-script: hint on script installation/execution order 2021-07-07 00:33:36 +02:00
Christian Hesse d7170bf138 doc/lease-script: fix link 2021-07-07 00:33:36 +02:00
Christian Hesse e5674dec24 collect-wireless-mac: use $EitherOr and simplify code 2021-07-07 00:33:34 +02:00
Christian Hesse c982cde0bd collect-wireless-mac: do not fail on missing dns record 2021-07-07 00:32:50 +02:00
Christian Hesse 5083ffd12f collect-wireless-mac: rework, more use of arrays 2021-07-06 21:41:33 +02:00
Christian Hesse 92a97b12ca ospf-to-leds: do not flood but log properly 2021-07-06 21:41:33 +02:00