Commit Graph

5 Commits

Author SHA1 Message Date
CyberMind
82b0522c5b
Aggregator résilience: sweep async (243 handlers) + threadpool 80 (#738) (#739)
* perf(aggregator): async-sweep — 243 blocking route handlers async def→def (#738)

Mounted in the aggregator's single event loop, an 'async def' route handler
that runs blocking code (subprocess/journalctl/openssl/argon2) freezes the
WHOLE loop -> aggregator.sock Connection refused -> 502 board-wide.

Deterministic AST codemod (scripts/async-sweep.py) converts route handlers
that (a) are decorated with an HTTP verb, (b) contain a known blocking call,
(c) have NO await/async-with/async-for/yield, (d) are never used as a
coroutine elsewhere -> plain 'def'. Starlette then runs them in the AnyIO
threadpool, so the blocking call no longer stalls the gateway. await/stream/
websocket handlers are left untouched. Every file py_compile-checked.

243 handlers across 56 modules (system 17, qos 13, netdiag/hexo 12, hub 11...).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* perf(aggregator): raise AnyIO threadpool to 80 tokens (#738)

The async-sweep moves ~243 blocking handlers to the threadpool. With ~110
modules in one process, the default 40-token pool can queue head-of-line under
concurrent blocking load. Raise to 80 on startup (best-effort, never breaks
boot).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* perf(hub): double-buffer status cache + emojized health page (#738)

Navbar status (menu + health-batch) is now a strict double-buffer cache:
- request handlers NEVER compute on the request path — they return the current
  snapshot instantly (or a 'warming' placeholder), so the sidebar's polling can
  no longer serialize behind a ~3s systemctl walk and starve the loop;
- the background refresher is kicked from the request path (_ensure_bg) because
  mounted sub-apps receive neither startup nor @app.middleware events under the
  aggregator — the previous lazy-start middleware never fired there;
- snapshots are built complete then swapped atomically, so the dashboard never
  shows partial/bad counts.

Served by the dedicated secubox-hub process (:8001, isolated loop) the navbar
stays <50ms and holds 200 under 25+ concurrent polls where the aggregator-
mounted copy wedged (000). health.js: 🟢🟡🔴 emoji status indicators.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* style(hub): render health status emoji cleanly (neutralize .led dot) (#738)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* perf(sidebar): kill per-module health storm, use batch endpoint (#738)

The navbar refreshed LEDs by firing ONE /api/v1/<module>/health request per
module — ~119 requests every 30s, in batches of 8 — straight at the aggregator's
single shared event loop. Combined with the in-process module mount this is a
prime driver of the recurring board-wide 502 wedge (user-identified).

checkAllHealth + refreshStaleHealth now call /api/v1/hub/public/health-batch
ONCE (served by the dedicated, double-buffered hub process) and populate every
module's LED from that single response. 119 reqs/cycle -> 1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 08:06:15 +02:00
9f53793552 fix(identity): Use request model for federation create endpoint
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-27 11:43:07 +01:00
2d54dd5dfa feat(api): Enhance Identity, MCP Server, LocalRecall, CVE Triage modules
Identity:
- Add encrypted key export/import with passphrase protection
- Trust federation between peers with weighted scoring
- Key expiration tracking and rotation warnings
- Trust history logging

MCP Server:
- Fix hardcoded ports to match actual module mapping
- Add CacheManager for expensive operations
- Implement proper resource readers (logs, configs, alerts)
- Add direct tool/resource access endpoints
- Concurrent status/alert aggregation

LocalRecall:
- Bulk delete by category or age
- Import/export functionality
- Automatic expired memory cleanup
- File compaction for deleted entries
- Pagination support

CVE Triage:
- npm audit scanning support
- Debian Security Tracker integration
- Patch suggestion generation
- Severity-based filtering

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-27 11:38:17 +01:00
7db62c52f9 fix(identity): Correct cryptography API for PublicKeyFormat
- Change serialization.PublicKeyFormat.Raw to PublicFormat.Raw
- Change PublicKeyFormat.SubjectPublicKeyInfo to PublicFormat.SubjectPublicKeyInfo
- Fixes service crash on startup due to AttributeError

feat(build): Add new packages to build script

- Added secubox-ndpid, secubox-system-hub
- Added AI modules: ai-gateway, localrecall, master-link, threat-analyst
- Added security modules: cve-triage, network-anomaly, dns-guard, iot-guard
- Added config-advisor, mcp-server, identity, ad-guard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-27 10:23:31 +01:00
de67714c8d feat: Add 15 new SecuBox-Deb modules and VM configuration
New FastAPI modules migrated from OpenWrt:
- secubox-ad-guard: Adware/tracker detection with device-type stats
- secubox-ndpid: nDPId DPI with JA3/JA4 fingerprinting
- secubox-ai-gateway: OpenAI-compatible local AI API
- secubox-localrecall: Local RAG with Qdrant/Ollama
- secubox-master-link: Node mesh management
- secubox-threat-analyst: AI-powered threat analysis
- secubox-cve-triage: NVD/EPSS CVE triage workflow
- secubox-network-anomaly: IQR-based anomaly detection
- secubox-dns-guard: DNS filtering with RPZ
- secubox-iot-guard: IoT device security & quarantine
- secubox-config-advisor: ANSSI CSPN compliance checks
- secubox-mcp-server: MCP protocol for Claude integration
- secubox-identity: User/role management
- secubox-system-hub: System health & remote support

C library:
- zkp-hamiltonian: Zero-Knowledge Proof library (Blum 1986)

VM configuration:
- MOCHAbin-like 7-NIC topology for libvirt testing

Dev environment:
- VSCode tasks and extensions for SecuBox development
- Claude Code CLAUDE.md project instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-27 10:08:05 +01:00