diff --git a/.gitignore b/.gitignore index 76a33e60..a8942050 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ htmlcov *.rej *.bak __pycache__ +.vagrant/ diff --git a/.travis.yml b/.travis.yml index 9a92a7f6..bd2d294c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ install: - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then cd ..; pip install -q coveralls; cd -; fi script: - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then coverage run --rcfile=.travis_coveragerc setup.py test; else python setup.py test; fi +# test installation + - sudo python setup.py install after_success: # Coverage config file must be .coveragerc for coveralls - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then cp -v .travis_coveragerc .coveragerc; fi diff --git a/ChangeLog b/ChangeLog index bdae885c..ad92a55e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ ver. 0.9.1 (2014/xx/xx) - better, faster, stronger provides defaults for the chain, port, protocol and name tags - Fixes: + * start of file2ban aborted (on slow hosts, systemd considers the server has + been timed out and kills him), see gh-824 + * UTF-8 fixes in pure-ftp thanks to Johannes Weberhofer. Closes gh-806. * systemd backend error on bad utf-8 in python3 * badips.py action error when logging HTTP error raised with badips request * fail2ban-regex failed to work in python3 due to space/tab mix @@ -36,18 +39,48 @@ ver. 0.9.1 (2014/xx/xx) - better, faster, stronger Thanks Serg G. Brester * Correct times for non-timezone date times formats during DST * Pass a copy of, not original, aInfo into actions to avoid side-effects + * Per-distribution paths to the exim's main log + * Ignored IPs are no longer banned when being restored from persistent + database + * Manually unbanned IPs are now removed from persistent database, such they + wont be banned again when Fail2Ban is restarted + * Pass "bantime" parameter to the actions in default jail's action + definition(s) + * filters.d/sieve.conf - fixed typo in _daemon. Thanks Jisoo Park + * cyrus-imap -- also catch also failed logins via secured (imaps/pop3s). + Regression was introduced while strengthening failregex in 0.8.11 (bd175f) + Debian bug #755173 + * postfix-sasl - added journalmatch. Thanks Luc Maisonobe + * postfix* - match with a new daemon string (postfix/submission/smtpd). + Closes gh-804 . Thanks Paul Traina + * apache - added filter for AH01630 client denied by server configuration. - New features: - - Added monit filter thanks Jason H Martin. + - New filters: + - monit Thanks Jason H Martin + - directadmin Thanks niorg + - apache-shellshock Thanks Eugene Hopkinson (SlowRiot) + - New actions: + - symbiosis-blacklist-allports for Bytemark symbiosis firewall + - fail2ban-client can fetch the running server version + - Added Cloudflare API action - Enhancements + * Start performance of fail2ban-client (and tests) increased, start time + and cpu usage rapidly reduced. Introduced a shared storage logic, to + bypass reading lots of config files (see gh-824). + Thanks to Joost Molenaar for good catch (reported gh-820). * Fail2ban-regex - add print-all-matched option. Closes gh-652 * Suppress fail2ban-client warnings for non-critical config options * Match non "Bye Bye" disconnect messages for sshd locked account regex + * courier-smtp filter: + - match lines with user names + - match lines containing "535 Authentication failed" attempts * Add tag to iptables-ipsets * Realign fail2ban log output with white space to improve readability. Does not affect SYSLOG output * Log unhandled exceptions + * cyrus-imap: catch "user not found" attempts ver. 0.9.0 (2014/03/14) - beta ---------- diff --git a/DEVELOP b/DEVELOP index f1426561..1384a6ac 100644 --- a/DEVELOP +++ b/DEVELOP @@ -81,6 +81,18 @@ some quick commands:: status test +Testing with vagrant +-------------------- + +Testing can now be done inside a vagrant VM. Vagrantfile provided in +source code repository established two VMs: + +- VM "secure" which can be used for testing fail2ban code. +- VM "attacker" which hcan be used to perform attack against our "secure" VM. + +Both VMs are sharing the 192.168.200/24 network. If you are using this network +take a look into the Vagrantfile and change the IP. + Coding Standards ================ diff --git a/THANKS b/THANKS index 5752c475..61e99466 100644 --- a/THANKS +++ b/THANKS @@ -26,6 +26,7 @@ Christian Rauch Christophe Carles Christoph Haas Christos Psonis +craneworks Cyril Jaquier Daniel B. Cid Daniel B. @@ -34,6 +35,7 @@ David Nutter Derek Atkins Eric Gerbier Enrico Labedzki +Eugene Hopkinson (SlowRiot) ftoppi François Boulogne Frédéric @@ -44,11 +46,13 @@ Hank Leininger Hanno 'Rince' Wagner Helmut Grohne Iain Lea +Ioan Indreias Ivo Truxa John Thoe Jacques Lav!gnotte -Ioan Indreias +Johannes Weberhofer Jason H Martin +Jisoo Park Joel M Snyder Jonathan Kamens Jonathan Lanning @@ -62,6 +66,7 @@ kjohnsonecl kojiro Lars Kneschke Lee Clemens +leftyfb (Mike Rushton) Manuel Arostegui Ramirez Marcel Dopita Mark Edgington @@ -78,8 +83,10 @@ Mika (mkl) Nick Munger onorua Paul Marrapese +Paul Traina Noel Butler Patrick Börjesson +Pressy Raphaël Marichez RealRancor René Berber @@ -88,6 +95,7 @@ Rolf Fokkens Roman Gelfand Russell Odom SATO Kentaro +Sean DuBois Sebastian Arcus Serg G. Brester Sireyessire diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..120ffd7f --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,30 @@ +Vagrant.configure("2") do |config| + + config.vm.define "secure" do |secure| + secure.vm.box = "ubuntu/trusty64" + secure.vm.hostname = "secure.dev.fail2ban.org" + secure.vm.network "private_network", ip: "192.168.200.100" + +# secure.vm.synced_folder 'salt/roots', '/srv/salt' + +# secure.vm.provision :salt do |salt| +# salt.minion_config = 'salt/minion' +# salt.run_highstate = true +# salt.verbose = true +# end + end + + config.vm.define "attacker" do |attacker| + attacker.vm.box = "ubuntu/trusty64" + attacker.vm.hostname = "attacker.dev.fail2ban.org" + attacker.vm.network "private_network", ip: "192.168.200.150" + +# attacker.vm.synced_folder 'salt/roots', '/srv/salt' + +# attacker.vm.provision :salt do |salt| +# salt.minion_config = 'salt/minion' +# salt.run_highstate = true +# salt.verbose = true +# end + end +end diff --git a/bin/fail2ban-client b/bin/fail2ban-client index 89e0a903..866a5287 100755 --- a/bin/fail2ban-client +++ b/bin/fail2ban-client @@ -409,6 +409,7 @@ class Fail2banClient: # TODO: get away from stew of return codes and exception # handling -- handle via exceptions try: + self.__configurator.Reload() self.__configurator.readAll() ret = self.__configurator.getOptions(jail) self.__configurator.convertToProtocol() @@ -418,12 +419,11 @@ class Fail2banClient: ret = False return ret - #@staticmethod + @staticmethod def dumpConfig(cmd): for c in cmd: print c return True - dumpConfig = staticmethod(dumpConfig) class ServerExecutionException(Exception): diff --git a/config/action.d/cloudflare.conf b/config/action.d/cloudflare.conf new file mode 100644 index 00000000..4d5e2dc8 --- /dev/null +++ b/config/action.d/cloudflare.conf @@ -0,0 +1,55 @@ +# +# Author: Mike Rushton +# +# Referenced from from http://www.normyee.net/blog/2012/02/02/adding-cloudflare-support-to-fail2ban by NORM YEE +# +# To get your Cloudflare API key: https://www.cloudflare.com/my-account +# + +[Definition] + +# Option: actionstart +# Notes.: command executed once at the start of Fail2Ban. +# Values: CMD +# +actionstart = + +# Option: actionstop +# Notes.: command executed once at the end of Fail2Ban +# Values: CMD +# +actionstop = + +# Option: actioncheck +# Notes.: command executed once before each actionban command +# Values: CMD +# +actioncheck = + +# Option: actionban +# Notes.: command executed when banning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: IP address +# number of failures +#