mirror of https://github.com/fail2ban/fail2ban
BF: errors in a jail prevents further sections from being parsed. Closes #485
parent
b39729a2ab
commit
603095bc16
|
@ -60,6 +60,7 @@ class JailsReader(ConfigReader):
|
||||||
sections = [ section ]
|
sections = [ section ]
|
||||||
|
|
||||||
# Get the options of all jails.
|
# Get the options of all jails.
|
||||||
|
parse_status = True
|
||||||
for sec in sections:
|
for sec in sections:
|
||||||
jail = JailReader(sec, basedir=self.getBaseDir(),
|
jail = JailReader(sec, basedir=self.getBaseDir(),
|
||||||
force_enable=self.__force_enable)
|
force_enable=self.__force_enable)
|
||||||
|
@ -71,8 +72,8 @@ class JailsReader(ConfigReader):
|
||||||
self.__jails.append(jail)
|
self.__jails.append(jail)
|
||||||
else:
|
else:
|
||||||
logSys.error("Errors in jail %r. Skipping..." % sec)
|
logSys.error("Errors in jail %r. Skipping..." % sec)
|
||||||
return False
|
parse_status = False
|
||||||
return True
|
return parse_status
|
||||||
|
|
||||||
def convert(self, allow_no_files=False):
|
def convert(self, allow_no_files=False):
|
||||||
"""Convert read before __opts and jails to the commands stream
|
"""Convert read before __opts and jails to the commands stream
|
||||||
|
|
|
@ -215,9 +215,37 @@ class JailsReaderTest(LogCaptureTestCase):
|
||||||
['set', 'missinglogfiles', 'findtime', 600],
|
['set', 'missinglogfiles', 'findtime', 600],
|
||||||
['set', 'missinglogfiles', 'bantime', 600],
|
['set', 'missinglogfiles', 'bantime', 600],
|
||||||
['set', 'missinglogfiles', 'addfailregex', '<IP>'],
|
['set', 'missinglogfiles', 'addfailregex', '<IP>'],
|
||||||
|
['add', 'brokenaction', 'auto'],
|
||||||
|
['set', 'brokenaction', 'usedns', 'warn'],
|
||||||
|
['set', 'brokenaction', 'addlogpath', '/var/log/messages'],
|
||||||
|
['set', 'brokenaction', 'maxretry', 3],
|
||||||
|
['set', 'brokenaction', 'findtime', 600],
|
||||||
|
['set', 'brokenaction', 'bantime', 600],
|
||||||
|
['set', 'brokenaction', 'addfailregex', '<IP>'],
|
||||||
|
['set', 'brokenaction', 'addaction', 'brokenaction'],
|
||||||
|
['set',
|
||||||
|
'brokenaction',
|
||||||
|
'actionban',
|
||||||
|
'brokenaction',
|
||||||
|
'hit with big stick <ip>'],
|
||||||
|
['set', 'brokenaction', 'actionstop', 'brokenaction', ''],
|
||||||
|
['set', 'brokenaction', 'actionstart', 'brokenaction', ''],
|
||||||
|
['set', 'brokenaction', 'actionunban', 'brokenaction', ''],
|
||||||
|
['set', 'brokenaction', 'actioncheck', 'brokenaction', ''],
|
||||||
|
['add', 'parse_to_end_of_jail.conf', 'auto'],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'usedns', 'warn'],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'addlogpath', '/var/log/messages'],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'maxretry', 3],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'findtime', 600],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'bantime', 600],
|
||||||
|
['set', 'parse_to_end_of_jail.conf', 'addfailregex', '<IP>'],
|
||||||
['start', 'emptyaction'],
|
['start', 'emptyaction'],
|
||||||
['start', 'special'],
|
['start', 'special'],
|
||||||
['start', 'missinglogfiles']])
|
['start', 'missinglogfiles'],
|
||||||
|
['start', 'brokenaction'],
|
||||||
|
['start', 'parse_to_end_of_jail.conf'],])
|
||||||
|
self.assertTrue(self._is_logged("Errors in jail 'missingbitsjail'. Skipping..."))
|
||||||
|
self.assertTrue(self._is_logged("No file(s) found for glob /weapons/of/mass/destruction"))
|
||||||
|
|
||||||
|
|
||||||
def testReadStockJailConf(self):
|
def testReadStockJailConf(self):
|
||||||
|
|
Loading…
Reference in New Issue