Skip to main content
The Linux agent captures LLM usage metadata using eBPF socket tracing. It attaches BPF probes to the kernel’s network stack and OpenSSL to extract SNI hostnames from outbound TLS connections — it never blocks traffic and never inspects content.

Requirements

  • Linux kernel 5.10 or later with BTF (BPF Type Format) enabled
  • systemd
  • Root privileges for installation (required to load BPF programs)
BTF is required for CO-RE (Compile Once, Run Everywhere) compatibility. To check whether your kernel has BTF enabled, run ls /sys/kernel/btf/vmlinux. If the file exists, your kernel is supported.

How it works

The agent consists of two components:
  • eBPF programs — Seven BPF probes (tracepoints, kprobes, and OpenSSL uprobes) compiled with CO-RE for kernel 5.10+ portability. The probes track outbound TCP connections on port 443, measure bytes sent and received, and extract the TLS SNI hostname via OpenSSL uprobes attached to libssl.so. The BPF programs never block connections — they only observe and record.
  • Rust daemon (toktra-agent) — An async daemon that polls the BPF ring buffer, classifies events against known LLM provider hostnames, batches events (up to 50 events or 5 seconds), and transmits telemetry securely to Toktra over mTLS. The daemon runs as a systemd service.
The eBPF programs operate in observe-only mode. No BPF action ever drops or modifies a packet. All connections proceed normally.

Installation

1

Download the package

Download the .deb package from the Toktra admin dashboard under Devices → Download Agent → Linux.
2

Install the package

The postinst script runs systemctl daemon-reload && systemctl enable --now toktra-agent automatically.
3

Verify the service is running

Installed paths

Configuration

The agent loads configuration by layering: defaults ← /etc/toktra/agent.conf ← environment variables. Environment variables always take precedence.

Configuration file

Create or edit /etc/toktra/agent.conf (TOML format):

Environment variables

All configuration keys can be overridden with environment variables. Add overrides to /etc/toktra/agent.env (loaded by the systemd unit via EnvironmentFile):
After editing the configuration, restart the service:

Device enrollment

On first run, the daemon automatically enrolls the device:
  1. Generates an Ed25519 key pair and writes the private key to /etc/toktra/device.key.
  2. Sends a CSR to the Toktra enrollment endpoint.
  3. Writes the signed device certificate to /etc/toktra/device.crt. The certificate is valid for 90 days.
  4. Uses the device certificate for mTLS on all subsequent transmissions.
Certificates renew automatically before expiry.

systemd service

The agent runs as a Type=notify systemd service and signals readiness with sd_notify. The unit applies security hardening directives:
Common service management commands:

Prometheus metrics

The daemon exposes Prometheus-format metrics on 127.0.0.1:9090/metrics (configurable with metrics_port). Scrape this endpoint with Prometheus or a compatible collector. Available metrics: Example Prometheus scrape config:

osquery extension (fleet-wide queries)

The agent ships a Go osquery table extension (toktra_extension) that exposes a toktra_connections virtual table. Use this with Fleet or Kolide to run fleet-wide LLM usage queries.
The extension connects to the daemon’s Unix socket at /run/toktra/connections.sock to read real-time connection data. Example queries:
The toktra_connections table schema:
Set TOKTRA_SOCKET_PATH to override the default Unix socket path if you run the daemon in a non-standard location.