Import lnvps_fw DDoS events into lnvps_api: protection-layer registry, poller, customer + admin surfacing
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia con lnvps_api_admin/src/admin/hosts.rs e docs/agents/fw-api.md, quindi esamina ip_assignment di lnvps_db e l’uso esistente di WorkJob::SendAdminNotification. Organizza il lavoro nel file di lavoro complementare suggerito, coprendo il CRUD del registro, la persistenza degli eventi per livello, l’esposizione basata su CIDR per clienti/amministratori e le notifiche deduplicate per transizione; il lavoro è completo quando tutti e quattro i percorsi richiesti e le decisioni di progettazione rimanenti sono documentati e implementati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
lnvps_fw_service (the XDP/eBPF DDoS daemon) exposes GET /api/v1/events?since=<cursor> from a bounded in-memory ring buffer — it holds no database by design (docs/agents/fw-api.md; work/ddos-protection.md Increment 7). lnvps_api was always meant to be the poller and source of truth; that half was explicitly deferred out of Increment 7: "the database schema for rules/incident logs, the rules-push client, the event-poll-and-persist loop, and the admin API/UI that reads them." Nothing on the lnvps_api side exists yet — checked lnvps_db/lnvps_api_admin for fw_host/FwHost/ProtectedHost, none found.
What's already there to build on
Event(lnvps_fw_service/src/api.rs:156-166):seq(u64, per-daemon monotonic cursor — not globally unique once there's more than one router, pair it with the layer's own id),kind(EventKind::{Start,Flags,Stop}),cidr(String — see below),flags(protection bitmask),ts_unix,pps/bps/syn_pps.ip_assignment(lnvps_db) already maps IP → VM. An event'scidris not always a single IP: CIDR escalation (Increment 5) and prefix-level carpet-bomb detection can mitigate a /24, /64, or a whole protected prefix — resolve by CIDR-contains againstip_assignment, not exact match, and expect zero-to-many VMs per event.lnvps_api_admin/src/admin/hosts.rs(admin_list_hosts/admin_get_host/admin_create_host/admin_update_host+ a disk sub-resource) is the existing pattern for a hardware-registry CRUD — the shape to follow for a new protection-layer registry, not a new convention.WorkJob::SendAdminNotificationalready exists and is used elsewhere in the worker (per #327) — reuse it for the alerting ask.
Wanted
- Protection-layer registry (admin CRUD, pattern per
hosts.rs): eachlnvps_fw_serviceinstance (a router/host running it) registered with its API URL, bearer token, and which IP range(s) it protects. - Poller:
lnvps_apipolls/api/v1/events?since=<cursor>per registered layer, persists into a new table keyed by at minimum(layer_id, seq)— notseqalone, it collides across layers — pluskind,cidr,ts_unix,flags, rates. - Customer API: surface events for a customer's own VM(s), resolved via
ip_assignmentagainst the event'scidr. - Admin notification: on ingest (at least on
Start), fireWorkJob::SendAdminNotification— dedupe on the transition into the state, not every poll, same requirement as #327.
Not settled here
Poll interval, and how a layer's token/URL gets paired with its self-signed cert (fw-api.md: "lnvps_api pins/accepts the self-signed cert over the private management link"). This is epic-sized — work/ddos-protection.md already tracks the fw_service side in numbered increments with its own "commit direct, no PR per increment" workflow; a companion work file for this side fits this org's own XL task-sizing rule better than one PR.
-- PM: Alejandra
- Lingua principale
- Rust
- Stelle
- 9
- Fork
- 2
- Merge medio
- 21h 10m
- PR unite (30g)
- 24
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di LNVPS/api
-
refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
-
Readonly vm Apertadatabase enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
api refactor
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
gitbutlerapp/gitbutler#15998 · 1 commento ·
-
bug triage:deciding
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100