diff --git a/scripts/install b/scripts/install index 50cdff4..29cdd7a 100755 --- a/scripts/install +++ b/scripts/install @@ -55,10 +55,11 @@ ynh_use_logrotate ynh_script_progression --message="Upgrading fail2ban configuration..." # Create the logfile, required before configuring fail2ban -touch "/var/log/nginx/${domain}-access.log" +log4fail2ban="/var/log/nginx/${domain}-access.log" +touch "${log4fail2ban}" # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/${domain}-access.log" --failregex=" .* \"GET /api/.*\" 401" --max_retry=5 +ynh_add_fail2ban_config --logpath="${log4fail2ban}" --failregex=" .* \"GET /api/.*\" 401" --max_retry=5 #================================================= # SPECIFIC SETUP diff --git a/scripts/upgrade b/scripts/upgrade index 3bdf001..c96c558 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -106,12 +106,13 @@ ynh_use_logrotate --non-append ynh_script_progression --message="Upgrading fail2ban configuration..." # If it doesn't exist, create the logfile, required before configuring fail2ban -if [ ! -f "/var/log/nginx/${domain}-access.log" ]; then - touch "/var/log/nginx/${domain}-access.log" +log4fail2ban="/var/log/nginx/${domain}-access.log" +if [ ! -f "${log4fail2ban}" ]; then + touch "${log4fail2ban}" fi # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-access.log" --failregex=" .* \"GET /api/.*\" 401" --max_retry=5 +ynh_add_fail2ban_config --logpath="${log4fail2ban}" --failregex=" .* \"GET /api/.*\" 401" --max_retry=5 #================================================= # SPECIFIC UPGRADE