Commit graph

174 commits

Author SHA1 Message Date
Christian Hesse
5b9031ccca global-functions: $SendNotification: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
8c5bd8f5e2 global-functions: $ScriptInstallUpdate: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
ff00c27f99 global-functions: $ExitError: give matching message for functions 2024-12-09 11:49:50 +01:00
Christian Hesse
ed6739b8bc global-functions: $ExitError: give script name in message 2024-12-09 11:49:50 +01:00
Christian Hesse
0d69f8952c global-functions: introduce $ExitError...
... as a simple macro to print error message on unintentional error.
2024-12-09 11:49:50 +01:00
Christian Hesse
48bcf8ee6e global-functions: $FetchHuge: passing boolean to function is still broken... 🤨 2024-12-09 11:49:50 +01:00
Christian Hesse
3506f71071 global-functions: $CertificateAvailable: fail without CommonName 2024-10-30 22:49:48 +01:00
Christian Hesse
c2c72818de global-functions: $CertificateDownload: add another check...
... that the certificate is really available.

Turns out that mkcert.org ships certificates where OU or whatever
matches - that's not what we want.
2024-09-26 15:24:05 +02:00
Christian Hesse
41b19b045a global-functions: $VersionToNum: support "zero"...
... to have a clean way to generate bitmasks.

    [admin@mikrotik] > :put [ $VersionToNum 0.255zero0 ]
    16711680
    [admin@mikrotik] > :put 0x00ff0000
    16711680

Once implemented everywhere the internal calculation could be
changed easily.
2024-09-13 10:22:06 +02:00
Christian Hesse
511184a4a7 global-functions: $EitherOr: revert...
... but leave a comment.
2024-07-22 21:14:03 +02:00
Christian Hesse
8ea7805541 global-functions: $EitherOr: pass boolean value
Note that literal "true" or "false" (even without quotes) is converted
to string. So you may have to enclose it in parentheses for a boolean
value:

    > :put [ :typeof [ $EitherOr true false ] ];
    str
    > :put [ :typeof [ $EitherOr (true) (false) ] ];
    bool
2024-07-22 18:28:56 +02:00
Christian Hesse
2fd0d27447 global-functions: $Unix2Dos: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
8f75d542f3 global-functions: $PrettyPrint: use :tocrlf 2024-07-16 13:50:22 +02:00
Christian Hesse
8074305b92 global-functions: $Dos2Unix: use :tolf 2024-07-16 13:50:22 +02:00
Christian Hesse
f2ca62aed0 global-functions: $ScriptInstallUpdate: support storing with CRLF
Adding this in `global-config-overlay` make the scripts being stored
with CRLF line breaks:

    :global ScriptUpdatesCRLF true;

Handle with care, I do not recommend it. Thus it's just a hidden
setting.
2024-07-16 13:50:22 +02:00
Christian Hesse
68f61ae622 global-functions: $ScriptInstallUpdate: allow CRLF on device 2024-07-16 13:50:22 +02:00
Christian Hesse
2d42fed621 global-functions: $ScriptInstallUpdate: forcibly convert to LF...
... to make sure we do not have unintended CRLF line breaks.
2024-07-16 13:50:22 +02:00
Christian Hesse
eab9b28cd2 global-functions: $MkDir: enable tmpfs if disabled 2024-07-04 15:31:43 +02:00
Christian Hesse
ce1b635eb2 global-functions: $GetMacVendor: cert 'GTS Root R4' 2024-07-02 21:29:14 +02:00
Christian Hesse
cdb553d39b global-functions: $CertificateDownload: try fallback to mkcert.org
There's a nice API that allows to download certificate by exact common
name. Let's use that, as a fallback at least.

https://mkcert.org/
2024-06-21 16:04:05 +02:00
Christian Hesse
1a6812ef79 notify on changes regarding certificates 2024-06-21 15:57:04 +02:00
Christian Hesse
0ae3d31c58 certs: GTS CA 1C3 / GTS CA 1P5 -> GTS Root R1 2024-06-21 15:57:04 +02:00
Christian Hesse
3f51ebc125 certs: R3 / R10 -> ISRG Root X1 2024-06-21 15:57:04 +02:00
Christian Hesse
d1693a241b certs: E1 / E5 -> ISRG Root X2
In the beginning of Let's Encrypt their root certificate ISRG Root X1
was not widely trusted, at least some older and/or mobile platforms were
missing that certificate in their root certificate store.
At that time Let's Encrypt was using an alternative chain of trust,
where a certificate was cross-signed with DST Root CA X3.

To make sure a valid chain of trust is available under all circumstances
a set of all certificates had to be supplied: both root vertificates
ISRG Root X1 & DST Root CA X3, and an intermediate certificate.
This was still true after DST Root CA X3 expired, as it could still be
used as a root anchor and was shipped by Let's Encrypt when requested. 🤪

