From 401b86f4224bc36cb0c32aeda2bdec595abbeb53 Mon Sep 17 00:00:00 2001 From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Fri, 1 May 2026 09:55:04 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 09:55:03 01.05.2026. --- html/AM-GlobalFunc.rsc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index c3e96225b..c8f4a0dba 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :global GlobalFuncReady false; # Git commit id & info, expected configuration version -:global CommitId "main/368/b69ddb1c"; +:global CommitId "main/369/39f0f446"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 09:35:02 01.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 09:55:03 01.05.2026."; # The variables are received right here. :global GlobalConfVersion 138; @@ -555,6 +555,13 @@ } # check and download required certificate +# Description: This function checks if a certificate with given Common Name is available in the system or not. +# If not, it tries to download it from repository. It also checks the certificate chain and downloads missing intermediate certificates if needed. +# Arguments: "Common Name" - the common name of the certificate to check +# "fetch" - if the intended use for certificate is "fetch", it will check if the certificate is available for fetch option and return true if it is, otherwise it will check other options as well and return true if the certificate is available for at least one of the options. +# "tls" - if the intended use for certificate is "tls", it will check if the certificate is available for tls option and return true if it is, otherwise it will check other options as well and return true if the certificate is available for at least one of the options. +# "all" - if the intended use is "all", it will check all options and return true if the certificate is available for at least one of the options. +# "undefined" - if the intended use for certificate is not defined, it will check all options and log a warning as well. # Usage: $CertificateAvailable "Common Name" "intended use for certificate (e.g. "fetch", "tls", "all", "undefined")" :set CertificateAvailable do={ :local CommonName [ :tostr $1 ]; @@ -609,6 +616,13 @@ } # download and import certificate +# Description: This function downloads a certificate with given Common Name from repository and imports it to the system. +# It also checks the certificate chain and downloads missing intermediate certificates if needed from repository. +# If the certificate is already available, it does nothing. +# If the certificate is not available in repository, it attempts to download it from mkcert.org. +# If it is also not available there, it logs a warning and returns false. +# If the certificate is downloaded but still not available after import, it removes all certificates with the same Common Name and logs a warning, assuming the certificate was imported but not named properly. +# Or if there are multiple certificates with the same Common Name, it does nothing as well, assuming the certificate is already imported but not named properly. # Usage: $CertificateDownload "Common Name" :set CertificateDownload do={ :local CommonName [ :tostr $1 ]; @@ -669,6 +683,10 @@ } # name a certificate by its common-name +# Description: Some RouterOS functions require certificate name instead of common-name or fingerprint. +# This function finds a certificate by common-name, fingerprint or name and sets its name to a clean version of common-name +# (only letters, numbers and dashes, other chars are replaced with dash). +# If there are multiple certificates with the same common-name, it will rename the first one found and log a warning. # Usage: $CertificateNameByCN "Common Name" :set CertificateNameByCN do={ :local Match [ :tostr $1 ]; -- 2.52.0