Fail2Ban v0.11.2 Release Notes
Release Date: 2020-11-23 // over 4 years ago-
Compatibility:
- to v.0.10:
- 0.11 is totally compatible to 0.10 (configuration- and API-related stuff), but the database got some new tables and fields (auto-converted during the first start), so once updated to 0.11, you have to remove the database /var/lib/fail2ban/fail2ban.sqlite3 (or its different to 0.10 schema) if you would need to downgrade to 0.10 for some reason.
to v.0.9:
- Filter (or
failregex
) internal capture-groups: - If you've your own
failregex
or custom filters using conditional match(?P=host)
, you should rewrite the regex like in example below resp. using(?:(?P=ip4)|(?P=ip6)
instead of(?P=host)
(or(?:(?P=ip4)|(?P=ip6)|(?P=dns))
corresponding yourusedns
andraw
settings).
Of course you can always define your own capture-group (like below
_cond_ip_
) to do this.testln="1500000000 failure from 192.0.2.1: bad host 192.0.2.1" fail2ban-regex "$testln" "^\s*failure from (?P<_cond_ip_><HOST>): bad host (?P=_cond_ip_)$"
- New internal groups (currently reserved for internal usage):
ip4
,ip6
,dns
,fid
,fport
, additionallyuser
and another captures in lower case if mapping from tag<F-*>
used in failregex (e. g.user
by<F-USER>
). - v.0.10 and 0.11 use more precise date template handling, that can be theoretically incompatible to some
user configurations resp.
datepattern
. - Since v0.10 fail2ban supports the matching of IPv6 addresses, but not all ban actions are IPv6-capable now.
- Filter (or
๐ Fixes
- [stability] prevent race condition - no ban if filter (backend) is continuously busy if too many messages will be found in log, e. g. initial scan of large log-file or journal (gh-2660)
- ๐ฒ pyinotify-backend sporadically avoided initial scanning of log-file by start
- ๐ท python 3.9 compatibility (and Travis CI support)
- ๐ restoring a large number (500+ depending on files ulimit) of current bans when using PyPy fixed
- โช manual ban is written to database, so can be restored by restart (gh-2647)
jail.conf
: don't specifyaction
directly in jails (useaction_
orbanaction
instead)- 0๏ธโฃ no mails-action added per default anymore (e. g. to allow that
action = %(action_mw)s
should be specified per jail or in default section in jail.local), closes gh-2357 - ensure we've unique action name per jail (also if parameter
actname
is not set but name deviates from standard name, gh-2686) - don't use
%(banaction)s
interpolation because it can be complex value (containing[...]
and/or quotes), so would bother the action interpolation - ๐ fixed type conversion in config readers (take place after all interpolations get ready), that allows to specify typed parameters variable (as substitutions) as well as to supply it in other sections or as init parameters.
action.d/*-ipset*.conf
: several ipset actions fixed (no timeout per default anymore), so no discrepancy between ipset and fail2ban (removal from ipset will be managed by fail2ban only, gh-2703)- ๐
action.d/cloudflare.conf
: fixedactionunban
(considering new-line chars and optionally real json-parsing withjq
, gh-2140, gh-2656) - ๐
action.d/nftables.conf
(type=multiport only): fixed port range selector, replacing:
with-
(gh-2763) - ๐
action.d/firewallcmd-*.conf
(multiport only): fixed port range selector, replacing:
with-
(gh-2821) action.d/bsd-ipfw.conf
: fixed selection of rule-no by large list or initiallowest_rule_num
(gh-2836)filter.d/common.conf
: avoid substitute of default values in relatedlt_*
section,__prefix_line
should be interpolated in definition section (inside the filter-config, gh-2650)filter.d/dovecot.conf
:- add managesieve and submission support (gh-2795);
- accept messages with more verbose logging (gh-2573);
- ๐ฒ
filter.d/courier-smtp.conf
: prefregex extended to consider port in log-message (gh-2697) filter.d/traefik-auth.conf
: filter extended with parameter mode (normal
,ddos
,aggressive
) to handle the match of username differently (gh-2693):normal
: matches 401 with supplied username onlyddos
: matches 401 without supplied username onlyaggressive
: matches 401 and any variant (with and without username)
filter.d/sshd.conf
: normalizing of user pattern in all RE's, allowing empty user (gh-2749)
๐ New Features and Enhancements
- fail2ban-regex:
- speedup formatted output (bypass unneeded stats creation)
- extended with prefregex statistic
- more informative output for
datepattern
(e. g. set from filter) - pattern : description
- ๐ parsing of action in jail-configs considers space between action-names as separator also
(previously only new-line was allowed), for example
action = a b
would specify 2 actionsa
andb
- ๐ new filter and jail for GitLab recognizing failed application logins (gh-2689)
- ๐ new filter and jail for Grafana recognizing failed application logins (gh-2855)
- ๐ new filter and jail for SoftEtherVPN recognizing failed application logins (gh-2723)
- ๐ง
filter.d/guacamole.conf
extended withlogging
parameter to follow webapp-logging if it's configured (gh-2631) - ๐
filter.d/bitwarden.conf
enhanced to support syslog (gh-2778) - introduced new prefix
{UNB}
fordatepattern
to disable word boundaries in regex; - datetemplate: improved anchor detection for capturing groups
(^...)
; - datepattern: improved handling with wrong recognized timestamps (timezones, no datepattern, etc)
as well as some warnings signaling user about invalid pattern or zone (gh-2814):
- filter gets mode in-operation, which gets activated if filter starts processing of new messages;
in this mode a timestamp read from log-line that appeared recently (not an old line), deviating too much
from now (up too 24h), will be considered as now (assuming a timezone issue), so could avoid unexpected
bypass of failure (previously exceeding
findtime
); - better interaction with non-matching optional datepattern or invalid timestamps;
- implements special datepattern
{NONE}
- allow to find failures totally without date-time in log messages, whereas filter will use now as timestamp (gh-2802)
- filter gets mode in-operation, which gets activated if filter starts processing of new messages;
in this mode a timestamp read from log-line that appeared recently (not an old line), deviating too much
from now (up too 24h), will be considered as now (assuming a timezone issue), so could avoid unexpected
bypass of failure (previously exceeding
- ๐ performance optimization of
datepattern
(better search algorithm in datedetector, especially for single template); - fail2ban-client: extended to unban IP range(s) by subnet (CIDR/mask) or hostname (DNS), gh-2791;
- extended capturing of alternate tags in filter, allowing combine of multiple groups to single tuple token with new tag
prefix
<F-TUPLE_
, that would combine value of<F-V>
with all value of<F-TUPLE_V?_n?>
tags (gh-2755)
- to v.0.10:
Previous changes from v0.11.1
-
Compatibility:
- to v.0.10:
- 0.11 is totally compatible to 0.10 (configuration- and API-related stuff), but the database got some new tables and fields (auto-converted during the first start), so once updated to 0.11, you have to remove the database /var/lib/fail2ban/fail2ban.sqlite3 (or its different to 0.10 schema) if you would need to downgrade to 0.10 for some reason.
to v.0.9:
- Filter (or
failregex
) internal capture-groups: - If you've your own
failregex
or custom filters using conditional match(?P=host)
, you should rewrite the regex like in example below resp. using(?:(?P=ip4)|(?P=ip6)
instead of(?P=host)
(or(?:(?P=ip4)|(?P=ip6)|(?P=dns))
corresponding yourusedns
andraw
settings).
Of course you can always define your own capture-group (like below
_cond_ip_
) to do this.testln="1500000000 failure from 192.0.2.1: bad host 192.0.2.1" fail2ban-regex "$testln" "^\s*failure from (?P<_cond_ip_><HOST>): bad host (?P=_cond_ip_)$"
- New internal groups (currently reserved for internal usage):
ip4
,ip6
,dns
,fid
,fport
, additionallyuser
and another captures in lower case if mapping from tag<F-*>
used in failregex (e. g.user
by<F-USER>
). - v.0.10 and 0.11 use more precise date template handling, that can be theoretically incompatible to some
user configurations resp.
datepattern
. - Since v0.10 fail2ban supports the matching of IPv6 addresses, but not all ban actions are IPv6-capable now.
- Filter (or
๐ Fixes
- purge database will be executed now (within observer).
- ๐ restoring currently banned ip after service restart fixed (now < timeofban + bantime), ignore old log failures (already banned)
- โก๏ธ upgrade database: update new created table
bips
with entries from tablebans
(allows restore current bans after upgrade from version <= 0.10)
๐ New Features
- Increment ban time (+ observer) functionality introduced.
- Database functionality extended with bad ips.
- ๐ New tags (usable in actions):
<bancount>
- ban count of this offender if known as bad (started by 1 for unknown)<bantime>
- current ban-time of the ticket (prolongation can be retarded up to 10 sec.)
- โฑ Introduced new action command
actionprolong
to prolong ban-time (e. g. set new timeout if expected); Several actions (like ipset, etc.) rewritten using net logic withactionprolong
. Note: because ban-time is dynamic, it was removed from jail.conf as timeout argument (check jail.local).
โจ Enhancements
- โก๏ธ algorithm of restore current bans after restart changed: update the restored ban-time (and therefore end of ban) of the ticket with ban-time of jail (as maximum), for all tickets with ban-time greater (or persistent); not affected if ban-time of the jail is unchanged between stop/start.
- โ added new setup-option
--without-tests
to skip building and installing of tests files (gh-2287). - โ added new command
fail2ban-client get <JAIL> banip ?sep-char|--with-time?
to get the banned ip addresses (gh-1916).
- to v.0.10: