diff options
author | Christian Hesse <mail@eworm.de> | 2024-03-16 23:27:45 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-03-16 23:34:33 +0100 |
commit | cd371b69a642d9e3a0bc32795e959c7feef42522 (patch) | |
tree | 2d369949e7ca79d584998bfd828091131befbdb7 /global-functions.rsc | |
parent | eb7919c1d8b4ad5c77e0d120136c4f54e1e157e6 (diff) |
global-functions: $CertificateDownload: download via clean name...
... and rename certificates in repository.
Diffstat (limited to 'global-functions.rsc')
-rw-r--r-- | global-functions.rsc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/global-functions.rsc b/global-functions.rsc index 8df70f1..ca238ba 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -136,25 +136,24 @@ :global ScriptUpdatesUrlSuffix; :global CertificateNameByCN; + :global CleanName; :global FetchUserAgent; :global LogPrint; - :global UrlEncode; :global WaitForFile; $LogPrint info $0 ("Downloading and importing certificate with " . \ "CommonName \"" . $CommonName . "\"."); :do { - :local LocalFileName ($CommonName . ".pem"); - :local UrlFileName ([ $UrlEncode $CommonName ] . ".pem"); + :local FileName ([ $CleanName $CommonName ] . ".pem"); /tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgent $0 ] }) \ - ($ScriptUpdatesBaseUrl . "certs/" . $UrlFileName . $ScriptUpdatesUrlSuffix) \ - dst-path=$LocalFileName as-value; - $WaitForFile $LocalFileName; - /certificate/import file-name=$LocalFileName passphrase="" as-value; + ($ScriptUpdatesBaseUrl . "certs/" . $FileName . $ScriptUpdatesUrlSuffix) \ + dst-path=$FileName as-value; + $WaitForFile $FileName; + /certificate/import file-name=$FileName passphrase="" as-value; :delay 1s; - /file/remove $LocalFileName; + /file/remove $FileName; - :foreach Cert in=[ /certificate/find where name~("^" . $LocalFileName . "_[0-9]+\$") ] do={ + :foreach Cert in=[ /certificate/find where name~("^" . $FileName . "_[0-9]+\$") ] do={ $CertificateNameByCN [ /certificate/get $Cert common-name ]; } } on-error={ |