2018-06-23

CONVERT LETSENCRYPT .PEM FILE TO .CRT and .KEY

1/ CONVERT LETSENCRYPT [.PEM] FILE TO [.CRT] and [.KEY]
#/etc/letsencrypt/live/
cert.pem 2,719 2018.06.22 11:51p -a--
chain.pem 1,647 2018.06.22 11:51p -a--
fullchain.pem 4,366 2018.06.22 11:51p -a--
fullchain.pem.crt 4,366 2018.06.22 11:51p -a--
privkey.pem 3,272 2018.06.22 11:51p -a--
privkey.pem.key 3,272 2018.06.22 11:51p -a--
README 968 2018.06.23 12:03a -a--
The are just different “extensions” but are all essentially text files.
+your key file (mysite.com.key) will be privkey.pem
+your cert file (mysite.com.crt) will be cert.pem
+your ca file ( AlphaSSL.crt in your example) will be chain.pem or fullchain.pem ( depending exactly what you need )


2/ LETSENCRYPT TO [.PEM] FILE FOR HAPROXY
2.1/ combined_file="/etc/haproxy/certs/${domain}.pem"
2.2/ cat /etc/letsencrypt/live/$domain/fullchain.pem /etc/letsencrypt/live/$domain/privkey.pem > $combined_file



3/ BONUS
cd /etc/haproxy/certs/
DOMAIN_NAME=mgiay.com
PEM_FILE=$DOMAIN_NAME.pem
CRT_FILE=$DOMAIN_NAME.crt
KEY_FILE=$DOMAIN_NAME.key
openssl x509 -outform der -in $PEM_FILE -out $CRT_FILE

openssl pkey -in $PEM_FILE -out $KEY_FILE


#Convert PEM to PFX:
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt


No comments:

Post a Comment