mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2026-02-04 09:50:31 -07:00
4.7 KiB
4.7 KiB
Architecture Overview
Back to Docs Index | Index (HTML)
Purpose
Explain how Borealis is structured and how the core components interact end to end.
Core Components
- Engine: Flask + Socket.IO runtime that hosts APIs, scheduled jobs, VPN orchestration, and WebUI assets.
- WebUI: React single page app served by the Engine (Vite in dev, static build in prod).
- Agent: Python runtime that enrolls, reports inventory, executes scripts, and opens VPN tunnels.
- SQLite database: stores devices, approvals, schedules, activity history, tokens, and configuration records.
- Assemblies: script definitions stored in SQLite domains with payload artifacts on disk.
- Remote access: WireGuard reverse VPN, remote PowerShell, and Guacamole-backed RDP proxy.
How the Pieces Talk
- Enrollment: agent calls
/api/agent/enroll/requestand/api/agent/enroll/poll, operator approves, Engine issues tokens and cert bundle. - Inventory: agent posts
/api/agent/heartbeatand/api/agent/details, Engine updates device records. - Quick jobs: operator calls
/api/scripts/quick_run, Engine emitsquick_job_runover Socket.IO, agent executes and returnsquick_job_result. - Scheduled jobs: scheduler reads jobs from DB, resolves targets (including filters), then emits quick jobs.
- VPN tunnels: operator calls
/api/tunnel/connect, Engine emitsvpn_tunnel_start, agent starts WireGuard client. - Remote shell: UI uses Socket.IO
vpn_shell_*events, Engine bridges to agent TCP shell over WireGuard. - RDP: operator calls
/api/rdp/session, Engine creates a one-time token and proxies Guacamole WebSocket to guacd. - Notifications: operator or services call
/api/notifications/notify, WebUI receivesborealis_notificationevents.
Directory Map (High Level)
Data/Engine/- Engine source (authoritative).Data/Agent/- Agent source (authoritative).Engine/- Engine runtime copy (regenerated each launch).Agent/- Agent runtime copy (regenerated each launch).Data/Engine/web-interface/src/- WebUI source.Engine/Logs/andAgent/Logs/- runtime logs.Data/Engine/Assemblies/andEngine/Assemblies/- assemblies (staging and runtime).
API Endpoints
None on this page. See API Reference.
Related Documentation
- Engine Runtime
- Agent Runtime
- Security and Trust
- Device Management
- Assemblies and Quick Jobs
- Scheduled Jobs
- VPN and Remote Access
- UI and Notifications
Codex Agent (Detailed)
Service map by folder
- Engine APIs:
Data/Engine/services/API/(grouped by domain, registered inData/Engine/services/API/__init__.py). - Engine realtime:
Data/Engine/services/WebSocket/(Socket.IO events: quick jobs, VPN shell, agent socket registry). - WebUI hosting:
Data/Engine/services/WebUI/(SPA static assets and 404 fallback). - VPN orchestration:
Data/Engine/services/VPN/(WireGuard server and tunnel lifecycle). - Remote desktop proxy:
Data/Engine/services/RemoteDesktop/(Guacamole WebSocket proxy). - Filters and targeting:
Data/Engine/services/filters/matcher.py(used by scheduled jobs and filter counts). - Agent roles:
Data/Agent/Roles/(script exec, screenshot, WireGuard tunnel, remote PowerShell, etc).
End-to-end flow examples (use these to debug)
- Quick job:
- UI calls
/api/scripts/quick_runwith script path + hostnames. - Engine signs script and emits
quick_job_run. - Agent role executes and posts
quick_job_resultover Socket.IO. - Engine updates
activity_historyand emitsdevice_activity_changed.
- UI calls
- VPN shell:
- UI calls
/api/tunnel/connectto request tunnel material. - Engine emits
vpn_tunnel_startto agent socket. - Agent WireGuard role starts tunnel; agent shell role listens on TCP 47002.
- UI opens
vpn_shell_openSocket.IO event; Engine bridges to TCP shell. - UI sends/receives
vpn_shell_sendandvpn_shell_outputevents.
- UI calls
Runtime boundaries
- Do not edit
Engine/orAgent/directly. They are recreated on each launch. - Always edit
Data/Engine/andData/Agent/then re-run the bootstrap script.
What to read first when debugging
- Start with logs:
Engine/Logs/engine.logandAgent/Logs/agent.log. - Check domain-specific logs (example:
Engine/Logs/VPN_Tunnel/tunnel.log). - Inspect active DB state in
Engine/database.dbfor device/job metadata.
Interaction points to remember
- REST for inventory, enrollment, and admin actions.
- Socket.IO for realtime job results, VPN shell, and notifications.
- WireGuard for remote protocol transport (shell, RDP, future protocols).