From aac8e90c210c89ba99c7d8d37cbad3cf9f481df1 Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Wed, 8 Feb 2017 14:14:44 +0100 Subject: [PATCH] evoacme: - Fix ssl conf replacement - Fix acme user home --- evoacme/files/evoacme.sh | 8 ++++---- evoacme/tasks/acme.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/evoacme/files/evoacme.sh b/evoacme/files/evoacme.sh index 38376d6f..7c2a43b7 100755 --- a/evoacme/files/evoacme.sh +++ b/evoacme/files/evoacme.sh @@ -31,17 +31,17 @@ sudo -u acme certbot certonly --quiet --webroot --csr $CSR_DIR/${vhost}.csr --we if [ $? != 0 ]; then if [ -d /etc/apache2 ]; then - sed -i "s~^SSLCertificateFile.*$~SSLCertificateFile $SELF_SIGNED_DIR/${vhost}.pem~" /etc/apache2/ssl/${vhost}.conf + [ -f /etc/apache2/ssl/${vhost}.conf ] && sed -i "s~^SSLCertificateFile.*$~SSLCertificateFile $SELF_SIGNED_DIR/${vhost}.pem~" /etc/apache2/ssl/${vhost}.conf fi if [ -d /etc/nginx ]; then - sed -i "s~^ssl_certificate[^_]*$~ssl_certificate $SELF_SIGNED_DIR/${vhost}.pem;~" /etc/nginx/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 fi exit 1 fi which apache2ctl>/dev/null if [ $? == 0 ]; then - sed -i "s~^SSLCertificateFile.*$~SSLCertificateFile $CRT_DIR/${vhost}-fullchain.pem~" /etc/apache2/ssl/${vhost}.conf + [ -f /etc/apache2/ssl/${vhost}.conf ] && sed -i "s~^SSLCertificateFile.*$~SSLCertificateFile $CRT_DIR/${vhost}-fullchain.pem~" /etc/apache2/ssl/${vhost}.conf apache2ctl -t 2>/dev/null if [ $? == 0 ]; then service apache2 reload @@ -49,7 +49,7 @@ if [ $? == 0 ]; then fi which nginx>/dev/null if [ $? == 0 ]; then - sed -i "s~^ssl_certificate[^_]*$~ssl_certificate $CRT_DIR/${vhost}-fullchain.pem;~" /etc/nginx/ssl/${vhost}.conf + [ -f /etc/nginx/ssl/${vhost}.conf ] && sed -i "s~^ssl_certificate[^_]*$~ssl_certificate $CRT_DIR/${vhost}-fullchain.pem;~" /etc/nginx/ssl/${vhost}.conf nginx -t 2>/dev/null if [ $? == 0 ]; then service nginx reload diff --git a/evoacme/tasks/acme.yml b/evoacme/tasks/acme.yml index 2ae05999..690c836d 100644 --- a/evoacme/tasks/acme.yml +++ b/evoacme/tasks/acme.yml @@ -10,7 +10,7 @@ group: acme state: present createhome: no - home: "{{ evoacme_crt_dir }}" + home: "{{ evoacme_acme_dir }}" shell: /bin/false - name: Fix crt dir's right