Conversion PFX to PEM certificate suitable for HAproxy

If you are maintaining such haproxy ssl offloading, probably this quick'n'dirty script will be useful for you.

!#/bin/sh

openssl pkcs12 -in $1.pfx -out $1_nokey.pem -nokeys && \
openssl pkcs12 -in $1.pfx -out $1_withkey.pem && \
openssl rsa -in $1_withkey.pem -out $1.key && \
cat $1_nokey.pem $1.key > $1.pem
Share with Me via Nextcloud