global-functions: $CertificateDownload: add proper version in user agent

This commit is contained in:
Christian Hesse 2023-06-13 12:53:38 +02:00
parent 1e29eeb388
commit 196fe1b010

View file

@ -116,14 +116,15 @@
:global UrlEncode;
:global WaitForFile;
:local UserAgent ("User-Agent: Mikrotik/" . [ /system/resource/get version ] . " Fetch");
$LogPrintExit2 info $0 ("Downloading and importing certificate with " . \
"CommonName \"" . $CommonName . "\".") false;
:do {
:local LocalFileName ($CommonName . ".pem");
:local UrlFileName ([ $UrlEncode $CommonName ] . ".pem");
/tool/fetch check-certificate=yes-without-crl \
($ScriptUpdatesBaseUrl . "certs/" . \
$UrlFileName . $ScriptUpdatesUrlSuffix) \
/tool/fetch check-certificate=yes-without-crl http-header-field=$UserAgent \
($ScriptUpdatesBaseUrl . "certs/" . $UrlFileName . $ScriptUpdatesUrlSuffix) \
dst-path=$LocalFileName as-value;
$WaitForFile $LocalFileName;
/certificate/import file-name=$LocalFileName passphrase="" as-value;