Skip to content

Commit

Permalink
enhancement: fix file perms and make sure the folder exists
Browse files Browse the repository at this point in the history
  • Loading branch information
OniriCorpe committed Nov 20, 2023
1 parent 2153128 commit fe1d189
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion helpers/fail2ban
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ ignoreregex =
ynh_add_config --template="f2b_jail.conf" --destination="/etc/fail2ban/jail.d/$app.conf"
ynh_add_config --template="f2b_filter.conf" --destination="/etc/fail2ban/filter.d/$app.conf"

# Create the logfile if it doesn't exist, as fail2ban require an existing file
# Create the folder and logfile if they doesn't exist,
# as fail2ban require an existing logfile before configuration
mkdir -p "/var/log/$app"
if [ ! -f "$logpath" ]; then
touch "$logpath"
chown -R "$app:$app" "$logpath"
chmod -R u=rwX,g=rX,o= "$logpath"
fi

ynh_systemd_action --service_name=fail2ban --action=reload --line_match="(Started|Reloaded) Fail2Ban Service" --log_path=systemd
Expand Down

0 comments on commit fe1d189

Please sign in to comment.