Commit Graph

1512 Commits (d5291517a70f3048abed757ec81c70f8fac2c1d6)

Author SHA1 Message Date
Steven Hiscocks 1116f23151 TST: Sample log regex test now warns if no log for a filter
Also checks that at least some tests are present
2013-07-14 18:19:16 +01:00
Yaroslav Halchenko 6ee2323fa1 Merge pull request #285 from kwirk/python3-config-unicode
BF+DOC: All fail2ban config files are UTF-8 decoded for python3
2013-07-14 07:31:57 -07:00
Yaroslav Halchenko e562515df7 Merge pull request #292 from grooverdan/solaris-doc
DOC: shorten example and provide clarification and spelling fix
2013-07-14 07:13:20 -07:00
Steven Hiscocks 728399c39e Merge pull request #281 from kwirk/dovecot-filter
ENH: dovecot filter additions for session, time value and blank user
2013-07-14 05:18:04 -07:00
Daniel Black 6e4b144164 DOC: fix for README.Solaris. Thanks Steven. 2013-07-14 21:43:14 +10:00
Steven Hiscocks 94376bfbe1 TST: Handle lack of `json` library in python2.5 for samples test case 2013-07-14 11:15:45 +01:00
Daniel Black ab10664b57 ENH: action.d/hostsdeny to take daemon_list arguement as suggested in README.Solaris 2013-07-14 16:20:21 +10:00
Daniel Black 09850d6ba5 DOC: shorten example and provide clarifcation and spelling fixes 2013-07-14 10:25:06 +10:00
Steven Hiscocks 40f67c64b8 TST: Test sample logs' entries are matched by filter regexs 2013-07-13 23:03:01 +01:00
Steven Hiscocks 606e97683b BF: jail.conf multiport actions previously using single port iptables 2013-07-12 23:34:04 +01:00
Steven Hiscocks acf9e51d98 BF+DOC: All fail2ban config files are UTF-8 decoded for python3 2013-07-10 22:18:53 +01:00
Daniel Black e433a5c633 Merge pull request #260 from grooverdan/develop
DOC: developing filters without DoS + close/fix/resolves messages in commits
2013-07-08 15:52:26 -07:00
Daniel Black 424da92601 DOC: close message for commits. 2013-07-09 08:51:11 +10:00
Daniel Black 1d6d5a7aae DOC: ChangeLog merge confict 2013-07-09 08:41:28 +10:00
Daniel Black 174e3dba6d DOC: Note on new dependency - ed for hosts_deny 2013-07-09 08:36:53 +10:00
Daniel Black 5412d7336f DOC: ChangeLog confict 2013-07-09 08:23:44 +10:00
Daniel Black 1f5097649c DOC: ChangeLog for exim-spam.conf filter and tabs->spaces in changelog 2013-07-09 08:20:13 +10:00
Yaroslav Halchenko 5f04b4954f Merge pull request #280 from yarikoptic/master
BF+ENHs: polling backend tracks ino and size now in addition to mtime, filters do not read file unless it has content + few other minor issues
2013-07-07 08:33:55 -07:00
Daniel Black 619603fe05 BF: match asterisk InvalidPassword correctly 2013-07-07 17:48:20 +10:00
Steven Hiscocks 25f06f779d TST: Execute action timeout test almost equal assertion more forgiving 2013-07-05 18:56:47 +01:00
Steven Hiscocks 3dbe2c04ca BF: fail2ban now don't print maxlines twice when using ignoreregex
Also read failregex first, as more natural place to get maxlines value
from.
2013-07-05 18:47:08 +01:00
Steven Hiscocks bfa2b9dec3 ENH: dovecot filter additions for session, time value and blank user 2013-07-05 18:36:02 +01:00
Yaroslav Halchenko 04b8069cee ENH: adjust sendmail-whois 'active' example to have also sendername in it 2013-07-05 10:12:29 -04:00
Yaroslav Halchenko e332efb7cd Merge pull request #279 from 7adietri/feature/configurable-sender-name
Move sendmail settings to common file, make sender name configurable
2013-07-05 07:09:20 -07:00
Alexander Dietrich 2155f6bfa5 Update ChangeLog and jail.conf example 2013-07-04 08:57:52 +02:00
Yaroslav Halchenko e282d6b1c7 ENH: Remove unused any longer _ctime helper 2013-07-03 00:09:39 -04:00
Yaroslav Halchenko 404574499d BF: fail2ban-testcases -- use full "warning" instead of warn for the verbosity dictionary 2013-07-02 23:52:37 -04:00
Yaroslav Halchenko 5df6796e69 ENH: DNS resolution -- catch parent exception
IMHO there is no good reason to capture only gaierror.

