letsencrypt: sync ncp and nc cert paths

Signed-off-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
nachoparker 2021-10-27 15:18:41 -06:00
parent 41368fedfc
commit 532a6a8bb6
2 changed files with 10 additions and 5 deletions

View File

@ -10,7 +10,7 @@
ncdir=/var/www/nextcloud
nc_vhostcfg=/etc/apache2/sites-available/nextcloud.conf
vhostcfg2=/etc/apache2/sites-available/ncp.conf
ncp_vhostcfg=/etc/apache2/sites-available/ncp.conf
letsencrypt=/usr/bin/letsencrypt
is_active()
@ -58,8 +58,10 @@ configure()
rm -f /etc/letsencrypt/renewal-hooks/deploy/ncp
[[ "$DOCKERBUILD" == 1 ]] && update-rc.d letsencrypt disable
install_template nextcloud.conf.sh "${nc_vhostcfg}"
sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem|" "${vhostcfg2}"
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key|" "${vhostcfg2}"
local cert_path="$(grep SSLCertificateFile "${nc_vhostcfg}" | awk '{ print $2 }')"
local key_path="$(grep SSLCertificateKeyFile "${nc_vhostcfg}" | awk '{ print $2 }')"
sed -i "s|SSLCertificateFile.*|SSLCertificateFile ${cert_path}|" "${ncp_vhostcfg}"
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile ${key_path}|" "${ncp_vhostcfg}"
apachectl -k graceful
echo "letsencrypt certificates disabled. Using self-signed certificates instead."
exit 0
@ -113,8 +115,10 @@ EOF
# Configure Apache
install_template nextcloud.conf.sh "${nc_vhostcfg}"
sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/fullchain.pem|" "${vhostcfg2}"
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/privkey.pem|" "${vhostcfg2}"
local cert_path="$(grep SSLCertificateFile "${nc_vhostcfg}" | awk '{ print $2 }')"
local key_path="$(grep SSLCertificateKeyFile "${nc_vhostcfg}" | awk '{ print $2 }')"
sed -i "s|SSLCertificateFile.*|SSLCertificateFile ${cert_path}|" "${ncp_vhostcfg}"
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile ${key_path}|" "${ncp_vhostcfg}"
# Configure Nextcloud
local domain_index="${TRUSTED_DOMAINS[letsencrypt_1]}"

View File

@ -67,6 +67,7 @@ fi
LETSENCRYPT_CERT_PATH="${LETSENCRYPT_CERT_BASE_PATH}/fullchain.pem"
LETSENCRYPT_KEY_PATH="${LETSENCRYPT_CERT_BASE_PATH}/privkey.pem"
}
cat <<EOF
CustomLog /var/log/apache2/nc-access.log combined
ErrorLog /var/log/apache2/nc-error.log