mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Merge pull request #1428 from zoran-rilak-msft/sqlmi-vpn-passwdfix
Remove password in cleartext
This commit is contained in:
+1
-8
@@ -6,17 +6,12 @@ $environmentName = $parameters['environmentName']
|
||||
$resourceGroupName = $parameters['resourceGroupName']
|
||||
$virtualNetworkName = $parameters['virtualNetworkName']
|
||||
$certificateNamePrefix = $parameters['certificateNamePrefix']
|
||||
$clientCertificatePassword = $parameters['clientCertificatePassword'] #used only when certificates are created using openssl
|
||||
|
||||
if ($environmentName -eq '' -or ($null -eq $environmentName)) {
|
||||
$environmentName = 'AzureCloud'
|
||||
Write-Host "Environment: AzureCloud." -ForegroundColor Green
|
||||
}
|
||||
|
||||
if ($clientCertificatePassword -eq '' -or ($null -eq $clientCertificatePassword)) {
|
||||
$clientCertificatePassword = 'S0m3Str0nGP@ssw0rd'
|
||||
}
|
||||
|
||||
function VerifyPSVersion {
|
||||
Write-Host "Verifying PowerShell version."
|
||||
if ($PSVersionTable.PSEdition -eq "Desktop" -or $PSVersionTable.PSEdition -eq "Core" ) {
|
||||
@@ -216,9 +211,7 @@ function CreateCerificateOpenSsl() {
|
||||
ipsec pki --pub --in "$($dn)Key.pem" --outform pem > "$($dn)PubKey.pem"
|
||||
ipsec pki --issue --in "$($dn)PubKey.pem" --cacert caCert.pem --cakey caKey.pem --dn "CN=$($dn)" --san $dn --flag clientAuth --outform pem > "$($dn)Cert.pem"
|
||||
|
||||
openssl pkcs12 -in "$($dn)Cert.pem" -inkey "$($dn)Key.pem" -certfile caCert.pem -export -out "$($dn).p12" -password "pass:$($clientCertificatePassword)"
|
||||
#openssl pkcs12 -in "$($dn).p12" -password "pass:$($clientCertificatePassword)" -nocerts -out "$($dn)PrivateKey.pem" -nodes
|
||||
#openssl pkcs12 -in "$($dn).p12" -password "pass:$($clientCertificatePassword)" -nokeys -out "$($dn)PublicCert.pem" -nodes
|
||||
openssl pkcs12 -in "$($dn)Cert.pem" -inkey "$($dn)Key.pem" -certfile caCert.pem -export -out "$($dn).p12" --certpbe NONE -passout pass:
|
||||
|
||||
$publicRootCertData = openssl x509 -in caCert.pem -outform pem
|
||||
$publicRootCertData = $publicRootCertData -replace "-----BEGIN CERTIFICATE-----", ""
|
||||
|
||||
Reference in New Issue
Block a user