Created attachment 857314 [details] /var/log/secure of log failures that were not banned Description of problem: I had a string of ssh "attacks" which, IMHO, should've been banned by fail2ban, but apparently there needs to be some additional failregex work in ssh.conf because this wasn't stopped. Version-Release number of selected component (if applicable): fail2ban-0.9-0.3.git1f1a561.fc20.noarch How reproducible: It's hard to say. I don't know which ssh script is testing me. However a bunch of failed attempts to login as root SHOULD have tickled fail2ban! Steps to Reproduce: 1. run fail2ban 2. wait for an ssh attack 3. see that fail2ban doesn't actually stop it Actual results: nothing. I got a bunch of log messages like: Jan 29 17:57:51 mail2 sshd[2204]: Failed password for root from 61.160.194.121 port 1647 ssh2 But nothing was banned: $ fail2ban-client status sshd Status for the jail: sshd |- filter | |- File list: /var/log/secure | |- Currently failed: 0 | `- Total failed: 0 `- action |- Currently banned: 0 | `- IP list: `- Total banned: 0 $ grep 61.160.194.121 /var/log/messages $ Expected results: fail2ban should actually ban on failures (and ban on the FIRST failure, if that's the desire). Additional info: See the attached "login failures" log, from /var/log/secure, showing all the login failures that fail2ban didn't catch. It LOOKS like this regex should catch it: ^%(__prefix_line)sFailed \S+ for .* from <HOST>(?: port \d*)?(?: ssh\d*)?\s*$ but it didn't.
The regex seems to work for me: # fail2ban-regex /data/sw/tmp/login-failures.txt /etc/fail2ban/filter.d/sshd.conf Running tests ============= Use failregex file : /etc/fail2ban/filter.d/sshd.conf Use maxlines : 10 Use log file : /data/sw/tmp/login-failures.txt Use encoding : UTF-8 Results ======= Failregex: 131 total |- #) [# of hits] regular expression | 3) [131] ^\s*(<[^.]+\.[^.]+>)?\s*(?:\S+ )?(?:kernel: \[\d+\.\d+\] )?(?:@vserver_\S+ )?(?:(?:\[\d+\])?:\s+[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?|[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?(?:\[\d+\])?:?)?\s(?:\[ID \d+ \S+\])?\s*Failed \S+ for .* from <HOST>(?: port \d*)?(?: ssh\d*)?\s*$ What backend are you using? Perhaps try running with debugging log level for a bit?
I'm using the firewallcmd-ipset banaction. I had more failures this morning, but then I restarted fail2ban manually and it started working. That doesn't make any sense to me (and does not instill confidence that a freshly-rebooted system isn't properly monitoring).
Yeah, that's why I asked what your "backend" (not action) setting is (auto, pyinotify, etc..). My guess at the moment is that it stops monitoring after the logs are rotated each week.
Oops, sorry, misread (or misunderstood) what you were asking. I don't think I changed the default. Looks like it is set to auto in jail.conf
Is this still a problem?
Had the same problem; fail2ban didn't monitor log file. Had backend = auto in jail.conf. After installing gamin, setting backend=gamin and reloading the service it started working. Working config: # cat /etc/fail2ban/jail.local [DEFAULT] bantime = 3600 ignoreip = <deleted> destemail = <deleted> sender = <deleted> banaction = iptables-multiport backend = gamin [sshd] enabled = true logpath = /var/log/secure
This message is a reminder that Fedora 20 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 20. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '20'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 20 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.