various fixes (#356)

This commit is contained in:
Daniel Hansson 2017-08-31 07:24:08 +02:00 committed by GitHub
parent 1a14a807b1
commit 417ded1093
5 changed files with 15 additions and 23 deletions

View File

@ -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" ]

View File

@ -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"

View File

@ -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" ]

View File

@ -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

7
lib.sh
View File

@ -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/