Commit Graph

97 Commits (493c441bcb44cace7b7d837d276b33dea976ed79)

Author SHA1 Message Date
Daniel Black c700910155 TST: ensure stock jail has all filters 2014-01-05 21:06:30 +11:00
Daniel Black 4df246b0dd BF: ignorecommand is a jail option not a filter option 2013-12-29 21:57:37 +00:00
Yaroslav Halchenko 4e165c9692 ENH: FilterReader - use the set methods (improve coverage), test getters, use os.path.join 2013-12-27 01:43:23 -05:00
bes.internal ebd89ec077 New ignorecommand that is added to the ignoreip list from output of an external program
ignorecommand update man and fix protocol help

ENH: run ignore command only after internal list has been examined. Change interface on ignorecommand to take IP as environment variable and return true if it is to be banned

ENH: ignore IP command to take tagged command

DOC: man pages for ingorecommand

TST: add test cases for ignorecommand
2013-12-24 23:55:35 +03:00
Daniel Black 603095bc16 BF: errors in a jail prevents further sections from being parsed. Closes #485 2013-12-14 07:00:41 +00:00
Daniel Black b147270be7 BF: allow processing with empty filter 2013-12-13 11:36:00 +00:00
Daniel Black d74dd31d23 BF: corrected tests for missing jail
Previously tests relied on the missing filter to trigger the conditions
required for a missing jail. We now handle this explicitly.
2013-12-13 10:00:34 +00:00
Daniel Black 3ddf8da76e ENH: ensure filter is defined in jail before its read 2013-12-13 08:45:10 +00:00
Daniel Black c6d14dcf0e TST: complete coverage of splitAction 2013-12-12 20:35:30 +00:00
Daniel Black b18ce122dd BF/ENH: fix error when action doesn't match regex. Document unreachable code. Simplify regex 2013-12-12 20:07:09 +00:00
Daniel Black f84a03d6b5 BF: remove nonreachable parts of code
Glob ensures the file exists so only a check that a missing dangling
symlink needs to be done.

$ ls -la /tmp/f2b-tempq0ipGY/f2
lrwxrwxrwx. 1 dan dan 11 Dec 12 08:42 /tmp/f2b-tempq0ipGY/f2 ->
xisting

In [3]: os.path.exists('/tmp/f2b-tempq0ipGY/f2')
Out[3]: False

In [4]: os.path.lexists('/tmp/f2b-tempq0ipGY/f2')
Out[4]: True
2013-12-12 09:08:42 +00:00
Daniel Black 970fd5d289 BF: ensure dangling symlink error message is reachable
$ ls -la /tmp/f2b-tempq0ipGY/f2
lrwxrwxrwx. 1 dan dan 11 Dec 12 08:42 /tmp/f2b-tempq0ipGY/f2 -> nonexisting

In [3]: os.path.exists('/tmp/f2b-tempq0ipGY/f2')
Out[3]: False

In [4]: os.path.lexists('/tmp/f2b-tempq0ipGY/f2')
Out[4]: True
2013-12-12 08:52:01 +00:00
Daniel Black b5d6310d28 BF: create flushlogs command to prevent logrotation clobbering logtarget. Closes gh-458 2013-12-04 20:51:30 +11:00
Daniel Black d6d51e352c ENH: order config as jail.conf, jail.d/*.conf, jail.local, jail.d/*.local. closes gh-388 2013-10-11 00:06:13 +11:00
Yaroslav Halchenko dcaacad7e3 BF: do not pass dangling symlinks to the server to be monitored
This is more of a workaround I guess than a "solution".  Ideally server
should be more clever and allow adding symlinks which eventually might
point to existing file.  But that is probably would be too much complication
for a rare use case.  User on the mailing list informed that then server
does not monitor even other files, thus as a quick workaround -- do not even add dangling links
2013-09-28 22:16:34 -04:00
Orion Poplawski 67497db6e5 Change /tmp/fail2ban.sock to /var/run/fail2ban/fail2ban.sock 2013-08-08 20:28:55 -06:00
Yaroslav Halchenko b92316ff17 RF(ENH): JailsReader.getOptions -- avoid code duplication when asking for 1 jail or all 2013-07-22 11:47:36 -04:00
Yaroslav Halchenko 057f0ad135 ENH: allow_no_files option for jail's convert to allow testing of stock jail.conf 2013-06-21 12:44:37 -04:00
Yaroslav Halchenko 27947407bc ENH: raise an exception if not a single file was found for the jail. Close #63 2013-06-21 11:12:44 -04:00
Yaroslav Halchenko 582d1c5ea5 ENH: remove use of $Revision and $Date SVN tags 2013-05-08 13:59:09 -04:00
Daniel Black 495f2dd877 DOC: purge of svn tags 2013-05-03 16:03:38 +10:00
Yaroslav Halchenko 7c409dd24f Merge branch 'master' of git://github.com/fail2ban/fail2ban
* 'master' of git://github.com/fail2ban/fail2ban:
  BF: log error only if there were missed config files that couldn't be read
  DOC: missing cinfo tags are ok. Log error for self referencing definitions
  DOC: s/defination/definition/g learn to spell
  ENH: remove stats of config files and use results of SafeConfigParserWithIncludes.read to facilitate meaningful error messages
  DOC: ChangeLog for recursive tag substition
  ENH: allow recursive tag substitution in action files.
2013-05-02 23:28:18 -04:00
Yaroslav Halchenko 8e63d4c6da ENH: "is None" instead of "== None" + tune ups in headers
is None is generally faster than == and from looking at those places
should be adequate.

Also while at those files removed unneded duplicate author listing +
expanded copyright/authors with myself where applicable
2013-05-02 23:25:43 -04:00
Daniel Black 98aa0e23eb BF: log error only if there were missed config files that couldn't be read 2013-04-30 08:19:11 +10:00
Daniel Black 2403f395e9 ENH: remove stats of config files and use results of SafeConfigParserWithIncludes.read to facilitate meaningful error messages 2013-04-29 15:33:45 +10:00
Yaroslav Halchenko ab044b75ea BF: delay check for the existence of config directory until read() 2013-03-27 12:22:39 -04:00
Yaroslav Halchenko f643e2e907 non-static (get|set)BaseDir for Configurator. fixes #160
ConfigReader's (get|set)BaseDir are no longer static as a result of
.d/ support RFing
2013-03-27 11:51:07 -04:00
Yaroslav Halchenko 8fe4e11b67 ENH: allow to force enable all jails (for testing), do not crash for jails without actions (just warn)
also a bit more explicit handling of regexp groups in splitAction
2013-03-26 00:01:12 -04:00
Yaroslav Halchenko 2fb053643e ENH: minor -- add default value into the warning if option had none provided 2013-03-25 23:59:42 -04:00
Yaroslav Halchenko 755f27493e Merge branch '_tent/conf_d'. fixes #114
It also fixes #115 since current implementation provides similarly informative
error messages.  But see #153 for possible improvements

* _tent/conf_d:
  Reincarnated removed (by mistake) test for SplitAction
  ENH: made log messages while parsing files more informative + test for inaccessible file (Closes: gh-24)
  NF: allow customization configuration under corresponding .d directories (Closes gh-114)
  Fix up for warning/error for inaccessible config files
  Warn if config file present but unreadable

Conflicts:
	fail2ban-testcases
2013-03-25 11:53:45 -04:00
Yaroslav Halchenko 2312b1d950 ENH: made log messages while parsing files more informative + test for inaccessible file (Closes: gh-24) 2013-02-17 17:19:09 -05:00
Steven Hiscocks ce3ab34dd8 Added ability to specify PID file 2013-02-17 22:14:01 +00:00
Yaroslav Halchenko 9ba27353b6 NF: allow customization configuration under corresponding .d directories (Closes gh-114)
Additional changes:
  ENH: make basedir for Config's a kwarg to the constructor
  ENH: improved analysis/reporting on presence/accessibility of config
       files.  Got carried away and forgot about existing  work done by
	   Steven Hiscocks in the gh-115 -- will merge it in the next
       commit for the fair ack of his work

Now for any X.conf configuration file we have following ways to
provide customizations

  X.local -- read after .conf (kept for backward compatibility)
  X.d/ -- directory to contain additional .conf files, sorted
               alphabetically, e.g
  X.d/01_enable.conf       - to enable the jail
  X.d/02_custom_port.conf  - to change the port

X could be a 'jail' or 'fail2ban' or any other configuration file in
fail2ban.

Mention that all files still must contain the corresponding sections
(most of the time duplicating it across all of them).
2013-02-17 17:03:23 -05:00
Yaroslav Halchenko acab23bdfe RF: move exceptions used by both client and server into common/exceptions.py
this prevents importing of server while operating with client only
2013-01-28 09:46:50 -05:00
Lee Clemens d73a71f5cf ENH: Add usedns parameter for the jails
following commits were squashed from feature branch use_dns

commit 068c105eb5
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 22:19:04 2012 -0500

    Prevent warning when IP is read from log

commit 635ed36a8c
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 22:17:08 2012 -0500

    Removed logDebug

commit 24656d2812
Merge: 7957fbe c429f5c
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 21:13:11 2012 -0500

    Merge branch 'enh/use_dns' of github:leeclemens/fail2ban into enh/use_dns

    Conflicts:
    	testcases/filtertestcase.py

commit 7957fbe821
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 21:09:58 2012 -0500

    filtertestcase fixes from yarikoptic

commit 6ce9d04640
Author: Yaroslav Halchenko <debian@onerussian.com>
Date:   Tue Jan 10 19:26:05 2012 -0500

    RF: for consistency use_dns -> usedns

    I guess it was might fault of inconsistency suggesting that name.
    Other options/commands do not have _ in the names, so let it be
    consistent with the rest for now

commit cfb2c75b49
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 19:18:41 2012 -0500

    Updated DNSUtilsTests to test use_dns and added positive test to testTextToIp

commit f6186eff14
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 19:02:04 2012 -0500

    Changed wording of 'DNS Reverse lookup used' message

commit 82c62d29dc
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 18:53:17 2012 -0500

    Removed extraneous "n"

commit dc0ae21932
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 23:07:59 2012 -0500

    ENH: use_dns - removed debugging statements

commit 594e25818c
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 22:53:39 2012 -0500

    Added use_dns protocol to set and get per jail during runtime

commit 48ff80ffac
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 22:41:18 2012 -0500

    Completed use_dns for initial startup - with debugging statements

commit 0bdab4c2d7
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 20:05:35 2012 -0500

    ENH: Added use_dns option

commit 6d6b734ea5
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 20:01:34 2012 -0500

    ENH: Added use_dns option

commit 11ad2b6125
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 19:17:30 2012 -0500

    Added useDns flag to testcase

commit b48fa9b6af
Author: Lee Clemens <java@leeclemens.net>
Date:   Sun Jan 8 15:13:27 2012 -0500

    Added use_dns option in jail.conf

commit c429f5c91a
Merge: 4b18afb 0021906
Author: leeclemens <java@leeclemens.net>
Date:   Tue Jan 10 16:32:22 2012 -0800

    Merge pull request #3 from yarikoptic/enh/use_dns

    let's be consistent ;-)

commit 0021906358
Author: Yaroslav Halchenko <debian@onerussian.com>
Date:   Tue Jan 10 19:26:05 2012 -0500

    RF: for consistency use_dns -> usedns

    I guess it was might fault of inconsistency suggesting that name.
    Other options/commands do not have _ in the names, so let it be
    consistent with the rest for now

commit 4b18afb28a
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 19:18:41 2012 -0500

    Updated DNSUtilsTests to test use_dns and added positive test to testTextToIp

commit 4fae37e46f
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 19:02:04 2012 -0500

    Changed wording of 'DNS Reverse lookup used' message

commit e94806ce48
Author: Lee Clemens <java@leeclemens.net>
Date:   Tue Jan 10 18:53:17 2012 -0500

    Removed extraneous "n"

commit 4d30c52907
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 23:07:59 2012 -0500

    ENH: use_dns - removed debugging statements

commit 76696d452a
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 22:53:39 2012 -0500

    Added use_dns protocol to set and get per jail during runtime

commit 0631618087
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 22:41:18 2012 -0500

    Completed use_dns for initial startup - with debugging statements

commit d23d495547
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 20:05:35 2012 -0500

    ENH: Added use_dns option

commit 9538553bc5
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 20:01:34 2012 -0500

    ENH: Added use_dns option

commit ae1e857e53
Author: Lee Clemens <java@leeclemens.net>
Date:   Mon Jan 9 19:17:30 2012 -0500

    Added useDns flag to testcase

commit ace43eb941
Author: Lee Clemens <java@leeclemens.net>
Date:   Sun Jan 8 15:13:27 2012 -0500

    Added use_dns option in jail.conf
2012-01-12 23:23:41 -05:00
Leonardo Chiquitto a7d47e8b36 Update Free Software Foundation's address
The address has changed from "59 Temple Place, Suite 330, Boston,
MA  02111-1307  USA" to "51 Franklin Street, Fifth Floor, Boston,
MA  02110-1301, USA" some time ago.
2011-12-30 12:41:46 -05:00
Yaroslav Halchenko a9be451079 ENH: removed expansion for few Date and Revision SVN keywords
For consistency of appearance... eventually we might just remove them
altogether
2011-11-18 10:14:39 -05:00
Yaroslav Halchenko ed6daa70bf ENH: modelines for emacs and vim to assure consistent indentation scheme (tabs) 2011-10-07 15:49:38 -04:00
Yaroslav Halchenko a35e586ac0 BF: use addfailregex instead of failregex while processing per-jail "failregex" parameter (Closes: #635830) (LP: #635036)
patch from Marat Khayrullin received in Ubuntu BTS.  Otherwise custom per-jail
failregex forbidded fail2ban from starting

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@780 a942ae1a-1317-0410-a47c-b1dcaea8d605
2011-07-29 02:08:31 +00:00
Yaroslav Halchenko afee14e778 BF: use os.path.join to generate full path - fixes includes in configs given local filename
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@779 a942ae1a-1317-0410-a47c-b1dcaea8d605
2011-06-27 03:40:16 +00:00
Yaroslav Halchenko b9b9e42223 very minor -- uniform indentation in example
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@778 a942ae1a-1317-0410-a47c-b1dcaea8d605
2011-06-27 03:40:08 +00:00
Cyril Jaquier 8db3e1f74a - Removed "timeregex" and "timepattern" stuff that is not needed anymore.
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@711 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-08-12 22:05:13 +00:00
Cyril Jaquier 7f37df4a59 - Better (correct) fix for ignoreregex in jail.[conf|local].
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@690 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-05-12 08:34:42 +00:00
Cyril Jaquier 4bc6a93ce2 - Fixed ignoreregex processing in fail2ban-client. Thanks to René Berber.
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@689 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-05-12 08:25:17 +00:00
Cyril Jaquier 331ae7155a - Catch Exception instead of AttributeError.
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@659 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-03-04 23:09:30 +00:00
Cyril Jaquier 174ce7027a - Fixed fail2ban-regex. It support "includes" in configuration files.
- Modified "includes" to be more generic. We will probably support URL in the future.
- Small refactoring.

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@656 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-03-04 00:17:56 +00:00
Cyril Jaquier 6779814d91 - "reload <jail>" reloads a single jail and the parameters in fail2ban.conf.
- Look for fail2ban-server in sys.path[0]. Thanks to Bill Heaton.

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@655 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-03-04 00:13:39 +00:00
Cyril Jaquier 695b6b1fe5 - New log rotation detection algorithm.
- Print monitored files in status.

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@644 a942ae1a-1317-0410-a47c-b1dcaea8d605
2008-01-14 23:12:21 +00:00
Cyril Jaquier ce6b8c959e - Removed Python 2.4. Minimum required version is now Python 2.3.
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@635 a942ae1a-1317-0410-a47c-b1dcaea8d605
2007-12-16 21:38:04 +00:00
Cyril Jaquier e66d9eee41 - Moved socket to /var/run/fail2ban.
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@629 a942ae1a-1317-0410-a47c-b1dcaea8d605
2007-12-14 21:33:33 +00:00