Skip to content

About

Tiny Rust agent for live Linux telemetry, a chaos proxy and sandboxes, with a Go control plane and web/terminal dashboards. Alpha.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Aegis-Net

A tiny Rust agent for live Linux telemetry, a chaos proxy and sandboxes, with a Go control plane and web/terminal dashboards.

CI License: MIT

Aegis-Net live telemetry and chaos proxy demo

Warning

Alpha. Run on localhost or a trusted network only. The agent needs Linux with cgroups v2.

Try It in Your Browser

No Linux host or backend required — the web dashboard ships with an in-browser telemetry & chaos simulator so you can explore it from macOS, Windows, or Linux:

  • Live Demo (GitHub Pages): https://saswatdutta1310.github.io/Aeiges.net/ (demo mode enabled by default)
  • Local Demo Mode:
    cd ui && pnpm install && pnpm --filter @aegis/web dev
    Open http://127.0.0.1:5173/?demo=1 (predev builds @aegis/core automatically on a fresh clone; pnpm dev in ui/ also runs @aegis/web).

In demo mode, the dashboard simulates 3 Linux nodes (edge-fra-01, compute-iad-02, ingress-sin-03) at 10 Hz with wandering CPU/memory/PSI signals, process lists, sockets, proxy routes, and sandboxes. Clicking any route in the Topology graph lets you inject latency, HTTP aborts, drops, or throttling — the route turns red, simulated latency/error numbers spike, and faults automatically revert when the TTL expires.

Architecture

