Created
December 11, 2017 11:51
-
-
Save towo/52b4116ce27127a5e40546cbf571d7a5 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
set -e | |
EVENT_NAME="$1" | |
[ "$EVENT_NAME" = "live-updated" ] || exit 42 | |
if [ ! -e "${ACME_STATE_DIR}" ]; then | |
exit 42 | |
fi | |
umask 0027 | |
mkdir -p "${ACME_STATE_DIR}/pkcs12" | |
while read name; do | |
certdir="${ACME_STATE_DIR}/live/${name}" | |
p12target="${ACME_STATE_DIR}/pkcs12/${name}.p12" | |
if [ -z "${name}" -o ! -e "${certdir}" ]; then | |
continue; | |
fi | |
if [ -e "${p12target}" ]; then | |
rm $p12target | |
fi | |
if [ -e "${p12target}-password" ]; then | |
rm "${p12target}-password" | |
fi | |
openssl pkcs12 -export \ | |
-out "${p12target}" \ | |
-in "${certdir}/cert" \ | |
-inkey "${certdir}/privkey" \ | |
-chain \ | |
-CAfile "${certdir}/chain" \ | |
-password pass: | |
# Some applications are dumb and don't work when not using a password for the certificate. | |
openssl pkcs12 -export \ | |
-out "${p12target}-password" \ | |
-in "${certdir}/cert" \ | |
-inkey "${certdir}/privkey" \ | |
-chain \ | |
-CAfile "${certdir}/chain" \ | |
-password pass:yourapplicationisbadandyoushouldfeelbad | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment