Commit Graph

79 Commits (facda179456ee697978705f5c9e1f081c434d29d)

Author SHA1 Message Date
sebres e3ab10196e Merge remote-tracking branch 'remotes/gh-origin/f2b-perfom-prepare-716-cs-0.10' into 0.10-full 2016-06-09 22:13:48 +02:00
sebres 06dcad7650 fixed mixed indentation (spaces through tabs), duplicate code removed 2016-05-17 12:27:01 +02:00
Alexander Koeppe 975608dfb6 no hardcoded python interpreter path 2016-05-15 21:08:32 +02:00
sebres 53956501da increase readability and details level by increased verbosity 2016-05-12 11:53:12 +02:00
sebres afa1cdc3ae client/server (bin) test cases introduced, ultimate closes #1121, closes #1139
small code review and fixing of some bugs during client-server communication process (in the test cases);
2016-05-12 11:51:56 +02:00
sebres 5a053f4b74 starting of the server (and client/server communication behavior during start and daemonize) completely rewritten:
- client/server functionality moved away from bin and using now the common interface (introduced in fail2bancmdline);
  - start in foreground fixed;
  - server can act as client corresponding command line;
  - command "restart" added: in opposite to "reload" in reality restarts the server (new process);
  - several client/server bugs during starting process fixed.
2016-05-12 11:51:53 +02:00
sebres 556ddaabd7 temporary commit (move client/server from bin) 2016-05-12 11:51:50 +02:00
sebres 4ce240ed40 try to start server in foreground
# Conflicts:
#	fail2ban/server/server.py
2016-05-12 11:51:47 +02:00
sebres 05f38285f1 Merge remote-tracking branch 'remotes/gh-upstream/master' into f2b-perfom-prepare-716 2016-05-02 15:40:05 +02:00
sebres 9d7e860edb possibility to increase verbosity up to heavy debug (partial ported from 716-cs) 2016-04-01 10:38:11 +02:00
sebres 134c33cc6d fail2ban-testcases: added option "--ignore": negate [regexps] filter, to ignore tests matched specified regexps 2015-12-29 19:00:51 +01:00
sebres cf3cf27fa3 - filtering of test cases extended for method additionally to class (matches method only not whole class for regexp matched method name);
- new options for "fail2ban-testcases" introduced: "-g" or "--no-gamin" and "-m" or "--memory-db", both are true also if "-f" or "--fast" specified,
  for example: `fail2ban-testcases -ngm` will runs faster (because no network, no gamin, memory database)
  but will use the same default sleep intervals as in production (in comparison to -nf);
- seekToTime rewritten, accuracy increased by seekToTime, extended for all FileFilter (PyInotify, Gamin also), test cases extended etc.
- common performance optimized and code reviewed;
2015-12-29 12:49:30 +01:00
sebres 59bf5013c0 - performance of fail2ban optimized
-- cache dnsToIp, ipToName to prevent long wait during retrieving of ip/name for wrong dns or lazy dns-system;
   -- instead of simple "sleep" used conditional wait "wait_for", that internal increases sleep interval up to sleeptime;
   -- ticket / banmanager / failmanager modules are performance optimized;
   -- api of filter (log files), jail, etc. rewritten and extended for performance purposes;
- performance of test cases optimized:
   -- added option "--fast" to decrease wait intervals, avoid passive waiting, and skip few very slow test cases;
- code review after partially cherry pick of branch 'ban-time-incr' (see gh-716)
   -- ticket module prepared to easy merge with newest version of 'ban-time-incr', now additionally holds banTime, banCount and json-data;
   -- executeCmd partially moved from action to new module utils, etc.
   -- python 2.6 compatibility;
- testExecuteTimeoutWithNastyChildren: test case repaired - wait for pid file inside bash, kill tree in any case (gh-1155);
- testSocket: test case repaired - wait for server thread starts a socket (listener)
2015-12-29 12:49:19 +01:00
sebres 38f09b417a fail2ban-regex command line (after fail2ban-regex functionality moved to the client) 2015-11-10 13:26:34 +01:00
sebres 0877d66228 fail2ban-regex moved to the client + test cases for initial coverage added 2015-11-10 11:46:19 +01:00
sebres a42aa726ab fixed fail2ban-regex reads invalid character (in sense of given encoding); continuing to process line ignoring invalid characters (still has no test cases).
filter test cases added for same issue inside fail2ban-server / fail2ban-testcases;
closes gh-1248
2015-11-09 20:47:15 +01:00
sebres 81e659b760 performance fix: minimizes connection overhead, using same socket by multiple commands without close it (ex.: 'start' sends several hundreds commands at once) 2015-07-06 12:23:53 +02:00
Lee Clemens 77f5983b42 Test permissions to socket for detailed errors if socket.error raised 2015-07-04 12:35:56 -04:00
Lee Clemens c7e203b20f Fix PEP8 E401 - multiple imports on one line 2015-07-03 13:02:50 -04:00
Steven Hiscocks 0c869910ea BF: Fix fail2ban-regex not parsing journalmatch correctly 2015-05-09 10:26:14 +01:00
sebres 74c6f6ac4b BF: fail2ban-regex does not read '.local' file of given filter (gh-954) 2015-02-13 15:36:00 +01:00
Yaroslav Halchenko caa6006a31 ENH: do use @staticmethod (we are well beyond support of 2.4 now) 2014-10-25 09:25:18 -04:00
sebres 73a06d55a8 reset share/cache storage (if we use 'reload' in client with interactive mode) 2014-10-10 18:50:24 +02:00
Yaroslav Halchenko 602239051b BF: reincarnated import of logging (used to obtain level constants) 2014-06-22 10:56:50 -04:00
Steven Hiscocks 2d54161696 Merge branch 'kwirk/harmonize-log-msgs'
Conflicts:
	ChangeLog - Keep all additions
