From 8b043e08a7ea9d774b9f00358bd8b70cc9ddae5e Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 8 Mar 2018 19:08:15 +0100 Subject: [PATCH] Fix stretch --- scripts/_common.sh | 32 +++++++++++++++++++------------- scripts/restore | 4 ++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 49a8a60..2eed000 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -24,41 +24,47 @@ ynh_add_fail2ban_config () { test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing." - finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" - finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1 - ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1 + finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" + finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" + ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1 + ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1 - cat > $finalfail2banjailconf < $finalfail2banfilterconf <&2 + echo "WARNING${fail2ban_error#*WARNING}" >&2 + fi } # Remove the dedicated fail2ban config (jail and filter conf files) # # usage: ynh_remove_fail2ban_config ynh_remove_fail2ban_config () { - ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf" + ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf" ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf" - systemctl restart fail2ban + sudo systemctl restart fail2ban } # Delete a file checksum from the app settings diff --git a/scripts/restore b/scripts/restore index d6f1dc9..fb0a658 100644 --- a/scripts/restore +++ b/scripts/restore @@ -89,6 +89,10 @@ chown -R $app: /home/yunohost.app/${app} #================================================= ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" + +touch "/var/log/${app}FailedLogins.log" +chown $app: "/var/log/${app}FailedLogins.log" + systemctl restart fail2ban #=================================================