Commit Graph

1261 Commits (e584ab66ac06c4679261e518ea0e6a94cb45f979)

Author SHA1 Message Date
Steven Hiscocks 94956bee84 TST: test all valid loglevels in server testcases 2013-04-14 15:59:05 +01:00
Steven Hiscocks 4c4b60f4b4 TST: Add tag replace and escape test for actions 2013-04-14 15:58:35 +01:00
Steven Hiscocks 3d6791fe3e ENH: Minor change to action for consistency of execStart/Stop 2013-04-14 15:57:37 +01:00
Steven Hiscocks d259e903a3 TST: Coverage for coveralls.io should only be run on success 2013-04-14 15:56:14 +01:00
Steven Hiscocks 28e9acf86a TST: no cover additions to server, primarily daemon creation 2013-04-14 15:55:18 +01:00
Steven Hiscocks 88187fc161 TST: Tweak python3 open statement to resolve python2.5 SyntaxError 2013-04-14 11:00:08 +01:00
Steven Hiscocks d28788c87b TST: Revert changes for filter testcase open statement
Also merging python3 support
2013-04-14 10:24:44 +01:00
Steven Hiscocks 36097ffc3e DOC: Revert setup.py messages to use print statement 2013-04-14 10:18:22 +01:00
Yaroslav Halchenko ffe48741e3 DOC: thanks @kwirk for spotting the typos in exception message 2013-04-13 22:20:57 -04:00
Steven Hiscocks 70bcb0e32f Add *.bak files generated by 2to3 to gitignore 2013-04-13 17:05:19 +01:00
Steven Hiscocks 9241ded376 TST: Fix up fail2ban python3 scripts 2013-04-13 17:01:18 +01:00
Steven Hiscocks d061b2b549 TST: Fix issues in tests which assumed dictionary's order 2013-04-13 16:55:22 +01:00
Steven Hiscocks fa0f8f9e6d Merge branch '0.9' into py3
Conflicts:
	.travis.yml
	MANIFEST
	bin/fail2ban-regex
	fail2ban/server/filter.py
	fail2ban/tests/servertestcase.py
	setup.py
2013-04-13 16:54:22 +01:00
Yaroslav Halchenko 301460f451 Merge remote-tracking branch 'pr/167/head': FD_CLOEXEC bug fixes (filters) + support (actions). Avoid sockets descriptors leak.
* pr/167/head:
  FD_CLOEXEC support
2013-04-11 15:05:56 -04:00
Yaroslav Halchenko 5aef036f54 Merge remote-tracking branch 'github_kwirk_fail2ban/module' into 0.9
* github_kwirk_fail2ban/module:
  TST: revert change of log format for testcases in commit a3d82e2
  ENH: fail2ban logging uses __name__ for logger names
2013-04-11 14:19:39 -04:00
Steven Hiscocks 0ea9904440 TST: revert change of log format for testcases in commit a3d82e2 2013-04-11 18:19:44 +01:00
Steven Hiscocks a3d82e2ab9 ENH: fail2ban logging uses __name__ for logger names 2013-04-10 21:33:55 +01:00
Yaroslav Halchenko 59192a5585 Merge remote-tracking branch 'github_kwirk_fail2ban/pidfile'
* github_kwirk_fail2ban/pidfile:
  Typo in default pidfile in fail2ban.conf
2013-04-09 23:48:46 -04:00
Yaroslav Halchenko fe1c3fbdd9 BF: fixing incorrect merge conflict -- run coverage only for 2.7 2013-04-09 20:24:54 -04:00
Yaroslav Halchenko 7a385fd442 BF: Move mysqld.log into a new location under fail2ban module 2013-04-09 19:46:24 -04:00
Yaroslav Halchenko e630b77fca Make fail2ban a full blown module. Close gh-26
AKA: Merge remote-tracking branch 'github_kwirk_fail2ban/module' into 0.9

* github_kwirk_fail2ban/module:
  BF: Added test filter.d files to setup.py package data
  TST: Fix up tests from multiline elements broken in previous merge
  TST: clientreader test now use /etc/fail2ban/ if no local config/
  ENH+TST: Move fail2ban-* scripts to bin/
  TST+ENH: Move testcases to part of fail2ban module
  TST: Update Travis CI coverage config for python module structure
  ENH+BF+TST+DOC: Make fail2ban a python module

Conflicts:
	.travis.yml -- the line for PYTHONPATH
	.travis_coveragerc -- now we do cover gamin tests
2013-04-09 19:39:58 -04:00
Yaroslav Halchenko ebfb9422d8 Merge branch 'master' into 0.9
* master:
  ENH: for consistency (and future expansion ;)) -- rename to mysqld-auth
  Adjusting previous PR (MySQL logs) according to my comments
  TST: Add gamin testing for and only coveralls coverage for python2.7
  change the license to GPLv2 + adapat text
  TST: Add gamin support for Travis CI
  fix the script name to check_fail2ban everywhere
  Replace the check_fail2ban script by a new one which respects the Nagios specs (like status, output, perfdata, help...). Also add a README which includes the content of f2ban.txt (which is now removed)
  Added testcase for MySQL date format to testcases/datedetectortestcase.py and example of MySQL log file.
  Added support for MySQL logfiles
