gods

a simple blocklist for ssh
Log | Files | Refs | README | LICENSE

commit 48123cd8c6a20947f46d21d5faa0cb3b8ae23b2e
parent 1a07419e1f524f91150dc146a2c13fcf3b0bd638
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Sun, 10 Oct 2021 13:38:37 +0200

Increment nban and unban GREY attackers only

Diffstat:
Mmain.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c @@ -25,9 +25,10 @@ SLIST_HEAD(lhead, attacker) head = SLIST_HEAD_INITIALIZER(head); void ban(struct attacker *a) { - a->nban++; if (a->list != GREY) return; + + a->nban++; if (fw_block(a->ip) && a->nban > 8) blacklist(a); @@ -44,7 +45,7 @@ unban(struct attacker *a, struct lhead *headp) } SLIST_FOREACH(ap, headp, attackers) - if (isexpire(ap)) + if (ap->list == GREY && isexpire(ap)) fw_unblock(ap->ip); }