2014-06-22 12:57:49 +01:00
Steven Hiscocks 4fc7f1a831 ENH: Tweak naming of getF2BLogger, and ensure consistent use 2014-06-10 20:36:19 +01:00
Steven Hiscocks e8131475cd ENH: Realign and harmonise log messages with getF2BLogger helper 2014-06-09 22:17:00 +01:00
Yaroslav Halchenko eb2487986c ENH: minor -- print time which was used to process lines 2014-05-15 21:17:43 -04:00
Yaroslav Halchenko 3471f13a84 Merge pull request #700 from kwirk/format-traceback-to-helpers
ENH: Move traceback formatter to from tests.utils to helpers
2014-05-07 09:09:01 -04:00
Yaroslav Halchenko 1e19bca28e Merge pull request #704 from CameronNemo/foreground-opt-client
Add an option in fail2ban-client to pass the foreground option to the server
2014-05-01 13:14:06 -04:00
Steven Hiscocks 7cc64a14e0 BF: fail2ban-regex assertion error caused by miscounted "missed" lines
Caused when removing lines as part of multiline regex, which had been
previously considered missed.
2014-04-27 13:27:11 +01:00
Cameron Norman 73cb3e3eec Added more specific help message to fail2ban-client with -f option 2014-04-22 20:20:07 -07:00
Cameron Norman 7818b0cb2a Added f and b to cmdOpts.
f = start server in foreground; b = start server in background (default).
2014-04-20 16:03:04 -07:00
Cameron Norman 9c2a0cb403 Added foreground and background options to fail2ban-client 2014-04-20 11:37:07 -07:00
Steven Hiscocks 6a740f684a ENH: Move traceback formatter to from tests.utils to helpers
Now allows for tests to be removed from package if desired
2014-04-18 23:27:30 +01:00
Hank Leininger 2d42b46a7c
Add a --print-all-matched option.
The default behavior, to not print any matched lines, is unchanged.
2014-03-17 00:50:04 -04:00
Steven Hiscocks e193e67718 BF: fail2ban-regex mix of tabs and spaces 2014-03-16 18:25:16 +00:00
Daniel Black aa7e8fb9ce DOC: Credits. close gh-644 2014-03-14 22:30:44 +11:00
Steven Hiscocks 5630c56c75 ENH: Change logging levels and make info more verbose 2014-02-20 23:01:40 +00:00
Steven Hiscocks f68d85a6ac Merge branch 'master' into 0.9
Conflicts:
	ChangeLog
                Spelling correction of 0.8.13 fixed in master
	config/jail.conf
                Added nagios and duplicate php-url removal in master
                Just nagios added, duplicate not issue in 0.9
2014-02-13 20:14:40 +00:00
Daniel Black cc1a9cc45d BF: match up fail2ban-regex for datedetector/datetemplate changes 2014-01-28 06:59:01 +11:00
Daniel Black a650178bd1 MRG: merge from master 2014-01-19 2014-01-19 14:48:29 +11:00
Daniel Black 95add8a1c5 BF: datepattern handling in fail2ban-regex 2014-01-06 09:55:53 +11:00
Daniel Black 58a5983367 ENH: fix fail2ban-regex for filter arguement substition 2014-01-02 10:03:14 +11:00
Steven Hiscocks c80297045e ENH: Pass date time straight from systemd backend
Removes need to reparse the date time back from the ISO format
2013-12-28 18:02:16 +00:00
Daniel Black 7c0efc8ec8 MRG: merge so far - flushLogs not working yet 2013-12-16 15:08:34 +00:00
Steven Hiscocks 06a7b6534e DOC: Correct use of tab to spaces in fail2ban-regex help message 2013-12-14 17:21:56 +00:00
Steven Hiscocks d9afcc178a MINOR: PEP-8 tweaks for multiline-matches change set 2013-12-13 16:38:26 +00:00
Steven Hiscocks 60d298d898 BF: fail2ban-regex erroneously reporting multiple regexs had matched 2013-12-04 23:36:45 +00:00
Steven Hiscocks c886414e2e ENH+BF: Capture multiline matched lines into fail ticket
Previously only the last line of the match was being saved, not all
lines involved in matching.

Log lines are now broken into 3 part tuple, with the line pre-datetime,
the datetime, and post-datetime. Allows reformation of full line, but
also use of the line without the datetime present.
Attempting to use the term "tupleLine(s)" where possible, to avoid
confusion with normal read lines.

May also wish to consider that regexs could be made to capture more
lines of interest if some form of unique reference is available. This
may allow more lines of interest to be captured, which may not be picked
up by the traditional "grep <ip>" approach i.e. ones which do not have
the ip address in.

This also simplified the fail2ban-regex statistics for missed lines.
Also resolved bug with missed lines time extracted for debuggex having
some lines present which were captured in a multiline regex.
Also resolved independent issue with ignored line check including the
datetime, which raised assertion error in the rare case the datetime
matched the ignore regex, and the rest of line only matched a failregex
2013-12-04 22:26:22 +00:00