Files
smallwebwaf/internal/waf/export_test.go
T
clawbot e1ed444e68
check / check (push) Failing after 6m25s
waf: ban the clients on AbuseIPDB's blacklist (closes #411)
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. Each fetch
forgets the abuseipdb bans that have ended. 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
2026-11-19 07:59:24 +00:00

25 lines
757 B
Go

package waf
import (
"time"
"sneak.berlin/go/smallwebwaf/internal/reputation"
)
// BesideLookupTimeLimit is besideLookupTimeLimit.
const BesideLookupTimeLimit = besideLookupTimeLimit
// SetBesideLookupTimeLimit gives the heuristics of besideLookup limit on s in
// place of besideLookupTimeLimit.
func (s *Server) SetBesideLookupTimeLimit(limit time.Duration) {
h := s.Handler.(*handler) //nolint:forcetypeassert // New makes it one
h.besideLookupLimit = limit
}
// BanAbuseIPDBBlacklist does on s what a fetch of AbuseIPDB's blacklist with
// the clients on listed does.
func (s *Server) BanAbuseIPDBBlacklist(listed []reputation.Listed) {
h := s.Handler.(*handler) //nolint:forcetypeassert // New makes it one
h.banAbuseIPDBBlacklist(listed)
}