#!/bin/sh # # Convert PEM Certificate to ca-bundle.crt format # # example: # ./bundle_certs.sh myserver.crt >myserver.chain # ./bundle_certs.sh intermediate.crt >>myserver.chain # ./bundle_certs.sh root.crt >>myserver.chain test ! $1 && printf "Usage: `basename $0` certificate" && exit 1 # Friendly Name and Underline Friendly Name with equal signs openssl x509 -in $1 -text -noout | sed -e 's/^ *Subject:.*CN=\([^,]*\).*/\1/p;t c' -e 'd;:c' -e 's/./=/g' # Output Fingerprint and swap = for : openssl x509 -in $1 -noout -fingerprint | sed -e 's/=/: /' # Output PEM Data: echo 'PEM Data:' # Output Certificate openssl x509 -in $1 # Output Certificate text swapping Certificate with Certificate Ingredients openssl x509 -in $1 -text -noout | sed -e 's/^Certificate:/Certificate Ingredients:/'