diff --git a/apps/collabora.sh b/apps/collabora.sh index dee3cde5..20d31b10 100644 --- a/apps/collabora.sh +++ b/apps/collabora.sh @@ -261,12 +261,8 @@ fi # Install certbot (Let's Encrypt) install_certbot -# Stop Apache to aviod port conflicts -a2dissite 000-default.conf -sudo service apache2 stop - # Generate certs -if letsencrypt certonly --standalone --agree-tos --rsa-key-size 4096 -d "$SUBDOMAIN" +if le_subdomain then # Generate DHparams chifer if [ ! -f "$DHPARAMS" ] diff --git a/apps/fail2ban.sh b/apps/fail2ban.sh index 7c7bd14d..3650aebe 100644 --- a/apps/fail2ban.sh +++ b/apps/fail2ban.sh @@ -24,7 +24,7 @@ fi ### Local variables ### # location of Nextcloud logs -NCLOG="$(grep "logfile" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")" +NCLOG="$(find / -name nextcloud.log)" # time to ban an IP that exceeded attempts BANTIME_=600000 # cooldown time for incorrect passwords @@ -40,8 +40,8 @@ check_command update-rc.d fail2ban disable if [ -z "$NCLOG" ] then - echo "Logfile not found." - echo "Please add it to $NCPATH/config/config.php and run this script again." + echo "nextcloud.log not found" + echo "Please add your logpath to $NCPATH/config/config.php and restart this script." exit 1 else chown www-data:www-data "$NCLOG" diff --git a/apps/onlyoffice.sh b/apps/onlyoffice.sh index 98b8d002..a85eb0d5 100644 --- a/apps/onlyoffice.sh +++ b/apps/onlyoffice.sh @@ -251,12 +251,8 @@ fi # Install certbot (Let's Encrypt) install_certbot -# Stop Apache to aviod port conflicts -a2dissite 000-default.conf -sudo service apache2 stop - # Generate certs -if letsencrypt certonly --standalone --agree-tos --rsa-key-size 4096 -d "$SUBDOMAIN" +if le_subdomain then # Generate DHparams chifer if [ ! -f "$DHPARAMS" ] diff --git a/lets-encrypt/activate-ssl.sh b/lets-encrypt/activate-ssl.sh index 7b5c72de..c33b1843 100644 --- a/lets-encrypt/activate-ssl.sh +++ b/lets-encrypt/activate-ssl.sh @@ -212,23 +212,16 @@ fi default_le="--rsa-key-size 4096 --renew-by-default --agree-tos -d $domain" standalone() { -# Stop Apache to avoid port conflicts -a2dissite 000-default.conf -sudo service apache2 stop # Generate certs -if eval "letsencrypt certonly --standalone $default_le" +if eval "certbot certonly --standalone --pre-hook 'service apache2 stop' --post-hook 'service apache2 start' $default_le" then echo "success" > /tmp/le_test else echo "fail" > /tmp/le_test fi -# Activate Apache again (Disabled during standalone) -service apache2 start -a2ensite 000-default.conf -service apache2 reload } webroot() { -if eval "letsencrypt certonly --webroot --webroot-path $NCPATH $default_le" +if eval "certot certonly --webroot --webroot-path $NCPATH $default_le" then echo "success" > /tmp/le_test else @@ -236,7 +229,7 @@ else fi } certonly() { -if eval "letsencrypt certonly $default_le" +if eval "certbot certonly $default_le" then echo "success" > /tmp/le_test else diff --git a/lib.sh b/lib.sh index 0841f402..6b88b730 100644 --- a/lib.sh +++ b/lib.sh @@ -207,6 +207,13 @@ else fi } +# Let's Encrypt for subdomains +le_subdomain() { +a2dissite 000-default.conf +service apache2 reload +certbot certonly --standalone --pre-hook "service apache2 stop" --post-hook "service apache2 start" --agree-tos --rsa-key-size 4096 -d "$SUBDOMAIN" +} + configure_max_upload() { # Increase max filesize (expects that changes are made in /etc/php/7.0/apache2/php.ini) # Here is a guide: https://www.techandme.se/increase-max-file-size/