Purple-Team Mirror#

Added in v0.5. When enabled, every allowed request the proxy handles is also fire-and-forget copied to a secondary “defender view” upstream that never touches the C2 path. Blue team sees what got through InfraGuard without breaking the op.

Enable#

Add to config.yaml:

purple_team:
  enabled: true
  mirror_url: "https://blueteam.internal/collector/infraguard"
  auth_header: "Bearer eyJhbGciOi..."
  only_allowed: true              # skip blocked traffic
  max_queue_depth: 5000
  drop_body_over_kib: 128

The mirror is opt-in per-deploy. The primary C2 path is untouched: mirroring runs after the response has been sent to the beacon, on a bounded queue.

Wiring#

  • PurpleMirror is instantiated in core/app.py lifespan when purple_team.enabled; graceful shutdown drains the queue.
  • Every _record_request_event call in DomainRouter submits the event when only_allowed=False or the request was allowed.
  • The event payload includes beacon_id (when set), filter_result, filter_reason, and the request context - enough for a blue-team SIEM to reconstruct the sighting.

What the collector receives#

{
  "domain": "cdn.example.com",
  "client_ip": "10.0.5.42",
  "method": "GET",
  "uri": "/assets/style.css",
  "user_agent": "Mozilla/5.0 ...",
  "filter_result": "allow",
  "filter_reason": null,
  "filter_score": 0.15,
  "response_status": 200,
  "duration_ms": 42.1,
  "beacon_id": "a1b2c3d4e5f6...",
  "request_hash": "8f2a..."
}

Failure mode#

If the collector is slow, requests queue up to max_queue_depth then drop the oldest. If it is unreachable, each POST logs at DEBUG and moves on. The hot path is never blocked.

Adversary-emulation self-test (preflight) plus the purple-team mirror gives blue team both a scheduled probe report and a live traffic feed.