+-------------------------------------------------------------------+
| Presentation Plane (ui/)                                          |
|   apps/web : React 19, Vite, @xyflow/react chaos topology,        |
|              imperative uPlot <canvas> charts, @tanstack/react-   |
|              virtual 60fps process table                          |
|   apps/tui : React Ink keyboard-driven terminal dashboard         |
|   packages/core (@aegis/core):                                    |
|              Auto-reconnecting binary Protobuf WS client +        |
|              zero-GC Float64Array ring buffers (600 samples) +    |
|              in-browser DemoTelemetrySource (?demo=1)             |
+---------------------------------+---------------------------------+
                                  | WebSocket (/ws binary Protobuf or ?format=json)
                                  | + REST (/api/v1/*) + /metrics (Prometheus)
                                  v
+-------------------------------------------------------------------+
| Control Plane & CLI (hub-go/)                                     |
|   aegis-hub : Bidirectional gRPC ingestion (TelemetryService,     |
|               ControlService, OperatorService), lock-free         |
|               atomic.Pointer snapshot store + cap-64 pub/sub,     |
|               BadgerDB LSM tiered store (1s rollups, flows,       |
|               TTL + RunValueLogGC), SHA-256 reconciler + chaos TTL|
|   aegisctl  : Cobra operator CLI (nodes, top, chaos, sandbox)     |
+---------------------------------+---------------------------------+
                                  | Bidirectional gRPC / UDS (tonic)
                                  v
+-------------------------------------------------------------------+
| Data Plane (agent-rust/)                                          |
|   aegisd    : Release binary (<8 MiB RSS) with tikv-jemallocator  |
|               - 100ms /proc & PSI (/proc/pressure/*) collector    |
|               - Async L4 TCP splice & L7 Hyper chaos proxy        |
|                 (SO_LINGER TCP RST, jittered latency, 503, rate)  |
|               - nix::sched::clone namespaces + cgroups v2 sandbox |
+-------------------------------------------------------------------+

Features

  • 100 ms Host, Process, Socket & PSI Telemetry (agent-rust): Parses /proc/stat, /proc/meminfo, /proc/loadavg, /proc/uptime, /proc/pressure/{cpu,memory,io}, /proc/[pid]/{stat,io,status,cmdline}, and /proc/net/tcp{,6} using tikv-jemallocator and bounded ring buffers.
  • L4/L7 Chaos Reverse Proxy (agent-rust): Async TCP splicing and Hyper HTTP proxy supporting composable faults: latency + jitter, packet drop / TCP RST (SO_LINGER=0), HTTP status/body aborts with path/method matching, and token-bucket bandwidth throttling.
  • Namespaces & cgroups v2 Sandboxes (agent-rust): Spawns workloads via nix::sched::clone (CLONE_NEWPID, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWUSER) attached to /sys/fs/cgroup/aegis/<id> (memory.max, memory.high, cpu.max, pids.max, cgroup.kill).
  • Control Plane & Storage (hub-go): Bidirectional gRPC ingestion (TCP or Unix Domain Socket), SHA-256 desired-state reconciler, auto-reverting chaos TTL timers, BadgerDB tiered retention with RunValueLogGC, Prometheus /metrics, /healthz, WebSocket fan-out, and optional --auth-token bearer auth.
  • Operator CLI & Dashboards (aegisctl, @aegis/web, @aegis/tui): Cobra CLI (nodes, top, chaos, sandbox), React 19 + Vite web console with Hub URL/token settings, and React Ink terminal dashboard.

Quickstart (Linux)

Prerequisites

  • OS / Kernel: Linux with unified cgroups v2 (/sys/fs/cgroup) and /proc/pressure/* (PSI) enabled
  • Rust: Stable toolchain (cargo, rustfmt, clippy)
  • Go: 1.27.4 (matching hub-go/go.mod)
  • Protobuf: protoc (protobuf-compiler) plus Go plugins (make tools)
  • UI: Node.js >= 20 (CI uses 22) and pnpm (10.x)

1. Generate Protobuf Bindings & Build

git clone https://github.com/saswatdutta1310/Aeiges.net.git aegis-net
cd aegis-net

# Install protoc-gen-go and protoc-gen-go-grpc (once) and generate Go/TS bindings
make tools
make proto

# Build Rust agent, Go hub, Go CLI, and UI workspace
make build

2. Run Control Plane (aegis-hub) & Data Plane (aegisd)

# Terminal 1: Start Go Control Plane Hub (binds 127.0.0.1:9090 gRPC, 127.0.0.1:8080 HTTP/WS)
./hub-go/bin/aegis-hub \
  -grpc-addr 127.0.0.1:9090 \
  -uds-path /tmp/aegis-hub.sock \
  -http-addr 127.0.0.1:8080 \
  -data-dir ./data/aegis-hub

# Terminal 2: Start Rust Data Plane Daemon (use sudo if creating root cgroups v2 sandboxes)
./agent-rust/target/release/aegisd \
  --node-id node-1 \
  --hub-endpoint unix:///tmp/aegis-hub.sock \
  --interval-ms 100

Or launch all planes together with one command:

make up

3. Operator CLI (aegisctl)

# List connected nodes
./hub-go/bin/aegisctl --hub 127.0.0.1:9090 nodes ls

# Stream live 10Hz telemetry from hub WebSocket
./hub-go/bin/aegisctl --hub 127.0.0.1:9090 --http-hub http://127.0.0.1:8080 top node-1

# Inject a 100ms HTTP proxy latency fault with 60s auto-revert TTL
./hub-go/bin/aegisctl --hub 127.0.0.1:9090 chaos set \
  --node node-1 --route api --listen 127.0.0.1:18080 --upstream 127.0.0.1:8081 \
  --delay 100ms --ttl 60s

# Launch and inspect a cgroups v2 + namespace sandbox
./hub-go/bin/aegisctl --hub 127.0.0.1:9090 sandbox create \
  --node node-1 --id worker-1 --mem 128M --cpu 50000 --isolate-pid -- /bin/sleep 60
./hub-go/bin/aegisctl --hub 127.0.0.1:9090 sandbox ls --node node-1

4. Web Console & Terminal Dashboard

# Web Console (http://127.0.0.1:5173, proxies /api and /ws -> http://127.0.0.1:8080; predev builds @aegis/core)
cd ui && pnpm install && pnpm --filter @aegis/web dev

# Terminal UI (keys: [1-4] tabs, [/] filter, [c] chaos modal, [q] quit; predev builds @aegis/core)
cd ui && pnpm --filter @aegis/tui dev --hub http://127.0.0.1:8080
# Or run the prebuilt bundle after `make build` / `pnpm -r build`:
node ui/apps/tui/dist/index.js --hub http://127.0.0.1:8080

Configuration & Flags

aegis-hub (hub-go/cmd/aegis-hub)

Flag Environment Variable Default Description
-grpc-addr AEGIS_GRPC_ADDR 127.0.0.1:9090 gRPC TCP listen address
-uds-path AEGIS_UDS_PATH "" Optional gRPC Unix domain socket path
-http-addr AEGIS_HTTP_ADDR 127.0.0.1:8080 HTTP, WebSocket (/ws), and Prometheus (/metrics) address
-data-dir AEGIS_DATA_DIR ./data/aegis-hub BadgerDB storage directory
-in-memory — false Run BadgerDB purely in memory (ephemeral)
-metrics-ttl — 24h BadgerDB retention TTL for 1s metric rollups
-flows-ttl — 6h BadgerDB retention TTL for proxy flow events
-gc-interval — 5m BadgerDB RunValueLogGC(0.5) interval
-auth-token AEGIS_AUTH_TOKEN "" Optional bearer token required on HTTP/WS and gRPC
-allowed-origins AEGIS_ALLOWED_ORIGINS "" Comma-separated additional allowed WebSocket origins

aegisd (agent-rust)

Flag Environment Variable Default Description
--node-id AEGIS_NODE_ID system hostname Unique node identifier reported to aegis-hub
--hub-endpoint AEGIS_HUB_ENDPOINT http://127.0.0.1:9090 Control plane gRPC endpoint (http://... or unix:///...)
--interval-ms AEGIS_INTERVAL_MS 100 Telemetry collection interval in ms (minimum 20 ms)
--ring-capacity AEGIS_RING_CAPACITY 64 Bounded offline TelemetryFrame ring capacity
--max-processes AEGIS_MAX_PROCESSES 64 Max processes per TelemetryFrame (0 = unlimited)
--flow-ring-capacity AEGIS_FLOW_RING_CAPACITY 256 Bounded ProxyFlowEvent ring capacity
--cgroup-root AEGIS_CGROUP_ROOT /sys/fs/cgroup/aegis Root cgroups v2 directory managed for sandboxes
--run-secs AEGIS_RUN_SECS unset Optional run duration in seconds before clean shutdown
--auth-token AEGIS_AUTH_TOKEN unset Optional bearer token sent on gRPC calls to aegis-hub

aegisctl & UI (@aegis/web, @aegis/tui)

  • aegisctl: --hub (AEGIS_HUB_ADDR, default 127.0.0.1:9090), --http-hub (AEGIS_HTTP_ADDR, default http://127.0.0.1:8080), --token (AEGIS_AUTH_TOKEN), -n/--node, -o/--output (table or json).
  • @aegis/web: URL query params ?demo=1, ?hub=<url>, ?ws=<url>; Vite build-time env VITE_AEGIS_DEMO, VITE_AEGIS_HUB_URL, VITE_AEGIS_WS_URL, VITE_BASE_PATH; in-app Hub ⚙ settings (saved in localStorage).
  • @aegis/tui: --hub (AEGIS_HUB_URL), --ws (AEGIS_WS_URL), --node (AEGIS_NODE_ID), --token (AEGIS_AUTH_TOKEN), --json.

Security

  • Localhost by default: aegis-hub and deploy/docker-compose.yml bind/publish to 127.0.0.1:9090 and 127.0.0.1:8080 by default.
  • Optional shared bearer token: Pass -auth-token / AEGIS_AUTH_TOKEN to aegis-hub, --auth-token to aegisd, --token to aegisctl, or enter it in the Web Console's Hub ⚙ settings (Authorization: Bearer <token> on /api/v1/* and gRPC, and ?token=<token> on /ws). Note that /healthz and /metrics remain unauthenticated.
  • WebSocket origin allowlist: /ws restricts browser Origin headers to same-host and localhost patterns by default; extend with -allowed-origins / AEGIS_ALLOWED_ORIGINS for remote UI origins.
  • Input validation: Chaos and route endpoints validate probabilities in [0, 1], delay_ms/jitter_ms in 0..60000, HTTP status codes in 100..599, chaos TTLs up to 24h, valid host:port addresses, and up to 64 routes per node (returning HTTP 400 JSON errors on invalid input).
  • No built-in TLS yet: gRPC and HTTP/WebSocket traffic are plaintext by default. Do not expose aegis-hub or aegisd directly to untrusted networks without TLS termination or an SSH/VPN tunnel.
  • Sandboxes are not a security boundary: aegisd uses Linux namespaces and cgroups v2 for resource accounting and test isolation without seccomp filters, pivot_root, or capability dropping. Never run untrusted or hostile workloads inside an aegisd sandbox. See SECURITY.md for vulnerability reporting.

Benchmarks

Note

The numbers below were measured by the author on one Arch Linux machine (kernel 7.3.6-arch1-1, unified cgroup2 + PSI, aegisd release binary connected over UDS unix:///tmp/aegis-live-hub.sock to aegis-hub, driven by aegisctl and hub-go/tests/e2e_chaos_test.go). They are not guaranteed on other hardware, kernel versions, or workloads.

Component / Metric Measured Result Notes
aegisd RSS (10Hz UDS streaming idle) 7.30–7.41 MiB (7,704,576 B) tikv-jemallocator (thp:never, narenas:2), 2-worker Tokio runtime
aegisd VmRSS under active HTTP proxy load 7.84 MiB (8,032 KiB) RssAnon: 2,300 KiB, RssFile: 5,732 KiB
aegisd VmRSS after cgroups v2 sandbox lifecycle 7.56 MiB (7,740 KiB) memory.max, cpu.max, pids.max + cgroup.kill cleanup
E2E HTTP p95 (baseline) 343.31 µs 20 requests through aegisd L7 Hyper proxy
E2E HTTP p95 (100ms latency fault via aegisctl) 104.04 ms --ttl 1500ms
E2E HTTP p95 (post-TTL auto-revert) 337.96 µs Automatic hub-side rollback

Roadmap

  • TLS / mTLS between aegisd, aegis-hub, and aegisctl
  • Fine-grained RBAC and multi-user authentication beyond a single shared bearer token
  • Persistent chaos TTL timers across aegis-hub restarts (currently in-memory)
  • High-availability / replicated control plane state beyond single-node BadgerDB
  • Sandbox hardening (seccomp BPF profiles, pivot_root rootfs isolation, capability dropping)

Contributing & License

About

Tiny Rust agent for live Linux telemetry, a chaos proxy and sandboxes, with a Go control plane and web/terminal dashboards. Alpha.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages