global-functions: $CertificateAvailable: support new builtin-trust-store...

... which was introduced with RouterOS 7.21beta7.
This commit is contained in:
Christian Hesse 2025-11-10 11:47:55 +01:00
parent 7f2cdf67cb
commit 959f0a257f

View file

@ -106,11 +106,15 @@
# check and download required certificate
:set CertificateAvailable do={
:local CommonName [ :tostr $1 ];
:local UseFor [ :tostr $2 ];
:global CertificateDownload;
:global EitherOr;
:global LogPrint;
:global ParseKeyValueStore;
:set UseFor [ $EitherOr $UseFor "undefined" ];
:if ([ /system/resource/get free-hdd-space ] < 8388608 && \
[ /certificate/settings/get crl-download ] = true && \
[ /certificate/settings/get crl-store ] = "system") do={
@ -123,7 +127,10 @@
:return false;
}
:if (([ /certificate/settings/get ]->"builtin-trust-anchors") = "trusted" && \
:local CertSettings [ /certificate/settings/get ];
:if ((($CertSettings->"builtin-trust-anchors") = "trusted" || \
($CertSettings->"builtin-trust-store") ~ $UseFor || \
($CertSettings->"builtin-trust-store") = "all") && \
[[ :parse (":return [ :len [ /certificate/builtin/find where common-name=\"" . $CommonName . "\" ] ]") ]] > 0) do={
:return true;
}