Am 19.10.2023 um 18:52 schrieb Marcel Blenkers:
Hi Peter,
thanks for the reply.
Unfortunatly i forgot something
i changed the ip for datapeotection
the ip 192.168.10.10 <http://192.168.10.10> is actually the ip which
is accessing the webserver.
so it shows the correct ip, just not in my posting as i changed the ip
it is really the ip i need to block
greetings
Marcel
OK lets have look:
complete file:
# Fail2Ban filter to match web requests for selected URLs that don't
exist
#
[INCLUDES]
# Load regexes for filtering
before = botsearch-common.conf
[Definition]
failregex = ^.+?(?=: ) <HOST> \- \S+ \[\] \"(GET|POST|HEAD) \/<block>
\S+\" 404 .+$
ignoreregex =
# DEV Notes:
# Based on apache-botsearch filter
#
# Author: Frantisek Sumsal
I would use a copy of existing filter nginx-botsearch.conf as
nginx-botsearch.local
on my centos 8 stream:
# Fail2Ban filter to match web requests for selected URLs that don't exist
#
[INCLUDES]
# Load regexes for filtering
before = botsearch-common.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) \/<block> \S+\" 404 .+$
^ \[error\] \d+#\d+: \*\d+ (\S+ )?\"\S+\" (failed|is not
found) \(2\: No such file or directory\), client\: <HOST>\, server\:
\S*\, request: \"(GET|POST|HEAD) \/<block> \S+\"\, .*?$
ignoreregex =
datepattern = {^LN-BEG}%%ExY(?P<_sep>[-/.])%%m(?P=_sep)%%d[T
]%%H:%%M:%%S(?:[.,]%%f)?(?:\s*%%z)?
^[^\[]*\[({DATE})
{^LN-BEG}
journalmatch = _SYSTEMD_UNIT=nginx.service + _COMM=nginx
# DEV Notes:
# Based on apache-botsearch filter
#
# Author: Frantisek Sumsal
just seen: @web.de - 2hours difference to UTC
geändert auf:
failregex = ^<HOST> \- \S+ \[[^\]]*\] \"(GET|POST|HEAD) \/<block> \S+\"
40[34] .+$
Datepattern sollte in der 2. Zeile matchen
^[^\[]*\[({DATE})
^ - Zeilenstart
^[^\[] - alle Zeichen außer "["
* 0- bis beliebig viele davon
\[ - das Zeichen "[" ( ist vor dem 2. Datum / Zeit in UTC )
({DATE}) - das fängt dann Datum und Urzeit.
Zum failregex:
Bei dir \S+ \[\] \"(GET
erfordert [], ist bei dir aber [16/Oct/2023:13:49:02 +0000] ---> kein
match, nie
\[[^\]]*\]
ist
\[ "["
[^\]] - alle Zeichen, die nicht "]" sind
* 0 bis beliebig viele davon.
\] "]"
Es könnte sein, dass du ein Problem bekommst, weil das 2. Datum/Zeit in
UTC ist, das Log selbst aber in MESZ.
IIRC wird +0000 aber beachtet, so dass die Chancen gut sind. Prüfe aber
bitte im log, ob die Zeit korrekt erkannt wird.
40[34] erfasst die Fehler 403 und 404 Ich hatte dein (403|404) so
verstanden, dass das gewünscht ist.
Willst du nur 404 bleibt, es bei 404
Grüße aus Berlin
_______________________________________________
Fail2ban-users mailing list
Fail2ban-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fail2ban-users