evoacme: refactoring of certbot.cron

This commit is contained in:
Victor LABORIE 2017-08-25 14:32:58 +02:00
parent 9deb594834
commit 8d7cbab3a9
1 changed files with 8 additions and 11 deletions

View File

@ -1,17 +1,14 @@
#!/bin/sh
#
# Run evoacme script on every configured cert
#
# Author: Victor Laborie <vlaborie@evolix.fr>
# Licence: AGPLv3
#
[ -f /etc/default/evoacme ] && . /etc/default/evoacme
[ -z "${CRT_DIR}" ] && CRT_DIR='/etc/letsencrypt'
[ -z "${SELF_SIGNED_DIR}" ] && SELF_SIGNED_DIR='/etc/ssl/self-signed'
find ${CRT_DIR} -maxdepth 1 -mindepth 1 -type d ! -path "*accounts" -exec basename {} \; | while read vhost; do
evoacme $vhost
done
# Compatibility with older version of evoacme
find ${CRT_DIR} -maxdepth 1 -mindepth 1 -type f -name "*.crt" -exec basename {} .crt \; | while read vhost; do
[ -f /etc/apache2/ssl/${vhost}.conf ] && sed -i "s~^SSLCertificateFile.*$~SSLCertificateFile $SELF_SIGNED_DIR/${vhost}.pem~" /etc/apache2/ssl/${vhost}.conf
[ -f /etc/nginx/ssl/${vhost}.conf ] && sed -i "s~^ssl_certificate[^_].*$~ssl_certificate $SELF_SIGNED_DIR/${vhost}.pem;~" /etc/nginx/ssl/${vhost}.conf
rm ${CRT_DIR}/${vhost}.crt ${CRT_DIR}/${vhost}-chain.pem ${CRT_DIR}/${vhost}-fullchain.pem
evoacme $vhost
find "${CRT_DIR}" -maxdepth 1 -mindepth 1 -type d ! -path "*accounts" -exec basename {} \; | while read vhost; do
evoacme "$vhost"
done