diff --git a/ChangeLog b/ChangeLog index ecb8cc87..c4444e2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ releases. uses "fail2ban-python" now); * Fixed test case "testSetupInstallRoot" for not default python version (also using direct call, out of virtualenv); +* Fixed ambiguous wrong recognized date pattern resp. its optional parts (see gh-1512); * `filter.d/ignorecommands/apache-fakegooglebot` - Fixed error within apache-fakegooglebot, that will be called with wrong python version (gh-1506) @@ -33,6 +34,8 @@ releases. ### New Features ### Enhancements +* DateTemplate regexp extended with the word-end boundary, additionally to + word-start boundary * Introduces new command "fail2ban-python", as automatically created symlink to python executable, where fail2ban currently installed (resp. its modules are located): - allows to use the same version, fail2ban currently running, e.g. in diff --git a/fail2ban/server/datetemplate.py b/fail2ban/server/datetemplate.py index 0a5ec55a..8e602289 100644 --- a/fail2ban/server/datetemplate.py +++ b/fail2ban/server/datetemplate.py @@ -72,8 +72,12 @@ class DateTemplate(object): regex : str The regex the template will use for searching for a date. wordBegin : bool - Defines whether the regex should be modified to search at - beginning of a word, by adding "\\b" to start of regex. + Defines whether the regex should be modified to search at beginning of a + word, by adding special boundary r'(?=^|\b|\W)' to start of regex. + Default True. + wordEnd : bool + Defines whether the regex should be modified to search at end of a word, + by adding special boundary r'(?=\b|\W|$)' to end of regex. Default True. Raises