fail2ban failregex: udp: bad checksum
fail2ban failregex: udp: bad checksum
Hallo,
ich muss fail2ban so konfigurieren, dass es "UDP: Bad checksum" bannt.
Das hatte ich bei meiner Suche gefunden, jedoch kommt ein Error im failregex beim Neustart von fail2ban.
http://blog.colundrum.com/post/59096659 ... d-checksum
Kann mir jemand den Fehler aufzeigen?
ich muss fail2ban so konfigurieren, dass es "UDP: Bad checksum" bannt.
Das hatte ich bei meiner Suche gefunden, jedoch kommt ein Error im failregex beim Neustart von fail2ban.
http://blog.colundrum.com/post/59096659 ... d-checksum
Kann mir jemand den Fehler aufzeigen?
Re: fail2ban failregex: udp: bad checksum
Nein. Woher soll ich wissen, was deine Fehlermeldung ist? Siehe auch [1,2]. Die Anleitung selbst scheint soweit okay zu sein, abgesehen davon, dass sie auf franzoesisch und somit nicht international lesbar ist.serecords hat geschrieben:Kann mir jemand den Fehler aufzeigen?
Gruss Cae
[1] https://wiki.debianforum.de/Benutzer:Cae#Grund_eins
[2] https://wiki.debianforum.de/Benutzer:Cae#Grund_vier
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.
—Bruce Schneier
Re: fail2ban failregex: udp: bad checksum
Sorry, da hatte ich mich ungünstig ausgedrückt und kein Log angehängt.
Code: Alles auswählen
fail2ban.filter : ERROR Unable to compile regular expression 'UDP: bad checksum. From (?:::f{4,6}:)?(?P(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)[\w-.^_]+)'
Re: fail2ban failregex: udp: bad checksum
Klassisch wuerde man da die RegEx so lange kuerzen, bis sie sich kompilieren laesst und das mit fail2ban-regex testen:Ich kann den Fehler nachvollziehen, verstehe aber nicht wirklich, auf was die RegEx matchen soll. [Edit: da war ein Typo drin, deshalb hat das keinen Sinn ergeben. So funktioniert es. Kannst du mal ein paar passende Zeilen aus dem kern.log posten (IP-Adressen bitte in der Form a.b.c.d zensieren)?] [Edit#2: Der Typo ist auch in der Vorlage drin, daher der Fehler. Es soll hinten \- anstatt - heissen (man haette auch einfach das - an den "Rand" von [] packen koennen und damit das Problem vermeiden koennen...) :Der Teil ist ohnehin als <HOST> (in Grossbuchstaben) als Alias verfuegbar, daher geht auch die Kurzform]
Gruss Cae
Code: Alles auswählen
# fail2ban-regex /var/log/kern.log /etc/fail2ban/filter.d/udp-checksum.conf
Code: Alles auswählen
(?P<host>[\w-.^_]+)
(?P<host>[\w\-.^_]+)
Code: Alles auswählen
[Definition]
failregex = UDP: bad checksum. From <HOST>
#failregex = UDP: bad checksum. From (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
ignoreregex =
Gruss Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.
—Bruce Schneier
Re: AW: fail2ban failregex: udp: bad checksum
Also matchen soll es das hier:
Code: Alles auswählen
Jul 10 20:40:43 server kernel: [ 92.642850] UDP: bad checksum. From a.b.c.d:19 to a.b.c.d:5223 ulen 6927
Jul 10 20:40:43 server kernel: [ 92.745146] UDP: bad checksum. From a.b.c.d:19 to a.b.c.d:5223 ulen 1505
Jul 10 20:40:43 server kernel: [ 92.831096] UDP: bad checksum. From a.b.c.d:19 to a.b.c.d:5223 ulen 1571
Jul 10 20:40:43 server kernel: [ 92.915855] UDP: bad checksum. From a.b.c.d:19 to a.b.c.d:5223 ulen 1626
Re: fail2ban failregex: udp: bad checksum
Ich hab' zwischenzeitlich oben drin rumeditiert und war zu dem Schluss gekommen, dass da ein Typo in der Vorlage ist (die vielleicht demnaechst korrigiert wird, wenn der Mensch auf meine Mail reagiert...). Wenn du das - in der RegEx zu \- korrigierst, sollte es matchen.
Gruss Cae
Gruss Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.
—Bruce Schneier
Re: fail2ban failregex: udp: bad checksum
Also die Datei sieht jetzt so aus:
Ich hab den regex Test gemacht und das Ergebnis sind 0 results:
Code: Alles auswählen
# Fail2Ban configuration file
#
# Author: Florent CARRÉ aka COLUNDRUM <colundrum@gmail.com>
#
# $Revision$
#
[Definition]
# Option: failregex
# Notes.: regex to match the UDP: bad checksum messages in the logfile. The
# host must be matched by a group named “host”. The tag “<HOST>”
# fails on test.
# Values: TEXT
#
failregex = UDP: bad checksum. From (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Code: Alles auswählen
~# fail2ban-regex /var/log/kern.log /etc/fail2ban/filter.d/udp-checksum.conf
Running tests
=============
Use regex line : /etc/fail2ban/filter.d/udp-checksum.conf
Use log file : /var/log/kern.log
No 'host' group in '/etc/fail2ban/filter.d/udp-checksum.conf'
Cannot remove regular expression. Index 0 is not valid
Results
=======
Failregex
|- Regular expressions:
| [1] /etc/fail2ban/filter.d/udp-checksum.conf
|
`- Number of matches:
[1] 0 match(es)
Ignoreregex
|- Regular expressions:
|
`- Number of matches:
Summary
=======
Sorry, no match
Look at the above section 'Running tests' which could contain important
information.
Re: fail2ban failregex: udp: bad checksum
Also ich wollte damit sagen, dass es 0 matches gibt, obwohl die kern.log voll mit diesen Meldungen ist.
Also muss es doch noch irgendwo einen Fehler geben?
Also muss es doch noch irgendwo einen Fehler geben?
Re: fail2ban failregex: udp: bad checksum
Hallo,
für alle die es vielleicht gebrauchen können, ich habe verschiedene Konfigurationen ausprobiert, so wie unten ist die beste Methode und der ban ist auch wirksam, dieses action = route Methode funktioniert bei mir nicht und es wird auch nichts gebannt...
System:
Debian Jessie 8.1
Fail2Ban v0.8.13
/etc/fail2ban/jail.conf
/etc/fail2ban/filter.d/udp-badchecksum.conf
/etc/fail2ban/jail.conf
/etc/fail2ban/filter.d/ddos.conf
für alle die es vielleicht gebrauchen können, ich habe verschiedene Konfigurationen ausprobiert, so wie unten ist die beste Methode und der ban ist auch wirksam, dieses action = route Methode funktioniert bei mir nicht und es wird auch nichts gebannt...
System:
Debian Jessie 8.1
Fail2Ban v0.8.13
/etc/fail2ban/jail.conf
Code: Alles auswählen
[udp-badchecksum]
enabled = true
port = all
banaction = iptables-allports
port = anyport
filter = udp-badchecksum
protocol = udp
logpath = /var/log/kern.log
maxretry = 2
Code: Alles auswählen
# Fail2Ban configuration file
#
#
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf
[Definition]
# Option: failregex
# Notes.: regex to match the UDP: bad checksum messages in the logfile. The
# host must be matched by a group named “host”. The tag “<HOST>”
# fails on test.
# Values: TEXT
#
failregex = UDP: bad checksum. From <HOST>
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Code: Alles auswählen
[ddos]
enabled = true
port = all
banaction = iptables-allports
port = anyport
protocol = udp
filter = ddos
logpath = /var/log/kern.log
maxretry = 2
Code: Alles auswählen
# Fail2Ban configuration file
#
#
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf
[Definition]
# Option: failregex
# Notes.: Auto block short UDP.
# Values: TEXT
#
failregex = UDP: short packet: From <HOST>
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =