Skip to content

Commit

Permalink
fail2ban: update logpath on nc-datadir or nc-restore
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Nov 8, 2017
1 parent 5f92810 commit 42cef25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions etc/nextcloudpi-config.d/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ configure()
# opcache dir
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR_/.opcache|" /etc/php/7.0/mods-available/opcache.ini

# update fail2ban logpath
sed -i "s|logpath =.*|logpath = $DATADIR_/nextcloud.log|" /etc/fail2ban/jail.conf

# datadir
sudo -u www-data php occ config:system:set datadirectory --value="$DATADIR_"
sudo -u www-data php occ maintenance:mode --off
Expand Down
9 changes: 9 additions & 0 deletions etc/nextcloudpi-config.d/nc-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ EOF
# Just in case we moved the opcache dir
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR/.opcache|" /etc/php/7.0/mods-available/opcache.ini

# update fail2ban logpath
sed -i "s|logpath =.*|logpath = $DATADIR/nextcloud.log|" /etc/fail2ban/jail.conf

sudo -u www-data php occ maintenance:mode --off

# INCLUDEDATA=no situation
Expand All @@ -98,6 +101,9 @@ EOF
# 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

# update fail2ban logpath
sed -i "s|logpath =.*|logpath = /var/www/nextcloud/data/nextcloud.log|" /etc/fail2ban/jail.conf

sudo -u www-data php occ maintenance:mode --off
sudo -u www-data php occ files:scan --all

Expand All @@ -111,6 +117,9 @@ EOF
systemctl start mysqld
" &>/dev/null &
fi

service fail2ban restart

rm -r "$TMPDIR"
}

Expand Down

0 comments on commit 42cef25

Please sign in to comment.