waf: ban the clients on AbuseIPDB's blacklist (closes #411)
check / check (push) Failing after 8m52s

While SWW_WAF_ABUSEIPDB_KEY is set, waf fetches AbuseIPDB's blacklist at
the start and every SWW_WAF_ABUSEIPDB_BLACKLIST_REFRESH_INTERVAL_MINS
(60), cut at SWW_WAF_ABUSEIPDB_THRESHOLD (90, from 25 to 100). Each
listed client's netblock gets a ban of SWW_WAF_ABUSEIPDB_BAN_DAYS (30)
with the new cause abuseipdb. The blacklist itself is not kept.

These bans do not count toward SWW_WAF_MAX_BANS, so a 10,000-address
blacklist cannot push out the bans for limits and attacks. An ended
abuseipdb ban is forgotten at each fetch and each read of bans.json. A
netblock with an active ban is left alone, and so is one whose abuseipdb
ban an admin lifted, until that ban would have ended. Observe mode makes
no ban.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-19 10:03:42 +00:00
1 parent 9f42460f70
commit dfffeb73ec
22 files changed
+1304 -205

No files matched your search

+7 -1
View File
@@ -284,6 +284,7 @@ func newServer(
Alerts: alertQueue,
BesideLookupTimeLimit: besideLookupTimeLimit,
AbuseIPDBBlacklistURL: reputation.AbuseIPDBBlacklistURL,
})
server.Metrics.AddAlerts(alertQueue)
@@ -383,7 +384,8 @@ func startSending(
// serve serves requests on listener, writes the state and cache files as they
// are due, takes in an admin's edits of them, reads the rule files again as
// they change, and the lookup database when it is replaced, fetches the
// lists the settings name by URL as they are due, and sends the alerts,
// lists the settings name by URL as they are due, bans the clients on
// AbuseIPDB's blacklist as it is fetched, and sends the alerts,
// until ctx is done. Then it gives the requests in progress
// shutdownTimeout to finish, and writes every state and cache file,
// alerts.json with the alerts still waiting.
@@ -410,6 +412,9 @@ func serve(
}
})
listsFetched := inBackground(func() { server.Lists.Run(writing) })
blacklistFetched := inBackground(func() {
server.AbuseIPDB.RunBlacklist(writing)
})
alertsSent := inBackground(func() { alertQueue.Run(writing) })
select {
@@ -452,6 +457,7 @@ func serve(
<-rulesWatched
<-lookupFileWatched
<-listsFetched
<-blacklistFetched
<-alertsSent
err = files.WriteAll()