2013-04-09 18:49:18 -04:00
Yaroslav Halchenko 99a5d78e37 ENH: for consistency (and future expansion ;)) -- rename to mysqld-auth 2013-04-09 18:03:34 -04:00
Yaroslav Halchenko ffaa9697ee Adjusting previous PR (MySQL logs) according to my comments 2013-04-09 18:00:40 -04:00
Yaroslav Halchenko 3e6be243bf Merge branch 'Support_for_mysql_log_example' of https://github.com/arto-p/fail2ban
* 'Support_for_mysql_log_example' of https://github.com/arto-p/fail2ban:
  Added testcase for MySQL date format to testcases/datedetectortestcase.py and example of MySQL log file.
  Added support for MySQL logfiles

Conflicts:
	testcases/datedetectortestcase.py -- conflictde with other added test cases
2013-04-09 17:55:14 -04:00
Yaroslav Halchenko 4fb06170f1 Merge 'Update the check_fail2ban script' PR from https://github.com/labynocle/fail2ban
* 'master' of https://github.com/labynocle/fail2ban:
  change the license to GPLv2 + adapat text
  fix the script name to check_fail2ban everywhere
  Replace the check_fail2ban script by a new one which respects the Nagios specs (like status, output, perfdata, help...). Also add a README which includes the content of f2ban.txt (which is now removed)
2013-04-09 17:41:36 -04:00
Steven Hiscocks a33bf5baca ENH: setup.py now automatically runs 2to3 for python3.x 2013-04-09 19:40:54 +01:00
Yaroslav Halchenko f5ad99b527 Merge pull request #166 from kwirk/travis-gamin
Travis gamin support on Travis CI
2013-04-06 08:20:21 -07:00
Steven Hiscocks 47c54ba293 TST: Add gamin testing for and only coveralls coverage for python2.7 2013-04-06 11:08:07 +01:00
Steven Hiscocks 3a16ceed0a BF: Added test filter.d files to setup.py package data 2013-04-06 10:20:53 +01:00
Steven Hiscocks c4bdc48edb TST: Fix up tests from multiline elements broken in previous merge 2013-04-06 10:15:43 +01:00
Steven Hiscocks 8e0f5f8ea6 Merge branch '0.9' into module
Conflicts:
	fail2ban/tests/clientreadertestcase.py
	fail2ban/tests/filtertestcase.py
2013-04-06 09:57:44 +01:00
Nicolas Collignon 39667ff6f7 FD_CLOEXEC support
* 001-fail2ban-server-socket-close-on-exec-no-leak.diff

Add code that marks server and client sockets with FD_CLOEXEC flags.
Avoid leaking file descriptors to processes spawned when handling
fail2ban actions (ex: iptables).

Unix sockets managed by fail2ban-server don't need to be passed to any
child process. Fail2ban already uses the FD_CLOEXEC flags in the filter
code.

This patch also avoids giving iptables access to fail2ban UNIX socket in
a SELinux environment (A sane SELinux policy should trigger an audit
event because "iptables" will be given read/write access to the fail2ban
control socket).

Some random references related to this bug:
 http://sourceforge.net/tracker/?func=detail&atid=689044&aid=2086568&group_id=121032
 http://www.redhat.com/archives/fedora-selinux-list/2009-June/msg00124.html
 http://forums.fedoraforum.org/showthread.php?t=234230

 * 002-fail2ban-filters-close-on-exec-typo-fix.diff

There is a typo in the fail2ban server/filter.py source code. The
FD_CLOEXEC is correctly set but additional *random* flags are also set.
It has no side-effect as long as the fd doesn't match a valid flag :)
"fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC)" <== the 3rd
parameter should be flags, not a file descriptor.

 * 003-fail2ban-gamin-socket-close-on-exec-no-leak.diff

Add code that marks the Gamin monitor file descriptor with FD_CLOEXEC
flags. Avoid leaking file descriptors to processes spawned when handling
fail2ban actions (ex: iptables).

---

File descriptors in action process before patches:
dr-x------ 2 root root  0 .
dr-xr-xr-x 8 root root  0 ..
lr-x------ 1 root root 64 0 -> /dev/null        <== OK
l-wx------ 1 root root 64 1 -> /tmp/test.log    <== used by test action
lrwx------ 1 root root 64 2 -> /dev/null        <== OK
lrwx------ 1 root root 64 3 -> socket:[116361]  <== NOK (fail2ban.sock leak)
lr-x------ 1 root root 64 4 -> /proc/20090/fd   <== used by test action
l-wx------ 1 root root 64 5 -> /var/log/fail2ban.log <== OK
lrwx------ 1 root root 64 6 -> socket:[115608]  <== NOK (gamin sock leak)

