fail2ban-regex: fixed usage of foreign filter path with relative filename (outside of config-base directory): avoid join filter filename with 'filter.d'

pull/2387/head
sebres 2019-03-27 15:12:27 +01:00
parent 0e5ce68d4c
commit eddd0d2f25
1 changed files with 2 additions and 0 deletions

View File

@ -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)