Merge pull request #642 from al-cheb/al-cheb/install_root_ca

Install missing root certificates on windows-2019
This commit is contained in:
Alejandro Pauly
2020-04-01 12:43:50 -04:00
committed by GitHub
2 changed files with 28 additions and 0 deletions

View File

@@ -586,6 +586,12 @@
"{{ template_dir }}/scripts/Installers/Install-Bazel.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-RootCA.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "10m"

View File

@@ -0,0 +1,22 @@
# Serialized Certificate Store File
$sstFile = "$env:TEMP\roots.sst"
# Generate SST from Windows Update
$result = certutil.exe -generateSSTFromWU $sstFile
if ($LASTEXITCODE -ne 0) {
Write-Host "[Error]: failed to generate $sstFile sst file`n$result"
exit $LASTEXITCODE
}
$result = certutil.exe -dump $sstFile
if ($LASTEXITCODE -ne 0) {
Write-Host "[Error]: failed to dump $sstFile sst file`n$result"
exit $LASTEXITCODE
}
try {
Import-Certificate -FilePath $sstFile -CertStoreLocation Cert:\LocalMachine\Root
} catch {
Write-Host "[Error]: failed to import ROOT CA`n$_"
exit 1
}