File descriptors in action process after patches:
dr-x------ 2 root root  0 .
dr-xr-xr-x 8 root root  0 ..
lr-x------ 1 root root 64 0 -> /dev/null        <== OK
l-wx------ 1 root root 64 1 -> /tmp/test.log    <== used by test action
lrwx------ 1 root root 64 2 -> /dev/null        <== OK
lr-x------ 1 root root 64 3 -> /proc/18284/fd   <== used by test action
l-wx------ 1 root root 64 5 -> /var/log/fail2ban.log <== OK
2013-04-02 19:11:59 +02:00
Erwan Ben Souiden 44736035bd change the license to GPLv2 + adapat text 2013-04-02 09:49:44 +02:00
Steven Hiscocks 0ce046ec47 TST: clientreader test now use /etc/fail2ban/ if no local config/ 2013-04-01 19:06:58 +01:00
Steven Hiscocks a153653a27 ENH+TST: Move fail2ban-* scripts to bin/ 2013-04-01 19:06:13 +01:00
Steven Hiscocks e3bd2042eb TST+ENH: Move testcases to part of fail2ban module
This allows fail2ban-testcases to be run on an installed fail2ban
instance.
TODO: Fix tests requiring config files
2013-04-01 11:22:40 +01:00
Steven Hiscocks e53bfafd6a TST: Update Travis CI coverage config for python module structure 2013-03-31 19:36:52 +01:00
Steven Hiscocks dba88e842f ENH+BF+TST+DOC: Make fail2ban a python module 2013-03-31 18:18:21 +01:00
Steven Hiscocks 77aa523f22 Merge branch 'master' into py3
Conflicts:
	.travis.yml
	server/datetemplate.py
	server/server.py
	testcases/filtertestcase.py
2013-03-30 22:51:36 +00:00
Yaroslav Halchenko e43fcc80db BF: setBaseDir is not static method now -- so set it for the filterReader in question 2013-03-30 18:30:23 -04:00
Yaroslav Halchenko 03f6c42352 Merge commit '0.8.8-160-g74e76e0' into 0.9
* commit '0.8.8-160-g74e76e0': (65 commits)
  TST+BF: Use separate coveragerc for Travis CI
  RF+TST: bring inBanList back from private to protected and enabled its rudimentary unittests
  TST: coverage ignore Travis CI python virtual environments
  ENH: increase waiting to 4 sec for gamin/pyinotify
  TST+BF: Fix incorrect commands for coveralls support
  TST: Add support for coveralls for python 2.6 and python 2.7
  ENH: deleted trailing spaces in fail2ban- cmdline tools
  DOC: minor change -- refer to the fail2ban manpage
  TST: be more aggressive in cleanup of temp files + use mktemp instead of mkstemp
  ENH(BF?): overload open() (for buffering) within filtertestcase to guarantee atomic writing
  BF: delay check for the existence of config directory until read()
  DOC: minor fix ups of manpages. fixes #159
  non-static (get|set)BaseDir for Configurator. fixes #160
  ENH: Slight tune ups for fresh SOGo filter + comment into the sample log file
  ENH: postfix filter -- react also on (450 4.7.1) with empty from/to. fixes #126
  TST: basic testing of reading the shipped jail.conf (forcing all jails to be enabled)
  ENH: allow to force enable all jails (for testing), do not crash for jails without actions (just warn)
  ENH: minor -- add default value into the warning if option had none provided
  ENH: _copy_lines_between_files -- read all needed, and only then write/flush at once
  ENH: move pyinotify callback debug message into callback + delay string interpolations
  ...

Conflicts:
	fail2ban-testcases
	testcases/clientreadertestcase.py -- fix for setBaseDir will follow
2013-03-30 18:29:39 -04:00
Steven Hiscocks 5acd035f72 TST: Remove Travis CI unsupported versions of python from Travis config 2013-03-30 21:51:22 +00:00
Steven Hiscocks d30f6a2d66 add fail2ban-2to3 to MANIFEST file 2013-03-30 21:40:42 +00:00
Steven Hiscocks b0a08b9790 TST: Add gamin support for Travis CI 2013-03-30 18:17:01 +00:00
Yaroslav Halchenko 74e76e068c Merge pull request #164 from kwirk/coveralls
TST+BF: Use separate coveragerc for Travis CI
2013-03-29 13:32:29 -07:00
Steven Hiscocks 0002fb4ca3 TST+BF: Use separate coveragerc for Travis CI
Should now ignore server/filtergamin.py as gamin is not tested. Also
ignores Travis CI python virtual environments
2013-03-29 20:14:13 +00:00
Yaroslav Halchenko 33a31e096a RF+TST: bring inBanList back from private to protected and enabled its rudimentary unittests 2013-03-29 15:33:08 -04:00
Yaroslav Halchenko 08dd6fed26 Merge pull request #163 from kwirk/coveralls
Coveralls.io
2013-03-29 12:15:34 -07:00
Steven Hiscocks e0e116cb36 TST: coverage ignore Travis CI python virtual environments 2013-03-29 19:09:55 +00:00