ansible-roles/evoacme/files/certbot.cron

18 lines
906 B
Plaintext
Raw Normal View History

2017-06-12 11:58:11 +02:00
#!/bin/sh
2017-06-12 11:58:11 +02:00
[ -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
2017-06-12 14:09:29 +02:00
evoacme $vhost
2017-06-12 11:58:11 +02:00
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
2017-06-12 14:09:29 +02:00
evoacme $vhost
done