Browse Source

* f2b_jail_process() : logic tune

master
Alex 'AdUser' Z 4 years ago
parent
commit
c87ae073a9
  1. 7
      src/jail.c

7
src/jail.c

@ -339,7 +339,7 @@ f2b_jail_process(f2b_jail_t *jail) {
f2b_jail_evt_match(jail->name, addr, match); f2b_jail_evt_match(jail->name, addr, match);
/* host is banned? */ /* host is banned? */
if (addr->banned) { if (addr->banned) {
if (addr->banned_at != now) if (addr->banned_at > (now - 5))
f2b_log_msg(log_warn, "jail '%s': ip %s was already banned", jail->name, matchbuf); f2b_log_msg(log_warn, "jail '%s': ip %s was already banned", jail->name, matchbuf);
continue; continue;
} }
@ -348,12 +348,11 @@ f2b_jail_process(f2b_jail_t *jail) {
f2b_matches_expire(&addr->matches, now - findtime - 600); f2b_matches_expire(&addr->matches, now - findtime - 600);
/* ...so, check host score */ /* ...so, check host score */
score = f2b_matches_score(&addr->matches, findtime); score = f2b_matches_score(&addr->matches, findtime);
if (score < jail->banscore) {
f2b_log_msg(log_info, "jail '%s': new match for ip %s (%u/%u)", f2b_log_msg(log_info, "jail '%s': new match for ip %s (%u/%u)",
jail->name, matchbuf, score, jail->banscore); jail->name, matchbuf, score, jail->banscore);
if (score < jail->banscore)
continue; /* lucky bastard */ continue; /* lucky bastard */
} /* else: score limit reached, ban ip */
/* score limit reached, ban ip */
f2b_jail_ban(jail, addr); f2b_jail_ban(jail, addr);
if (jail->flags & JAIL_HAS_STATE) if (jail->flags & JAIL_HAS_STATE)
jail->sfile->need_save = true; jail->sfile->need_save = true;

Loading…
Cancel
Save