Pass PKCS12_PASSWORD option to le-renew.sh

This commit is contained in:
beredim 2022-07-06 18:04:59 +03:00 committed by GitHub
parent 98ab2f7940
commit 02b1ff03e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,12 @@ echo "Running certbot renew"
if [ "$ORIGVALIDATION" = "dns" ] || [ "$ORIGVALIDATION" = "duckdns" ]; then if [ "$ORIGVALIDATION" = "dns" ] || [ "$ORIGVALIDATION" = "duckdns" ]; then
certbot -n renew \ certbot -n renew \
--post-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -h /var/run/s6/services/nginx; fi; \ --post-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -h /var/run/s6/services/nginx; fi; \
cd /config/keys/letsencrypt && \ cd /config/keys/letsencrypt
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass: && \ if [[ -z "${PKCS12_PASSWORD}" ]]; then
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass:
else
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass:"${PKCS12_PASSWORD}"
fi
sleep 1 && \ sleep 1 && \
cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \ cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \
chown -R abc:abc /config/etc/letsencrypt" chown -R abc:abc /config/etc/letsencrypt"
@ -19,8 +23,12 @@ else
certbot -n renew \ certbot -n renew \
--pre-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -d /var/run/s6/services/nginx; fi" \ --pre-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -d /var/run/s6/services/nginx; fi" \
--post-hook "if ps aux | grep 's6-supervise nginx' | grep -v grep > /dev/null; then s6-svc -u /var/run/s6/services/nginx; fi; \ --post-hook "if ps aux | grep 's6-supervise nginx' | grep -v grep > /dev/null; then s6-svc -u /var/run/s6/services/nginx; fi; \
cd /config/keys/letsencrypt && \ cd /config/keys/letsencrypt
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass: && \ if [[ -z "${PKCS12_PASSWORD}" ]]; then
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass:
else
openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass:"${PKCS12_PASSWORD}"
fi
sleep 1 && \ sleep 1 && \
cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \ cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \
chown -R abc:abc /config/etc/letsencrypt" chown -R abc:abc /config/etc/letsencrypt"