1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

global-functions: $CertificateDownload: properly name new certificates

This commit is contained in:
Christian Hesse
2020-01-06 10:20:19 +01:00
parent aa885e17e2
commit b3a76c7e4b

View File

@ -86,6 +86,7 @@
:global ScriptUpdatesBaseUrl; :global ScriptUpdatesBaseUrl;
:global ScriptUpdatesUrlSuffix; :global ScriptUpdatesUrlSuffix;
:global CharacterReplace;
:global UrlEncode; :global UrlEncode;
:global WaitForFile; :global WaitForFile;
@ -101,6 +102,10 @@
$WaitForFile $LocalFileName; $WaitForFile $LocalFileName;
/ certificate import file-name=$LocalFileName passphrase=""; / certificate import file-name=$LocalFileName passphrase="";
/ file remove $LocalFileName; / file remove $LocalFileName;
:foreach Cert in=[ / certificate find where name~("^" . $LocalFileName . "_[0-9]+\$") ] do={
/ certificate set $Cert name=[ $CharacterReplace [ $CharacterReplace [ get $Cert common-name ] " " "-" ] "---" "-" ];
}
} on-error={ } on-error={
:log warning "Failed imprting certificate!"; :log warning "Failed imprting certificate!";
} }