on my network it was consistent to error out with

======================================================================
ERROR: testIgnoreIPNOK (testcases.filtertestcase.IgnoreIP)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/deb/gits/fail2ban/testcases/filtertestcase.py", line 166, in testIgnoreIPNOK
    self.assertFalse(self.filter.inIgnoreIPList(ip))
  File "/home/yoh/deb/gits/fail2ban/server/filter.py", line 277, in inIgnoreIPList
    ips = DNSUtils.dnsToIp(i)
  File "/home/yoh/deb/gits/fail2ban/server/filter.py", line 625, in dnsToIp
    return socket.gethostbyname_ex(dns)[2]
error: [Errno 11] Resource temporarily unavailable

with this commit tests would pass normally as they should
2013-07-02 23:51:09 -04:00
Yaroslav Halchenko 5d7ab9e7fb DOC: Changelog for preceding changes 2013-07-02 23:38:27 -04:00
Yaroslav Halchenko 47ac39fb34 TST: minor enhancement to test failure msg 2013-07-02 23:37:41 -04:00
Yaroslav Halchenko 8d25e83f5d BF: race condition -- file should not be read unless it is not empty
Previous code would store md5sum of an empty line as the one
identifying the monitored file.  That file then was read and possibly
failures were found.  Upon next "container.open()", md5 digest of now
present first line was compared against previous digest of an empty
line, which was different, thus file was assumed to be rotated and all
the log lines were read once again.

The History
-----------
In rare cases various tests failed somewhat consistently.  Below you
can find one case in test_move_file where such failure really made no
sense -- we should have not had 4 failures by that point.

