From 71b270ab186ca96782877db03a13c2a94d184508 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 12 May 2019 17:22:25 +0200 Subject: [PATCH] Normalization... --- scripts/backup | 5 +++-- scripts/install | 2 ++ scripts/remove | 1 + scripts/restore | 7 ++++--- scripts/upgrade | 2 ++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/backup b/scripts/backup index 36a90b8..bb1439a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -52,9 +52,10 @@ ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= +ynh_script_progression --message="Backing up fail2ban configuration..." -ynh_backup "/etc/fail2ban/jail.d/$app.conf" -ynh_backup "/etc/fail2ban/filter.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 5262e1a..ef4f3e7 100755 --- a/scripts/install +++ b/scripts/install @@ -161,6 +161,7 @@ ynh_store_file_checksum "$final_path/conf/local.protected.php" #================================================= # INSTALL LOGAUTHERROR PLUGIN FOR FAIL2BAN #================================================= +ynh_script_progression --message="Installing logautherror plugin for fail2ban..." --weight=2 ynh_setup_source --dest_dir="$final_path/lib/plugins/logautherror" --source_id=logautherror @@ -210,6 +211,7 @@ find $final_path/lib -type d -print0 | xargs -0 chmod 0755 #================================================= # SETUP FAIL2BAN #================================================= +ynh_script_progression --message="Configuring fail2ban..." --weight=7 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex="^.*authentication failure. while reading response header from upstream, client: ,.*POST $path_url.*$" --max_retry=5 diff --git a/scripts/remove b/scripts/remove index f1d9798..5797d12 100755 --- a/scripts/remove +++ b/scripts/remove @@ -48,6 +48,7 @@ ynh_remove_fpm_config #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= +ynh_script_progression --message="Removing fail2ban configuration..." --weight=7 ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index ac6fec6..2e7c1cd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -94,10 +94,11 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=7 -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" -systemctl restart fail2ban +ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" +ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 5fc992e..1f07a9c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -242,6 +242,7 @@ ynh_store_file_checksum "$final_path/conf/local.protected.php" #================================================= # INSTALL LOGAUTHERROR PLUGIN FOR FAIL2BAN #================================================= +ynh_script_progression --message="Upgrading logautherror plugin for fail2ban..." --weight=2 ynh_setup_source --dest_dir="$final_path/lib/plugins/logautherror" --source_id=logautherror @@ -291,6 +292,7 @@ find $final_path/lib -type d -print0 | xargs -0 chmod 0755 #================================================= # SETUP FAIL2BAN #================================================= +ynh_script_progression --message="Reconfiguring fail2ban..." --weight=7 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex="^.*authentication failure. while reading response header from upstream, client: ,.*POST $path_url.*$" --max_retry=5