fix: forge browsing, verified crawlers, ban feedback loop, coverage metrics and slow-attacker policy (1.6.0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 20:26:56 -03:00
1 parent 393a31cebe
commit 54b9ae65cd
23 files changed
+802 -100

No files matched your search

+14 -5
View File
@@ -38,14 +38,19 @@ func newEnforce(c Config, st *store.Store, peers []fed.Peer, en enricher, ready
Mode: mode, Path: c.EnforceLog, UnbanPath: unbanLogPath(c), StatePath: filepath.Join(c.DataDir, "enforce.json"), Host: c.Name,
Threshold: c.EnforceThreshold, MaxPerMin: c.EnforceMaxPerMin, Share: strings.EqualFold(c.EnforceShare, "on"),
Trusted: trusted, PeerHosts: hosts, InfraHosts: hosts, Resolve: resolveHost,
Crawler: func(ip string, uas []string) bool { v := st.FCrDNS(ip, uas); return v != nil && *v },
Rep: st.Reputation,
Tally: func(ip string, from int64) (int, int) { t := st.AttackTally(ip, from); return t.SSH, t.Web },
Crawler: func(ip string, uas []string) bool {
if v := st.FCrDNS(ip, uas); v != nil && *v {
return true
}
return st.VerifiedCrawler(ip) // forward-confirmed rDNS excludes it whatever the User-Agent says
},
Rep: st.Reputation,
Tally: func(ip string, from int64) enforce.Tally { return tallyOf(st.AttackTally(ip, from)) },
Roster: func(from int64) []enforce.Seen {
rows := st.AttackRoster(from)
out := make([]enforce.Seen, len(rows))
for i, r := range rows {
out[i] = enforce.Seen{IP: r.IP, Score: r.Score, Level: r.Level, Jails: r.Jails, Est: enforce.Tally{SSH: r.Est.SSH, Web: r.Est.Web}}
out[i] = enforce.Seen{IP: r.IP, Score: r.Score, Level: r.Level, Jails: r.Jails, Events: r.Events, Last: r.Last, Est: tallyOf(r.Est)}
}
return out
},
@@ -53,7 +58,7 @@ func newEnforce(c Config, st *store.Store, peers []fed.Peer, en enricher, ready
m := st.AttackTallies(from)
out := make(map[string]enforce.Tally, len(m))
for k, v := range m {
out[k] = enforce.Tally{SSH: v.SSH, Web: v.Web}
out[k] = tallyOf(v)
}
return out
},
@@ -203,3 +208,7 @@ func unbanLogPath(c Config) string {
}
return filepath.Join(filepath.Dir(c.EnforceLog), "unban.log")
}
func tallyOf(t store.Tally24) enforce.Tally {
return enforce.Tally{SSH: t.SSH, Web: t.Web, Probe: t.Probe, SSH7: t.SSH7, Web7: t.Web7, Probe7: t.Probe7}
}
+1 -1
View File
@@ -2,4 +2,4 @@ package app
// Version is the release version (SemVer). Release builds may override it with
// -ldflags "-X .../internal/app.Version=...".
var Version = "1.5.7"
var Version = "1.6.0"