mirror of https://github.com/fail2ban/fail2ban
code review
parent
ccf07c4b21
commit
ccacfc1047
|
@ -93,7 +93,7 @@ class JailReader(ConfigReader):
|
|||
["int", "maxretry", None],
|
||||
["int", "findtime", None],
|
||||
["int", "bantime", None],
|
||||
["bool", "bantimeextra.enabled", False],
|
||||
["bool", "bantimeextra.enabled", None],
|
||||
["string", "bantimeextra.findtime", None],
|
||||
["string", "bantimeextra.factor", None],
|
||||
["string", "bantimeextra.formula", None],
|
||||
|
|
|
@ -248,8 +248,9 @@ class Actions(JailThread, Mapping):
|
|||
be[opt] = value;
|
||||
logSys.info('Set banTimeExtra.%s = %s', opt, value)
|
||||
if opt == 'enabled':
|
||||
be[opt] = bool(value)
|
||||
if bool(value) and self._jail.database is None:
|
||||
if isinstance(value, str):
|
||||
be[opt] = value.lower() in ("yes", "true", "ok", "1")
|
||||
if be[opt] and self._jail.database is None:
|
||||
logSys.warning("banTimeExtra is not available as long jail database is not set")
|
||||
if opt in ['findtime', 'maxtime', 'rndtime']:
|
||||
if not value is None:
|
||||
|
@ -346,7 +347,7 @@ class Actions(JailThread, Mapping):
|
|||
ip=ip, jail=self._jail).getAttempt())
|
||||
try:
|
||||
# if ban time was not set:
|
||||
if bTicket.getBanTime() is None:
|
||||
if not ticket.getRestored() and bTicket.getBanTime() is None:
|
||||
btime = self.incrBanTime(bTicket, ip)
|
||||
bTicket.setBanTime(btime);
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue