mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
scripts: Reduce fail2ban log path duplication
This commit is contained in:
parent
c0338b0428
commit
546eddc15d
2 changed files with 7 additions and 5 deletions
|
@ -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="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
|
||||
ynh_add_fail2ban_config --logpath="${log4fail2ban}" --failregex="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
|
|
@ -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="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
|
||||
ynh_add_fail2ban_config --logpath="${log4fail2ban}" --failregex="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
|
Loading…
Add table
Reference in a new issue