-
Build and install the agent binary, e.g. to
/usr/local/bin/phantom-agent. -
Copy or adapt deploy/systemd/phantom-agent.service.
-
Enable and start:
sudo systemctl daemon-reload sudo systemctl enable phantom-agent sudo systemctl start phantom-agent -
Optionally set
PHANTOM_TOKENin the service file or use an environment file.
Agent is configured via code (see server.DefaultConfig() and server.Config). Typical knobs:
ListenAddr— gRPC listen address (default:9090).Token— if set, all RPCs must sendAuthorization: Bearer <token>.HealthAddr— if set, HTTP server servesGET /health(e.g.:8080).RateLimit,RateBurst— per-session rate limit.MaxBreak,MaxHooks— per-session quotas.Audit— optional audit logger (e.g.server.NewAuditLog(os.Stderr)).
Pass the agent address: phantom-cli --agent host:9090 (or -a host:9090).
- Agent is not running on the given host/port.
- Firewall or network blocks the port.
- Session was closed (e.g.
CloseSessionor agent restart). - Reconnect and call
OpenSessionagain to get a new session.
Another process is using the listen port. Change ListenAddr or stop the other process.
- Build eBPF on Linux:
make build-bpf. - Ensure the .o path is correct and the binary was built for the same architecture.
- Kernel may need CAP_BPF, CAP_PERFMON, CAP_SYS_ADMIN for load/attach.
hook attach/breakCO-RE needs kernel BTF. If/sys/kernel/btf/vmlinuxis missing (common on stripped or self-built kernels), set-vmlinuxorPHANTOM_VMLINUXto a vmlinux ELF with.BTFfor the running kernel, or install a distro debug kernel image. Agent also probes/boot/vmlinux-$(uname -r),/usr/lib/debug/boot/..., and/lib/modules/$(uname -r)/build/vmlinuxautomatically.- Details: vmlinux.md.
Increase RateLimit/RateBurst or MaxBreak/MaxHooks in config, or reduce usage per session.
If HealthAddr is set, curl http://<agent>:<port>/health should return 200 OK. Use this for load balancers or readiness probes.
If MetricsAddr is set (e.g. -metrics :9091 or PHANTOM_METRICS=:9091), the agent exposes GET /metrics with counters phantom_commands_total, phantom_events_total and gauge phantom_sessions_active.