Skip to content

Commit

Permalink
[Windows] Fix access denied issue in OVS cert import
Browse files Browse the repository at this point in the history
An "Access is denied" error is possibly returned when importing certificate into
the trusted publishers store at the first time on a fresh Windows 2022 Node.

To resolve the issue, this change uses the "Add" method provided by certificate
stre as an alternative when importing to trusted publishers.

Signed-off-by: Wenying Dong <wenyingd@vmware.com>
  • Loading branch information
wenyingd committed Jul 17, 2024
1 parent 5cee770 commit 2af0434
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hack/windows/Install-OVS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ function CheckAndInstallOVSDriver {
$ExportType = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert
$Cert = (Get-AuthenticodeSignature $DriverFile).SignerCertificate
[System.IO.File]::WriteAllBytes($CertificateFile, $Cert.Export($ExportType))
Import-Certificate -FilePath "$CertificateFile" -CertStoreLocation cert:\LocalMachine\TrustedPublisher
# Use certstore.Add to import cert into trusted publishers instead of Import-Certificate,
# otherwise an error "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
# (issue # ) is possibly hit when the import-certificate to trusted publisher store is firstly
# performed on a fresh Windows 2022 Node.
$CertStore = Get-Item cert:\LocalMachine\TrustedPublisher
$CertStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$CertStore.Add($(Get-Item $CertificateFile).FullName)
$CertStore.Close()
Import-Certificate -FilePath "$CertificateFile" -CertStoreLocation cert:\LocalMachine\Root

# Install the OVSext driver with the desired version
Expand Down

0 comments on commit 2af0434

Please sign in to comment.