|
|
@ -1,19 +1,16 @@ |
|
|
|
#!/bin/sh |
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
|
|
ACTION=${1} |
|
|
|
# New cert |
|
|
|
|
|
|
|
DOM=${1} |
|
|
|
if [[ "$ACTION" == "deploy_cert" ]]; then |
|
|
|
KEY=${2} |
|
|
|
# New cert |
|
|
|
CRT=${3} |
|
|
|
DOM=${2} |
|
|
|
CHAIN=${4} |
|
|
|
KEY=${3} |
|
|
|
/sbin/e-smith/db configuration setprop modSSL key $KEY crt $CRT CertificateChainFile $CHAIN |
|
|
|
CRT=${4} |
|
|
|
# There's a new ssl-udpate event which update everything in a single event |
|
|
|
CHAIN=${5} |
|
|
|
# fallback to manual operations if this event doesn't exist |
|
|
|
/sbin/e-smith/db configuration setprop modSSL key $KEY crt $CRT CertificateChainFile $CHAIN |
|
|
|
if [ -d /etc/e-smith/events/ssl-update ]; then |
|
|
|
# There's a new ssl-udpate event which update everything in a single event |
|
|
|
|
|
|
|
# fallback to manual operations if this event doesn't exist |
|
|
|
|
|
|
|
if [ -d /etc/e-smith/events/ssl-update ]; then |
|
|
|
|
|
|
|
/sbin/e-smith/signal-event ssl-update |
|
|
|
/sbin/e-smith/signal-event ssl-update |
|
|
|
else |
|
|
|
else |
|
|
|
/sbin/e-smith/expand-template /home/e-smith/db/ssl.pem/pem |
|
|
|
/sbin/e-smith/expand-template /home/e-smith/db/ssl.pem/pem |
|
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
|
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
|
|
|
/sbin/e-smith/expand-template /var/service/qpsmtpd/ssl/cert.pem |
|
|
|
/sbin/e-smith/expand-template /var/service/qpsmtpd/ssl/cert.pem |
|
|
@ -28,17 +25,11 @@ if [[ "$ACTION" == "deploy_cert" ]]; then |
|
|
|
else |
|
|
|
else |
|
|
|
/usr/bin/sv 1 /service/imaps |
|
|
|
/usr/bin/sv 1 /service/imaps |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
# Now revoke old certificates |
|
|
|
# Now revoke old certificates |
|
|
|
CUR_CRT=$(readlink /home/e-smith/db/letsencrypt.sh/certs/$DOM/cert.pem) |
|
|
|
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 |
|
|
|
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 |
|
|
|
if [[ "$cert" != "$CUR_CRT" ]]; then |
|
|
|
/usr/bin/letsencrypt.sh -r /home/e-smith/db/letsencrypt.sh/certs/$DOM/$cert |
|
|
|
/usr/bin/letsencrypt.sh -r /home/e-smith/db/letsencrypt.sh/certs/$DOM/$cert |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
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 |
|
|
|
|
|
|
|