Last active
May 21, 2023 08:18
-
-
Save erik-jenkins/a4dfdd944d2410fae7bdd7765f330508 to your computer and use it in GitHub Desktop.
Script to generate .pfx from Let's Encrypt .pem files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$#" -ne 3 ]; then | |
echo "Usage: letsencrypt_generate_pfx.sh <domain> <password> <output>" | |
echo "Example: letsencrypt_generate_pfx.sh fingerguns.co p4ssw0rd /some/dir/certificate.pfx" | |
exit 1 | |
fi | |
domain=$1 | |
password=$2 | |
output=$3 | |
openssl pkcs12 \ | |
-export -out $output \ | |
-inkey /etc/letsencrypt/live/$domain/privkey.pem \ | |
-in /etc/letsencrypt/live/$domain/cert.pem \ | |
-certfile /etc/letsencrypt/live/$domain/chain.pem \ | |
-password pass:$password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this script somewhere and add a certbot post-deploy hook to call this and generate the
.pfx
file for ASP.NET Core to read. The webserver will need to be restarted on renewal as well.