Fix hook script and revoke old certificates

tags/smeserver-letsencrypt-client-0.2.4-1
Daniel Berteaud 9 years ago
parent ae24a11695
commit a445ea1d08
  1. 24
      root/sbin/e-smith/le_hook.sh

@ -1,17 +1,25 @@
#!/bin/sh #!/bin/sh
ACTION=shift ACTION=${1}
if [ "$ACTION" == "deploy_cert" ]; then if [[ "$ACTION" == "deploy_cert" ]]; then
# New cert # New cert
KEY=shift DOM=${2}
CRT=shift KEY=${3}
CHAIN=shift CRT=${4}
CHAIN=${5}
/sbin/e-smith/db configuration setprop modSSL key $KEY crt $CRT CertificateChainFile $CHAIN /sbin/e-smith/db configuration setprop modSSL key $KEY crt $CRT CertificateChainFile $CHAIN
/sbin/e-smith/signal-event ssl-update /sbin/e-smith/signal-event ssl-update
elif [ "$ACTION" == "clean_challenge" ]; then # Now revoke old certificates
ALTNAME=shift CUR_CRT=$(readlink /home/e-smith/db/letsencrypt.sh/certs/$DOM/cert.pem)
if [ "$ALTNAME" == "" ]; then for cert in $(find /home/e-smith/db/letsencrypt.sh/certs/$DOM/ -type f -name cert\*.pem -exec basename "{}" \;); do
if [[ "$cert" != "$CUR_CRT" ]]; then
/usr/bin/letsencrypt.sh -r /home/e-smith/db/letsencrypt.sh/certs/$DOM/$cert
fi
done
elif [[ "$ACTION" == "clean_challenge" ]]; then
ALTNAME=${2}
if [[ "$ALTNAME" == "" ]]; then
echo "Error while creating or renewing letsencrypt certificate" | mail -s "Letsencrypt error" admin echo "Error while creating or renewing letsencrypt certificate" | mail -s "Letsencrypt error" admin
fi fi
fi fi

Loading…
Cancel
Save