Browse Source

* ban/match stats

master
Alex 'AdUser' Z 9 years ago
parent
commit
54f240e261
  1. 2
      src/jail.c
  2. 2
      src/jail.h

2
src/jail.c

@ -133,6 +133,7 @@ f2b_jail_ban(f2b_jail_t *jail, f2b_ipaddr_t *addr) {
} }
addr->bancount++; addr->bancount++;
addr->release_at = addr->banned_at + bantime; addr->release_at = addr->banned_at + bantime;
jail->bancount++;
if (f2b_backend_check(jail->backend, addr->text)) { if (f2b_backend_check(jail->backend, addr->text)) {
f2b_log_msg(log_warn, "jail '%s': ip %s was already banned", jail->name, addr->text); f2b_log_msg(log_warn, "jail '%s': ip %s was already banned", jail->name, addr->text);
@ -212,6 +213,7 @@ f2b_jail_process(f2b_jail_t *jail) {
if (!f2b_filter_match(jail->filter, logline, matchbuf, sizeof(matchbuf))) if (!f2b_filter_match(jail->filter, logline, matchbuf, sizeof(matchbuf)))
continue; continue;
/* some regex matches the line */ /* some regex matches the line */
jail->matchcount++;
addr = f2b_addrlist_lookup(jail->ipaddrs, matchbuf); addr = f2b_addrlist_lookup(jail->ipaddrs, matchbuf);
if (!addr) { if (!addr) {
/* new ip */ /* new ip */

2
src/jail.h

@ -22,6 +22,8 @@ typedef struct f2b_jail_t {
time_t findtime; time_t findtime;
time_t expiretime; time_t expiretime;
size_t maxretry; size_t maxretry;
size_t bancount;
size_t matchcount;
float incr_bantime; float incr_bantime;
float incr_findtime; float incr_findtime;
char name[CONFIG_KEY_MAX]; char name[CONFIG_KEY_MAX];

Loading…
Cancel
Save