Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorszaimen <szaimen@e.mail.de>2020-10-29 02:12:41 +0300
committerGitHub <noreply@github.com>2020-10-29 02:12:41 +0300
commit9e57395cf356c1739ec02b3021cac07218c6583f (patch)
tree54921e5b64325d62db8bf297267bf25529f6d6e5 /apps/fail2ban.sh
parent9153e4945395535485723e3e00416257339e5931 (diff)
fix the fail2ban removal for bitwarden_rs (#1630)
Co-authored-by: Daniel Hansson <github@hanssonit.se>
Diffstat (limited to 'apps/fail2ban.sh')
-rw-r--r--apps/fail2ban.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/apps/fail2ban.sh b/apps/fail2ban.sh
index 42df9a9e..9fc11c69 100644
--- a/apps/fail2ban.sh
+++ b/apps/fail2ban.sh
@@ -27,7 +27,7 @@ debug_mode
root_check
# Check if fail2ban is already installed
-if ! is_this_installed fail2ban
+if ! [ -f /etc/fail2ban/filter.d/nextcloud.conf ] || ! is_this_installed fail2ban
then
# Ask for installing
install_popup "$SCRIPT_NAME"
@@ -35,10 +35,20 @@ else
# Ask for removal or reinstallation
reinstall_remove_menu "$SCRIPT_NAME"
# Removal
- print_text_in_color "$ICyan" "Unbanning all currently blocked IPs..."
- fail2ban-client unban --all
- check_command apt-get purge fail2ban -y
- rm -Rf /etc/fail2ban/
+ if ! does_this_docker_exist bitwarden_rs
+ then
+ print_text_in_color "$ICyan" "Unbanning all currently blocked IPs..."
+ fail2ban-client unban --all
+ apt purge fail2ban -y
+ rm -rf /etc/fail2ban
+ else
+ print_text_in_color "$ICyan" "Unbanning all currently blocked IPs..."
+ fail2ban-client unban --all
+ sleep 5
+ rm /etc/fail2ban/filter.d/nextcloud.conf
+ sed -i '/^\[sshd\]$/,$d' /etc/fail2ban/jail.local
+ check_command systemctl restart fail2ban
+ fi
# Show successful uninstall if applicable
removal_popup "$SCRIPT_NAME"
fi
@@ -60,7 +70,7 @@ do
nextcloud_occ config:system:set loglevel --value=2
break
fi
- elif [ "$(nextcloud_occ_no_check config:system:get logfile)" != "" ]
+ elif [ -n "$(nextcloud_occ_no_check config:system:get logfile)" ]
then
# Set logging
nextcloud_occ config:system:set log_type --value=file
@@ -97,7 +107,7 @@ FINDTIME_=1800
MAXRETRY_=20
apt update -q4 & spinner_loading
-check_command apt install fail2ban -y
+install_if_not fail2ban -y
check_command update-rc.d fail2ban disable
# Set timezone