init.ps1 is able to import CA root certificate
Change-Id: I6bc3d164d328dd7ed99d28e23ec69dba0f503006
This commit is contained in:
@@ -7,6 +7,9 @@ $WindowsAgentLogFile = "C:\Murano\Agent\log.txt"
|
|||||||
$NewComputerName = '%INTERNAL_HOSTNAME%'
|
$NewComputerName = '%INTERNAL_HOSTNAME%'
|
||||||
$MuranoFileShare = '\\%MURANO_SERVER_ADDRESS%\share'
|
$MuranoFileShare = '\\%MURANO_SERVER_ADDRESS%\share'
|
||||||
|
|
||||||
|
$CaRootCertBase64 = "%CA_ROOT_CERT_BASE64%"
|
||||||
|
$CaRootCertFile = "C:\Murano\ca.cert"
|
||||||
|
|
||||||
$RestartRequired = $false
|
$RestartRequired = $false
|
||||||
|
|
||||||
Import-Module CoreFunctions
|
Import-Module CoreFunctions
|
||||||
@@ -21,6 +24,20 @@ trap {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Log "Importing CA certificate ..."
|
||||||
|
if ($CaRootCertBase64 -eq '') {
|
||||||
|
Write-Log "Importing CA certificate ... skipped"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ConvertFrom-Base64String -Base64String $CaRootCertBase64 -Path $CaRootCertFile
|
||||||
|
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $CaRootCertFile
|
||||||
|
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("AuthRoot","LocalMachine")
|
||||||
|
$store.Open("MaxAllowed")
|
||||||
|
$store.Add($cert)
|
||||||
|
$store.Close()
|
||||||
|
Write-Log "Importing CA certificate ... done"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Log "Updating Murano Windows Agent."
|
Write-Log "Updating Murano Windows Agent."
|
||||||
Stop-Service "Murano Agent"
|
Stop-Service "Murano Agent"
|
||||||
Backup-File $WindowsAgentConfigFile
|
Backup-File $WindowsAgentConfigFile
|
||||||
|
|||||||
Reference in New Issue
Block a user