1 VM Guest Agent
Claude edited this page 2026-06-29 21:37:15 +00:00

VM Guest-Agent

Rust-Binary innerhalb der VMs. Verbindet ausgehend per TCP (JSON-Lines) zum Host-Agent (:9100), sendet Metrics + Scans. Zwei Crates: Linux/FreeBSD (VM-Guest-Agent/) und Windows (Windows-VM-Guest-Agent/).

Quellen

Pfad Inhalt
VM-Guest-Agent/src/main.rs Config + Mainloop + TCP
VM-Guest-Agent/src/collect/mod.rs collect_scan() (join! der Collector)
VM-Guest-Agent/src/collect/linux.rs Linux-Collector
VM-Guest-Agent/src/collect/freebsd.rs FreeBSD-Collector
VM-Guest-Agent/src/logs.rs Log-Sammlung
Windows-VM-Guest-Agent/src/ Windows-Variante

Protokoll

→ {"type":"auth", ...}
← {"type":"auth_ok"}
→ Loop: {"type":"vm_metrics", ...}  (alle 15s)
→ Loop: {"type":"vm_scan", ...}     (alle 5min)

Config (/etc/theprox-vm-agent/agent.conf)

proxy_ip, proxy_port, vmid, token, metrics_interval, scan_interval.

Build (static musl)

cd VM-Guest-Agent
cargo build --release --target x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/theprox-vm-agent theprox-vm-agent-x86_64

Vorkompilierte Binaries VM-Guest-Agent/theprox-vm-agent-{arch} nach jeder Änderung neu bauen und committen (Docker-Compose mountet VM-Guest-Agent/ read-only ins Backend).

Neuer Collector

In collect/<os>.rs als pub async fn collect_*() -> Value implementieren, in collect_scan() via tokio::join! aufrufen.

Install

curl -fsSL http://SERVER:8765/vm-install/<TOKEN> | bash
  • Install-Endpunkt: GET /vm-install/{token} → Bash-Script
  • Binary-Endpunkt: GET /vm-agent-binary/{arch} dient VM-Guest-Agent/theprox-vm-agent-{arch}

Versionierung

Jede Änderung an Code/Binaries/Installern → Version erhöhen + in notes/changelog.md dokumentieren.