1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

Implement a new way to handle the Nextcloud fail2ban config.

If the user wants Nextcloud to be installed, the setup script will simply append the relevant rules to the config file.
This is more efficient than having two separate files.
This commit is contained in:
dkoao
2019-09-26 09:20:52 +00:00
parent d30c4d615d
commit 857ccaa06c
4 changed files with 18 additions and 89 deletions

View File

@@ -341,18 +341,17 @@ systemctl restart systemd-resolved
rm -f /etc/fail2ban/jail.local # we used to use this file but don't anymore
rm -f /etc/fail2ban/jail.d/defaults-debian.conf # removes default config so we can manage all of fail2ban rules in one config
if [ ${DISABLE_NEXTCLOUD} == "1"]; then
# Check if the user wants to enable Nextcloud, if the user wants it
# the relevant firejail configuration will be added
if [ ${DISABLE_NEXTCLOUD} != "1"]; then
cat conf/fail2ban/nextcloud-jail.conf >> conf/fail2ban/jails.conf
fi
cat conf/fail2ban/jails.conf \
| sed "s/PUBLIC_IP/$PUBLIC_IP/g" \
| sed "s#STORAGE_ROOT#$STORAGE_ROOT#" \
> /etc/fail2ban/jail.d/mailinabox.conf
cat conf/fail2ban/jails_no_nextcloud.conf \
| sed "s/PUBLIC_IP/$PUBLIC_IP/g" \
| sed "s#STORAGE_ROOT#$STORAGE_ROOT#" \
> /etc/fail2ban/jail.d/mailinabox.conf
else
cat conf/fail2ban/jails.conf \
| sed "s/PUBLIC_IP/$PUBLIC_IP/g" \
| sed "s#STORAGE_ROOT#$STORAGE_ROOT#" \
> /etc/fail2ban/jail.d/mailinabox.conf
fi
cp -f conf/fail2ban/filter.d/* /etc/fail2ban/filter.d/