diff options
author | szaimen <szaimen@e.mail.de> | 2020-08-11 10:47:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 10:47:19 +0300 |
commit | aef73c1cd4a1dae0d328a620d6bd859272679353 (patch) | |
tree | cb830232d4975163acbb5ec444ea1a3481247c7f /apps/fail2ban.sh | |
parent | 8ef86cc445840d54feba9574cf6144c9ea3ba940 (diff) |
Update fail2ban (#1353)
Diffstat (limited to 'apps/fail2ban.sh')
-rw-r--r-- | apps/fail2ban.sh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/fail2ban.sh b/apps/fail2ban.sh index 1ee47762..047f42f7 100644 --- a/apps/fail2ban.sh +++ b/apps/fail2ban.sh @@ -61,23 +61,25 @@ mkdir -p "$VMLOGS" print_text_in_color "$ICyan" "Finding nextcloud.log..." while : do - NCLOG=$(find / -type f -name "nextcloud.log" 2> /dev/null) - if [ "$NCLOG" != "$VMLOGS/nextcloud.log" ] + if [ "$(occ_command_no_check config:system:get logfile)" = "$VMLOGS/nextcloud.log" ] + then + break + elif [ "$(occ_command_no_check config:system:get logfile)" != "" ] then - # Might enter here if no OR multiple logs already exist, tidy up any existing logs and set the correct path - print_text_in_color "$ICyan" "Unexpected or non-existent logging configuration - deleting any discovered nextcloud.log files and creating a new one at $VMLOGS/nextcloud.log..." - xargs rm -f <<< "$NCLOG" # Set logging occ_command config:system:set log_type --value=file occ_command config:system:set logfile --value="$VMLOGS/nextcloud.log" occ_command config:system:set loglevel --value=2 touch "$VMLOGS/nextcloud.log" chown www-data:www-data "$VMLOGS/nextcloud.log" + break else - if [ "$(occ_command config:system:get logfile)" = "$VMLOGS/nextcloud.log" ] + NCLOG=$(find / -type f -name "nextcloud.log" 2> /dev/null) + if [ "$NCLOG" != "$VMLOGS/nextcloud.log" ] then - break - else + # Might enter here if no OR multiple logs already exist, tidy up any existing logs and set the correct path + print_text_in_color "$ICyan" "Unexpected or non-existent logging configuration - deleting any discovered nextcloud.log files and creating a new one at $VMLOGS/nextcloud.log..." + xargs rm -f <<< "$NCLOG" # Set logging occ_command config:system:set log_type --value=file occ_command config:system:set logfile --value="$VMLOGS/nextcloud.log" @@ -88,6 +90,8 @@ do fi fi done +# remove ncdata, else it will be used +rm -f $NCDATA/nextcloud.log # time to ban an IP that exceeded attempts BANTIME_=1209600 # cooldown time for incorrect passwords |