This time is finally over, and we have a clean chain for trust ending in
ISRG Root X1 (or ISRG Root X2).
Well, actually it is the other way round... Let's Encrypt signs with
different tantamount intermediate certificates. There is not only E5, but
also E6 - and we can not know beforehand which one is used on renew.

So let's jetzt drop the intermediate certificates now, and rely on root
certificates only. We are perfectly fine with this these days.

Follow-up commits will do the same for *all* certificates.

The certificate is downloaded with:

    curl -d '["ISRG Root X2"]' https://mkcert.org/generate/ | grep -v '^$' > certs/ISRG-Root-X2.pem
2024-06-21 15:55:45 +02:00
Christian Hesse
76dd069fa6 Let's Encrypt changed their intermediate certificates
https://letsencrypt.org/2024/03/19/new-intermediate-certificates
https://letsencrypt.org/certificates/

But let's keep the old ones around for now, as some sites are still
using the old intermediate.
2024-06-19 09:29:23 +02:00
Christian Hesse
e35ba4b06c global-functions: $CleanName: no exception for dash...
... as we still want to deduplicate it when it is inside the input
string. This also unbreak certificate import for "Go Daddy Secure
Certificate Authority - G2" (and more)...
2024-06-01 23:06:24 +02:00
Christian Hesse
33a495beb7 backup-partition: news on support for copy-over 2024-05-23 12:27:23 +02:00
Christian Hesse
545fb5583a global-functions: $IsTimeSync: initialize with uptime...
... to make sure the warning is not issued too early.
2024-05-15 15:52:28 +02:00
Christian Hesse
c87a7519fe fw-addr-lists: add 'strongips' list from blocklist.de 2024-05-14 11:36:58 +02:00
Christian Hesse
2745597b93 global-functions: $IsTimeSync: add (one time) warning on failed ntp sync 2024-05-08 14:25:31 +02:00
Christian Hesse
fb7170f312 global-functions: $IsTimeSync: log just once 2024-05-08 12:30:13 +02:00
Christian Hesse
eae8dbbb37 global-functions: $WaitForFile: drop extra conversion 2024-04-29 23:02:48 +02:00
Christian Hesse
517ed7bf8c global-functions: $WaitForFile: respect minimum delay 2024-04-29 23:02:48 +02:00
Christian Hesse
52ec6b7ea1 global-functions: $WaitForFile: use fewer steps 2024-04-29 23:02:48 +02:00
Christian Hesse
755db5d66d global-functions: $CleanName: do not start with a dash 2024-04-29 23:02:48 +02:00
Christian Hesse
4006d07222 global-functions: $FetchHuge: remove temporary directory 2024-04-29 23:02:48 +02:00
Christian Hesse
0f2a4aedab global-functions: $CertificateDownload: remove with find...
... to make sure this does not break when the file does no longer
exist. Starting with RouterOS 7.15rc1 the file is automatically
removed on import.
2024-04-19 11:46:17 +02:00
Christian Hesse
6fd0becf64 global-functions: introduce $ProtocolStrip 2024-04-19 08:59:51 +02:00
Christian Hesse
e1781fb805 global-functions: $CertificateDownload: use single quotes 2024-04-15 09:11:25 +02:00
Christian Hesse
7aa5059f6d global-functions: $CertificateAvailable: use single quotes 2024-04-15 09:11:25 +02:00
Christian Hesse
ca2e5f2a01 mod/notification-ntfy: support basic auth
Closes #59
2024-04-15 09:11:17 +02:00
Christian Hesse
5f76c245b0 global-functions: $ScriptFromTerminal: check multiple invocations...
... and return false.

We can not tell which job is us... So better safe than sorry.
2024-04-11 14:03:43 +02:00
Christian Hesse
6db3355858 global-functions: $ScriptLock: break long lines 2024-04-11 13:41:49 +02:00
Christian Hesse
e53c31e9e6 global-functions: $ScriptLock: degrade message to debug 2024-04-11 13:41:49 +02:00
Christian Hesse
c5a5fb5836 global-functions: $SendNotification: set origin 2024-04-10 10:08:58 +02:00
Christian Hesse
3015743b19 global-functions: $HumanReadableNum: indicate binary base...
... and update scripts to match the change.
2024-04-07 22:51:24 +02:00
Christian Hesse
36cf4d028b global-functions: drop $LogPrintExit2 2024-04-07 22:51:24 +02:00
Christian Hesse
402f847db2 global-functions: $FetchHuge: remove file on failed download 2024-04-06 00:47:21 +02:00
Christian Hesse
61ee5cbd6c global-functions: $FetchHuge: make sure to work with clean file names 2024-04-06 00:47:21 +02:00
Christian Hesse
2edf983698 global-functions: $FetchHuge: control check-certificate with parameter 2024-04-06 00:47:16 +02:00