From 52051bb427240436946ceb9385f4f989db25ab21 Mon Sep 17 00:00:00 2001 From: nacho Date: Mon, 31 Jul 2017 14:48:10 +0200 Subject: [PATCH] simplify parameters --- etc/nextcloudpi-config.d/letsencrypt.sh | 5 +++-- etc/nextcloudpi-config.d/modsecurity.sh | 4 ++-- etc/nextcloudpi-config.d/nc-restore.sh | 18 +++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/etc/nextcloudpi-config.d/letsencrypt.sh b/etc/nextcloudpi-config.d/letsencrypt.sh index a35f617cf..534544540 100644 --- a/etc/nextcloudpi-config.d/letsencrypt.sh +++ b/etc/nextcloudpi-config.d/letsencrypt.sh @@ -16,7 +16,8 @@ DOMAIN_=mycloud.ownyourbits.com EMAIL_=mycloud@ownyourbits.com -NCDIR_=/var/www/nextcloud + +NCDIR=/var/www/nextcloud VHOSTCFG=/etc/apache2/sites-available/nextcloud.conf VHOSTCFG2=/etc/apache2/sites-available/ncp.conf DESCRIPTION="Automatic signed SSL certificates" @@ -53,7 +54,7 @@ configure() sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_/fullchain.pem|" $VHOSTCFG2 sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_/privkey.pem|" $VHOSTCFG2 - /etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR_ --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1 + /etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1 echo "* 1 * * 1 root /etc/letsencrypt/certbot-auto renew --quiet" > /etc/cron.d/letsencrypt-ncp cd /var/www/nextcloud diff --git a/etc/nextcloudpi-config.d/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh index 14d091cf3..699c19fa9 100644 --- a/etc/nextcloudpi-config.d/modsecurity.sh +++ b/etc/nextcloudpi-config.d/modsecurity.sh @@ -16,7 +16,7 @@ # ACTIVE_=no -NCDIR_=/var/www/nextcloud/ +NCDIR=/var/www/nextcloud/ DESCRIPTION="Web Application Firewall for extra security (experimental)" install() @@ -77,7 +77,7 @@ a basic NextCloud installation. If a new App does not work disable it" \ configure() { cat > /etc/modsecurity/modsecurity_crs_99_whitelist.conf < + # VIDEOS SecRuleRemoveById 958291 # Range Header Checks SecRuleRemoveById 981203 # Correlated Attack Attempt diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index 2c8e6cfe6..4d79810da 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -18,7 +18,7 @@ BACKUPFILE_=/media/USBdrive/nextcloud-bkp_xxxxxxxx.tar -BASEDIR_=/var/www +BASEDIR=/var/www DBADMIN=ncadmin DESCRIPTION="Restore a previously backuped NC instance" @@ -39,9 +39,9 @@ You can use nc-backup " \ configure() { - [ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; } - [ -d $BASEDIR_ ] || { echo -e "$BASEDIR_ not found"; return 1; } - [ -d $BASEDIR_/nextcloud ] && { echo -e "WARNING: overwriting old instance"; } + [ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; } + [ -d $BASEDIR ] || { echo -e "$BASEDIR not found"; return 1; } + [ -d $BASEDIR/nextcloud ] && { echo -e "WARNING: overwriting old instance"; } local TMPDIR="$( dirname $BACKUPFILE_ )/$( basename ${BACKUPFILE_}-tmp )" rm -rf "$TMPDIR" && mkdir -p "$TMPDIR" @@ -50,8 +50,8 @@ configure() ## RESTORE FILES echo -e "restore files..." - rm -rf $BASEDIR_/nextcloud - mv "$TMPDIR"/nextcloud $BASEDIR_ + rm -rf $BASEDIR/nextcloud + mv "$TMPDIR"/nextcloud $BASEDIR ## RE-CREATE DATABASE TABLE @@ -72,12 +72,12 @@ EOF ## RESTORE DATADIR - cd $BASEDIR_/nextcloud + cd $BASEDIR/nextcloud # INCLUDEDATA=yes situation if [[ $( ls "$TMPDIR" | wc -l ) == 2 ]]; then - local DATADIR=$( grep datadirectory $BASEDIR_/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 ) + local DATADIR=$( grep datadirectory $BASEDIR/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 ) [[ "$DATADIR" == "" ]] && { echo -e "Error reading data directory"; return 1; } echo -e "restore datadir to $DATADIR..." rm -rf "$DATADIR" @@ -107,7 +107,7 @@ EOF rm -r "$TMPDIR" # Just in case we moved the opcache dir - sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR_/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini + sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini } install() { :; }