From fa727586ff5f21898d50ad4931b2b777576023ae Mon Sep 17 00:00:00 2001 From: chtheis Date: Mon, 10 Dec 2018 17:11:41 +0000 Subject: [PATCH 1/3] Fix grep pattern to deal with Apache's error log Apache's error log appends the port to the IP address, other logs don't. --- config/action.d/helpers-common.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/action.d/helpers-common.conf b/config/action.d/helpers-common.conf index b036f68f..195de60d 100644 --- a/config/action.d/helpers-common.conf +++ b/config/action.d/helpers-common.conf @@ -5,7 +5,7 @@ # (printf %%b "Log-excerpt contains 'test':\n"; %(_grep_logs)s; printf %%b "Log-excerpt contains 'test':\n") | mail ... # _grep_logs = logpath=""; grep -E %(_grep_logs_args)s $logpath | -_grep_logs_args = "(^|[^0-9a-fA-F:])$(echo '' | sed 's/\./\\./g')([^0-9a-fA-F:]|$)" +_grep_logs_args = "(^|[^0-9a-fA-F:])$(echo '' | sed 's/\./\\./g')(:\d{1,5})?([^0-9a-fA-F:]|$)" # Used for actions, that should not by executed if ticket was restored: _bypass_if_restored = if [ '' = '1' ]; then exit 0; fi; From d8d71c5a22d58ff5ddb9e8cf59d0e72465cc31c3 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 10 May 2019 16:17:13 +0200 Subject: [PATCH 2/3] action.d/helpers-common.conf: grep arguments are rewritten - using options `-wF` to match only whole words and fixed string (not as pattern) --- config/action.d/helpers-common.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/action.d/helpers-common.conf b/config/action.d/helpers-common.conf index 195de60d..03422a87 100644 --- a/config/action.d/helpers-common.conf +++ b/config/action.d/helpers-common.conf @@ -4,8 +4,9 @@ # _grep_logs_args = 'test' # (printf %%b "Log-excerpt contains 'test':\n"; %(_grep_logs)s; printf %%b "Log-excerpt contains 'test':\n") | mail ... # -_grep_logs = logpath=""; grep -E %(_grep_logs_args)s $logpath | -_grep_logs_args = "(^|[^0-9a-fA-F:])$(echo '' | sed 's/\./\\./g')(:\d{1,5})?([^0-9a-fA-F:]|$)" +_grep_logs = logpath=""; grep %(_grep_logs_args)s $logpath | +# options `-wF` used to match only whole words and fixed string (not as pattern) +_grep_logs_args = -wF "" # Used for actions, that should not by executed if ticket was restored: _bypass_if_restored = if [ '' = '1' ]; then exit 0; fi; From 4d08bc4ad5a75198b86c1c74e6a47e237ff35429 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 10 May 2019 16:22:25 +0200 Subject: [PATCH 3/3] update ChangeLog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2f449c8e..8e45cd7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,8 @@ ver. 0.10.5-dev-1 (20??/??/??) - development edition ### Fixes * fixed read of included config-files (`.local` overwrites options of `.conf` for config-files included with before/after) +* `action.d/helpers-common.conf`: rewritten grep arguments, now options `-wF` used to match only + whole words and fixed string (not as pattern), gh-2298 * `filter.d/sshd.conf`: - captures `Disconnecting ...: Change of username or service not allowed` (gh-2239, gh-2279) - captures `Disconnected from ... [preauth]` (`extra`/`aggressive` mode and preauth phase only, gh-2239, gh-2279)