From cd371b69a642d9e3a0bc32795e959c7feef42522 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 16 Mar 2024 23:27:45 +0100 Subject: [PATCH] global-functions: $CertificateDownload: download via clean name... ... and rename certificates in repository. --- ...ECC CA-3.pem => Cloudflare-Inc-ECC-CA-3.pem} | 0 ...iCert-Global-G2-TLS-RSA-SHA256-2020-CA1.pem} | 0 ...DigiCert-TLS-Hybrid-ECC-SHA384-2020-CA1.pem} | 0 certs/{GTS CA 1C3.pem => GTS-CA-1C3.pem} | 0 certs/{GTS CA 1P5.pem => GTS-CA-1P5.pem} | 0 ...> GlobalSign-Atlas-R3-DV-TLS-CA-2022-Q3.pem} | 0 ...o-Daddy-Secure-Certificate-Authority-G2.pem} | 0 ...arfield-Secure-Certificate-Authority-G2.pem} | 0 global-functions.rsc | 17 ++++++++--------- 9 files changed, 8 insertions(+), 9 deletions(-) rename certs/{Cloudflare Inc ECC CA-3.pem => Cloudflare-Inc-ECC-CA-3.pem} (100%) rename certs/{DigiCert Global G2 TLS RSA SHA256 2020 CA1.pem => DigiCert-Global-G2-TLS-RSA-SHA256-2020-CA1.pem} (100%) rename certs/{DigiCert TLS Hybrid ECC SHA384 2020 CA1.pem => DigiCert-TLS-Hybrid-ECC-SHA384-2020-CA1.pem} (100%) rename certs/{GTS CA 1C3.pem => GTS-CA-1C3.pem} (100%) rename certs/{GTS CA 1P5.pem => GTS-CA-1P5.pem} (100%) rename certs/{GlobalSign Atlas R3 DV TLS CA 2022 Q3.pem => GlobalSign-Atlas-R3-DV-TLS-CA-2022-Q3.pem} (100%) rename certs/{Go Daddy Secure Certificate Authority - G2.pem => Go-Daddy-Secure-Certificate-Authority-G2.pem} (100%) rename certs/{Starfield Secure Certificate Authority - G2.pem => Starfield-Secure-Certificate-Authority-G2.pem} (100%) diff --git a/certs/Cloudflare Inc ECC CA-3.pem b/certs/Cloudflare-Inc-ECC-CA-3.pem similarity index 100% rename from certs/Cloudflare Inc ECC CA-3.pem rename to certs/Cloudflare-Inc-ECC-CA-3.pem diff --git a/certs/DigiCert Global G2 TLS RSA SHA256 2020 CA1.pem b/certs/DigiCert-Global-G2-TLS-RSA-SHA256-2020-CA1.pem similarity index 100% rename from certs/DigiCert Global G2 TLS RSA SHA256 2020 CA1.pem rename to certs/DigiCert-Global-G2-TLS-RSA-SHA256-2020-CA1.pem diff --git a/certs/DigiCert TLS Hybrid ECC SHA384 2020 CA1.pem b/certs/DigiCert-TLS-Hybrid-ECC-SHA384-2020-CA1.pem similarity index 100% rename from certs/DigiCert TLS Hybrid ECC SHA384 2020 CA1.pem rename to certs/DigiCert-TLS-Hybrid-ECC-SHA384-2020-CA1.pem diff --git a/certs/GTS CA 1C3.pem b/certs/GTS-CA-1C3.pem similarity index 100% rename from certs/GTS CA 1C3.pem rename to certs/GTS-CA-1C3.pem diff --git a/certs/GTS CA 1P5.pem b/certs/GTS-CA-1P5.pem similarity index 100% rename from certs/GTS CA 1P5.pem rename to certs/GTS-CA-1P5.pem diff --git a/certs/GlobalSign Atlas R3 DV TLS CA 2022 Q3.pem b/certs/GlobalSign-Atlas-R3-DV-TLS-CA-2022-Q3.pem similarity index 100% rename from certs/GlobalSign Atlas R3 DV TLS CA 2022 Q3.pem rename to certs/GlobalSign-Atlas-R3-DV-TLS-CA-2022-Q3.pem diff --git a/certs/Go Daddy Secure Certificate Authority - G2.pem b/certs/Go-Daddy-Secure-Certificate-Authority-G2.pem similarity index 100% rename from certs/Go Daddy Secure Certificate Authority - G2.pem rename to certs/Go-Daddy-Secure-Certificate-Authority-G2.pem diff --git a/certs/Starfield Secure Certificate Authority - G2.pem b/certs/Starfield-Secure-Certificate-Authority-G2.pem similarity index 100% rename from certs/Starfield Secure Certificate Authority - G2.pem rename to certs/Starfield-Secure-Certificate-Authority-G2.pem 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={