parent
ae24a11695
commit
a445ea1d08
1 changed files with 16 additions and 8 deletions
@ -1,17 +1,25 @@ |
||||
#!/bin/sh |
||||
|
||||
ACTION=shift |
||||
ACTION=${1} |
||||
|
||||
if [ "$ACTION" == "deploy_cert" ]; then |
||||
if [[ "$ACTION" == "deploy_cert" ]]; then |
||||
# New cert |
||||
KEY=shift |
||||
CRT=shift |
||||
CHAIN=shift |
||||
DOM=${2} |
||||
KEY=${3} |
||||
CRT=${4} |
||||
CHAIN=${5} |
||||
/sbin/e-smith/db configuration setprop modSSL key $KEY crt $CRT CertificateChainFile $CHAIN |
||||
/sbin/e-smith/signal-event ssl-update |
||||
elif [ "$ACTION" == "clean_challenge" ]; then |
||||
ALTNAME=shift |
||||
if [ "$ALTNAME" == "" ]; then |
||||
# Now revoke old certificates |
||||
CUR_CRT=$(readlink /home/e-smith/db/letsencrypt.sh/certs/$DOM/cert.pem) |
||||
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 |
||||
fi |
||||
fi |
||||
|
Loading…
Reference in new issue