From eddd0d2f25673f011ea64440af1527b3ef27ec03 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 27 Mar 2019 15:12:27 +0100 Subject: [PATCH] fail2ban-regex: fixed usage of foreign filter path with relative filename (outside of config-base directory): avoid join filter filename with 'filter.d' --- fail2ban/client/fail2banregex.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fail2ban/client/fail2banregex.py b/fail2ban/client/fail2banregex.py index 87d359ba..19a9f74d 100644 --- a/fail2ban/client/fail2banregex.py +++ b/fail2ban/client/fail2banregex.py @@ -325,6 +325,8 @@ class Fail2banRegex(object): ## foreign file - readexplicit this file and includes if possible: output( "Use %11s file : %s" % (regex, fltName) ) basedir = None + if not os.path.isabs(fltName): # avoid join with "filter.d" inside FilterReader + fltName = os.path.abspath(fltName) if fltOpt: output( "Use filter options : %r" % fltOpt ) reader = FilterReader(fltName, 'fail2ban-regex-jail', fltOpt, share_config=self.share_config, basedir=basedir)