Script for export crt and key to apache

Hi everyone,
I use apache so I made a script to automatically deploy the private key and the certificate:

$latest = $result.ManagedItem.CertificatePath
openssl pkcs12 -in $latest -passin pass: -out C:\path\to\apache\ssl.key\public.key -nocerts -nodes
openssl pkcs12 -in $latest -out C:\path\to\apache\ssl.crt\public.crt -nokeys -passin pass:
Restart-Service -Name Apache2.4 -Force

Edit accordingly to your scenario, set certify to run post-request script and that’s it.

P.S. You need to set the path environment variable for openssl in windows or run it from the openssl directory

1 Like