From 9983b7cff900042c89aaaa3529bd9c92407764bd Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 20 Jun 2018 21:11:35 +0200 Subject: letsencrypt: notify of renewals --- etc/ncp-config.d/letsencrypt.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/ncp-config.d/letsencrypt.sh b/etc/ncp-config.d/letsencrypt.sh index 246244c9..8a0e06f1 100644 --- a/etc/ncp-config.d/letsencrypt.sh +++ b/etc/ncp-config.d/letsencrypt.sh @@ -9,6 +9,7 @@ DOMAIN_=mycloud.ownyourbits.com EMAIL_=mycloud@ownyourbits.com +NOTIFYUSER_=ncp NCDIR=/var/www/nextcloud OCC="$NCDIR/occ" @@ -53,24 +54,43 @@ configure() { local DOMAIN_LOWERCASE="${DOMAIN_,,}" + # Configure Apache grep -q ServerName $VHOSTCFG && \ sed -i "s|ServerName .*|ServerName $DOMAIN_|" $VHOSTCFG || \ sed -i "/DocumentRoot/aServerName $DOMAIN_" $VHOSTCFG + # Do it letsencrypt certonly -n --no-self-upgrade --webroot -w $NCDIR --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ && { + + # Set up auto-renewal cat > /etc/cron.weekly/letsencrypt-ncp </dev/null & rm -rf $NCDIR/.well-known - # update configuration + # Update configuration [[ "$DOCKERBUILD" == 1 ]] && update-rc.d letsencrypt enable return 0 -- cgit v1.2.3