Fail2ban 0.8.10.dev test suite. Python 2.4.6 (#2, Sep 25 2009, 22:22:06) [GCC 4.3.4]. Please wait...
I: Skipping gamin backend testing. Got exception 'No module named gamin'
I: Skipping pyinotify backend testing. Got exception 'No module named pyinotify'
D: fn=/home/yoh/test/monitorfailures_FilterPoll9nUKoCfail2ban-0 hashes=d41d8cd98f00b204e9800998ecf8427e/d41d8cd98f00b204e9800998ecf8427e inos=5398862/5398862 pos=0 rotate=False
D: Adding a ticket for ('193.168.0.128', 1124013599.0, ['Aug 14 11:59:59 [sshd] error: PAM: Authentication failure for kevin from 193.168.0.128\n'])
D: Adding a ticket for ('193.168.0.128', 1124013599.0, ['Aug 14 11:59:59 [sshd] error: PAM: Authentication failure for kevin from 193.168.0.128\n'])
D: Closed <closed file '/home/yoh/test/monitorfailures_FilterPoll9nUKoCfail2ban-0', mode 'r' at 0x7f472b2efdc8> with pos 1231
D: fn=/home/yoh/test/monitorfailures_FilterPoll9nUKoCfail2ban-0 hashes=d41d8cd98f00b204e9800998ecf8427e/aeb4e73e6922a746d027eb365ece2149 inos=5398862/5398862 pos=1231 rotate=True
D: Adding a ticket for ('193.168.0.128', 1124013599.0, ['Aug 14 11:59:59 [sshd] error: PAM: Authentication failure for kevin from 193.168.0.128\n'])
D: Adding a ticket for ('193.168.0.128', 1124013599.0, ['Aug 14 11:59:59 [sshd] error: PAM: Authentication failure for kevin from 193.168.0.128\n'])
D: Closed <closed file '/home/yoh/test/monitorfailures_FilterPoll9nUKoCfail2ban-0', mode 'r' at 0x7f472b2ef558> with pos 1231
F
======================================================================
FAIL: test_move_file (testcases.filtertestcase.MonitorFailures<FilterPoll>(/home/yoh/test/monitorfailures_FilterPoll9nUKoCfail2ban))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/deb/gits/fail2ban/testcases/filtertestcase.py", line 451, in test_move_file
    "Queue must be empty but it is not: %s."
AssertionError: Queue must be empty but it is not: server.ticket.FailTicket: ip=193.168.0.128 time=1124013599.0 #attempts=4.

----------------------------------------------------------------------

N.B.1 I preserved here and in the code corresponding additional debug
print statements, which are commented out by default. sensible md5
digest was generated by using hexdigest() instead of current a bit
faster digest().  Running tests with all the debug output simply
breaks the race loose and failure doesn't trigger.

N.B.2 d41d8cd98f00b204e9800998ecf8427e is an md5sum of an empty
string, and aeb4e73e6922a746d027eb365ece2149 of the first line in that
file.
2013-07-02 23:37:23 -04:00
Yaroslav Halchenko 052e7ff9da ENH: deprecate sophisticated MTimeSleep in favor of no sleeping at all
all invocations of mtimesleep() are left in the tests for now
2013-07-02 20:44:28 -04:00
Yaroslav Halchenko f340e5c0f5 ENH(+possibly BF): for FilterPoll rely not only on mtime but also ino and size to assess if file was modified
mtime alone is a poor measure here as many of our tests shown -- on older Pythons and some file systems
mtime might be reported only with precision up to a second.  If file gets rotated fast, or there are new
modifications within the same second, fail2ban might miss them with Polling backend if judging only by
mtime.  With this modification we will track also inode and size which are all indicative of a file
change.
2013-07-02 20:43:51 -04:00
Yaroslav Halchenko 8c125b6053 ENH: do not sleep 1 sec only on older Pythons while testing filters 2013-07-02 19:50:22 -04:00
Yaroslav Halchenko 2ffc143597 ENH: more of heavydebug'ing for FilterPoll 2013-07-02 19:49:41 -04:00
Daniel Black 256f60adae DOC: improved log message 2013-07-03 09:01:24 +10:00
Daniel Black d6dece4900 ENH: Split log and provide jail examples 2013-07-03 07:42:47 +10:00
Yaroslav Halchenko e9c8a51ce4 ENH: further tighten up detection of mtimesleep duration + log what was assigned 2013-07-02 17:26:41 -04:00
Yaroslav Halchenko 591590860a BF: setSleepTime -- would barf since value is not str (wasn't used/tested) 2013-07-02 17:11:24 -04:00
Yaroslav Halchenko 8f3671bc94 BF: figure out minimal sleep time needed for mtime changes to get detected. Close #223, and probably #103 2013-07-02 17:10:00 -04:00
Alexander Dietrich da594075f3 Move sendmail settings to common file, make sender name configurable 2013-07-02 20:30:41 +02:00
Yaroslav Halchenko e6ebcf6687 Merge branch 'dovecot' of https://github.com/grooverdan/fail2ban
* 'dovecot' of https://github.com/grooverdan/fail2ban:
  ENH: remove non-capturing groups for readibility
  BF: fix dovecot filter for when no TLS is enabled on pop/imap

Conflicts:
	ChangeLog -- changelog entries.  Also untabified few other spots
2013-07-02 10:12:51 -04:00
Yaroslav Halchenko f0f237fa05 Merge pull request #269 from grooverdan/asterisk
ENH: filter.d/asterisk - consolidate log prefix regex and add a few fail messages
2013-07-02 07:04:10 -07:00
Daniel Black e6823149a1 ENH: remove non-capturing groups for readibility 2013-07-02 20:16:43 +10:00
Daniel Black aebd24ec54 BF: replace with ed so its cross platform, fixes permission problem gh-266, and Yaroslav doesn't revert to perl 2013-07-02 20:09:27 +10:00
Daniel Black 4777cfd4e7 ENH: split out exim-spam into speparate filter 2013-07-02 20:03:16 +10:00
Yaroslav Halchenko 54cce29b3e Merge pull request #271 from yarikoptic/master
BF: support apache 2.4 more detailed error log format. Close #268

Thanks @grooverdan for the review
2013-07-01 20:52:36 -07:00
Yaroslav Halchenko 6df949b29a Merge pull request #277 from yarikoptic/0.9
ENH: ban also submission port (587) for all smtp-related jails
2013-07-01 20:30:16 -07:00
Yaroslav Halchenko 70ae1ed68b ENH: ban also submission port (587) for all smtp-related jails
see http://www.rfc-editor.org/rfc/rfc4409.txt
and http://en.wikipedia.org/wiki/Mail_submission_agent

Users of advanced setups might like to split those into multiple jails anyways
to have separate control over submission agents and incoming mail servers.
2013-07-01 14:50:02 -04:00
Daniel Black c7d64c3c7f TST: url reference fix 2013-07-01 21:58:03 +10:00