mirror of
https://github.com/Grace-Solutions/Invoke-OpenSSHConfiguration.git
synced 2026-07-26 11:38:14 +00:00
Remove unnecessary individual PEM exports for CA bundle
- Removed -Export switch when creating CA bundle (only bundle is needed) - Individual certificate directories and PEM files are no longer created - Only the combined CA bundle file is written to disk - Updated Example 4 documentation to reflect correct usage
This commit is contained in:
@@ -168,11 +168,11 @@ Function ConvertFrom-CertificateToPEM
|
||||
$IntermediateCAs = Get-ChildItem -Path 'Cert:\LocalMachine\CA' | Where-Object { ($_.NotAfter -gt (Get-Date)) -and ($_.Extensions | Where-Object { $_.Oid.FriendlyName -eq 'Basic Constraints' -and $_.CertificateAuthority }) }
|
||||
$CACertificateList.AddRange([System.Security.Cryptography.X509Certificates.X509Certificate2[]]$IntermediateCAs)
|
||||
|
||||
# Export to the standard OpenSSH machine configuration directory
|
||||
# Create CA bundle in the standard OpenSSH machine configuration directory
|
||||
# Note: -Export is NOT specified, so individual certificate files are NOT created (only the bundle)
|
||||
# Note: -IncludePrivateKey is NOT specified, so only public certificates are exported (secure default)
|
||||
$ConvertFromCertificateToPEMParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
||||
$ConvertFromCertificateToPEMParameters.CertificateList = $CACertificateList
|
||||
$ConvertFromCertificateToPEMParameters.Export = $True
|
||||
$ConvertFromCertificateToPEMParameters.ExportRootDirectory = "$($Env:ProgramData)\ssh"
|
||||
$ConvertFromCertificateToPEMParameters.CreateCABundle = $True
|
||||
$ConvertFromCertificateToPEMParameters.CABundleFileName = 'OpenSSH-TrustedCertificateAuthorities-LocalMachine.pem'
|
||||
|
||||
Reference in New Issue
Block a user