helpers/fail2ban: grep logpath is likely to match comments in the file that contain the word logpath...

This commit is contained in:
Alexandre Aubin 2023-11-28 13:14:29 +01:00
parent 4897f72974
commit 267968074b

View file

@ -104,7 +104,7 @@ ignoreregex =
# "$logpath" using the one in the previously generated fail2ban conf file # "$logpath" using the one in the previously generated fail2ban conf file
if [ -z "${logpath:-}" ]; then if [ -z "${logpath:-}" ]; then
# the first sed deletes possibles spaces and the second one extract the path # the first sed deletes possibles spaces and the second one extract the path
logpath=$(grep logpath "/etc/fail2ban/jail.d/$app.conf" | sed "s/ //g" | sed "s/logpath=//g") logpath=$(grep "^logpath" "/etc/fail2ban/jail.d/$app.conf" | sed "s/ //g" | sed "s/logpath=//g")
fi fi
# Create the folder and logfile if they doesn't exist, # Create the folder and logfile if they doesn't exist,