Was ist "gefunden" in der Fail2Ban-Protokolldatei?

5214
nmax

Ich habe mehrere Instanzen wie die folgende in /var/log/fail2ban.log:

2015-12-27 14:31:21,949 fail2ban.filter [1020]: INFO [sshd] Found ###.###.###.### 

(Dabei ersetzt # eine Vielzahl von IP-Adressen.)

Was genau bedeutet dieser Protokolleintrag? Was bedeutet insbesondere Found?

Ich habe hier und http://www.fail2ban.org nach einer Erklärung der Protokolldatei gesucht . Wenn ich eine offensichtliche Informationsquelle für diese Frage vermisst habe, entschuldige ich mich - bitte weisen Sie mich in die richtige Richtung.

Hier ist die Konfiguration für FailRegex in /etc/fail2ban/filter.d/sshd.config:

failregex = ^%(__prefix_line)s(?:error: PAM: )?[aA]uthentication (?:failure|error) for .* from <HOST>( via \S+)?\s*$ ^%(__prefix_line)s(?:error: PAM: )?User not known to the underlying authentication module for .* from <HOST>\s*$ ^%(__prefix_line)sFailed \S+ for .*? from <HOST>(?: port \d*)?(?: ssh\d*)?(: (ruser .*|(\S+ ID \S+ \(serial \d+\) CA )?\S+ %(__md5hex)s(,$ ^%(__prefix_line)sROOT LOGIN REFUSED.* FROM <HOST>\s*$ ^%(__prefix_line)s[iI](?:llegal|nvalid) user .* from <HOST>\s*$ ^%(__prefix_line)sUser .+ from <HOST> not allowed because not listed in AllowUsers\s*$ ^%(__prefix_line)sUser .+ from <HOST> not allowed because listed in DenyUsers\s*$ ^%(__prefix_line)sUser .+ from <HOST> not allowed because not in any group\s*$ ^%(__prefix_line)srefused connect from \S+ \(<HOST>\)\s*$ ^%(__prefix_line)sReceived disconnect from <HOST>: 3: \S+: Auth fail$ ^%(__prefix_line)sUser .+ from <HOST> not allowed because a group is listed in DenyGroups\s*$ ^%(__prefix_line)sUser .+ from <HOST> not allowed because none of user's groups are listed in AllowGroups\s*$ ^(?P<__prefix>%(__prefix_line)s)User .+ not allowed because account is locked<SKIPLINES>(?P=__prefix)(?:error: )?Received disconnect from$ ^(?P<__prefix>%(__prefix_line)s)Disconnecting: Too many authentication failures for .+? \[preauth\]<SKIPLINES>(?P=__prefix)(?:error: )?Co$ ^(?P<__prefix>%(__prefix_line)s)Connection from <HOST> port \d+(?: on \S+ port \d+)?<SKIPLINES>(?P=__prefix)Disconnecting: Too many authe$ ^%(__prefix_line)spam_unix\(sshd:auth\):\s+authentication failure;\s*logname=\S*\s*uid=\d*\s*euid=\d*\s*tty=\S*\s*ruser=\S*\s*rhost=<HOST$ 
14
Was ist Ihre FailRegex in filter.d / sshd.conf? http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters Frank Thomas vor 8 Jahren 0
(Fügte das FailRegex zum ursprünglichen Beitrag hinzu.) nmax vor 8 Jahren 0
Laut meinen Protokollen 10 bis 1 ist ssh die bevorzugte erste Wahl des Hackers. Es ist wahrscheinlich eine dieser Verbindungen, die sich mit Ihrem System verbinden. Ich habe über 10.000+ ip nur für ssh. cybernard vor 8 Jahren 0
Enthalten die anderen regulären Ausdrücke in der Datei filter.d / sshd.conf das Wort "Found"? Frank Thomas vor 8 Jahren 0
Merkwürdigerweise erscheint die Zeichenfolge 'Found' nicht in der Datei sshd.conf oder in einer Datei in / etc / fail2ban. @cybernard stimme ich definitiv zu; Das Problem ist, dass fail2ban bereits ssh-Versuche verbietet und kennwortbasierte ssh auf dem System deaktiviert ist (nur schlüsselbasierte ssh). nmax vor 8 Jahren 0
Die Meldung "xxx.xxx.xxx.xxx gefunden" bedeutet, dass der fail2ban-Filter eine Zeile gefunden hat, die mit failregex in der angegebenen Filter- / Jail-Protokolldatei übereinstimmt. minni vor 8 Jahren 0

1 Antwort auf die Frage

13
minni

The Found xxx.xxx.xxx.xxx message means, that the fail2ban filter found a line that matches failregex in the given filter/jail logfile.

For example if the log shows

2016-03-16 15:35:51,527 fail2ban.filter [1986]: INFO [sshd] Found 1.2.3.4 2016-03-16 15:35:51,817 fail2ban.filter [1986]: INFO [sshd] Found 1.2.3.4 2016-03-16 15:35:52,537 fail2ban.actions [1986]: NOTICE [sshd] Ban 1.2.3.4 

The two first Found mean, that IP address 1.2.3.4 was found 2 times in the given sshd log (e.g. /var/log/auth.log) and that the entry in the logfile matches failregexin the filter /etc/fail2ban/filter.d/sshd.conf

As I have configured to ban after 2 failed ssh-attemtps, the 3rd line shows, that IP 1.2.3.4 has been banned after those 2 found occurrences.

How I found out about this:

In the python sources of fail2ban (in Debian this is in /usr/lib/python3/dist-packages/fail2ban/) do this:

cd /usr/lib/python3/dist-packages/fail2ban/ grep -r "\[%s\] Found" * 

In the python file "server/filter.py" on line 937 you find the corresponding log function:

def processLineAndAdd(self, line, date=None): [..] logSys.info("[%s] Found %s" % (self.jail.name, ip)) [..]