Commit graph

2 commits

Author SHA1 Message Date
bcae8901c6
fix: never ban a trusted proxy network from any ban source
The gateway already refused to ban addresses from proxy_protocol.trusted_cidrs,
but the traffic-intelligence auto-ban and the subnet monitor still did, so a
trusted load balancer living inside a banned /24 (or below the reputation
threshold) could be knocked out together with its clients.

- TrustedProxyCidr moved to src/config/trusted.rs (the edge section file hit
  the 250-line gate) and gained `overlaps_prefix`: a ban is suppressed when the
  banned prefix intersects a trusted network.
- TrafficHook::with_trusted suppresses reputation and offender bans; its ban()
  now reports whether the ban was installed so `ban_offenders` counts real
  bans.
- The subnet monitor takes a MonitorSetup bundle (spawn had 8 arguments) and
  suppresses both userspace CIDR bans and XDP prefix bans that overlap a
  trusted network, logging a warning instead.
- IPv4-mapped addresses are normalised in `contains` too.
- Tests: overlap maths (v4/v6, /0 rejected), tracker suppression vs unrelated
  networks, and auto-ban skipping a trusted range while still banning public
  offenders.
2026-11-16 13:03:50 +01:00
324ef12b27
fix(edge): IPv6 bind, configurable relay idle, per-gateway budget, PROXY identity
- bind.address is parsed as IpAddr (no ":::port"), the socket domain follows
  the family, and "::" binds dual-stack. IPv6 was impossible before.
- limits.relay_idle_timeout_secs (default 300, 1..=86400) replaces the
  hardcoded relay constant; the deploy examples document it.
- The connection budget is an Arc<Semaphore> owned by Gateway instead of a
  process-wide OnceLock, so tests and multiple gateways stay independent.
- PROXY header identity is validated: unspecified, loopback, link-local,
  multicast, broadcast and addresses inside trusted_cidrs are rejected, and
  IPv4-mapped IPv6 is normalised first. An invalid header falls back to the
  transport peer. Bans targeting trusted_cidrs are suppressed, closing the
  ban-amplification path through a trusted load balancer.
- TrustedProxyCidr::contains no longer overflows its mask for IPv6 prefixes
  shorter than /96.
2026-11-16 12:36:19 +01:00