probe
Reference for linuxguard-agent probe — host capability check covering kernel, BPF, fanotify, netlink, audit, and Linux capabilities.
Synopsis
Check whether the host kernel and runtime environment support the building blocks the LinuxGuard agent depends on: kernel version, BTF availability, BPF ringbuf support, bpffs writability, fanotify, netlink sock_diag, auditd reachability, and the relevant Linux capabilities (CAP_BPF, CAP_PERFMON, CAP_DAC_READ_SEARCH, CAP_SYS_ADMIN, CAP_SYS_PTRACE, CAP_NET_ADMIN). Designed for pre-flight checks before enrolling an agent and for CI-host validation in container images.
The probe is bounded by a 3-second outer context timeout and a per-check 200ms budget. Per-check failures are recorded as false on the result and logged via slog.Warn.
linuxguard-agent probe [flags]Important:
probealways exits 0 — including when capability checks fail. The command is non-fatal by design: the exit code reports CLI success, not host suitability. Always inspect the JSON output to determine the actual outcome. CI and Ansible callers should parse the JSON and fail their own pipeline based on the boolean fields, not on the agent's exit code.
Flags
--json
bool
true
Emit machine-readable JSON to stdout. Accepted for forward compatibility — JSON is the only supported output format today.
--pretty
bool
false
Indent the JSON output for human reading. When true, output is produced via json.MarshalIndent with two-space indentation.
Environment
probe reads no environment variables. It does not respect any of the LINUXGUARD_* variables that influence the start command. The probe is intentionally self-contained so it can run inside a freshly-pulled image with no prior configuration.
Signals
probe is a one-shot CLI invocation — it does not install signal handlers via signal.Notify. The 3-second outer context timeout is the only interrupt path. Ctrl-C aborts the process via Go's default SIGINT handler (no graceful unwind, no JSON output).
Exit codes
0
Always. probe is non-fatal by design. The exit code does NOT reflect probe outcome — inspect the JSON output's boolean fields to determine actual capability availability.
The non-fatal behavior is intentional — even when json.Marshal fails (which should not happen for a struct of basic types), the agent logs the error via slog.Warn, emits {} to stdout, and returns nil. This guarantees that callers parsing the output do not block on a missing newline or a non-zero status.
Output schema
probe emits a single JSON object matching the capability.Capabilities struct:
kernel_version
string
Full uname-style kernel version (e.g. 5.15.0-amd64).
kernel_major
int
Parsed major component of the kernel version.
kernel_minor
int
Parsed minor component of the kernel version.
architecture
string
runtime.GOARCH value: amd64, arm64, arm (armv7), riscv64, etc.
btf_available
bool
Whether the kernel's BTF type information is available for CO-RE.
ringbuf_supported
bool
Whether the BPF ringbuf map type is supported by the kernel.
bpffs_writable
bool
Whether the bpf filesystem can be written by the agent.
fanotify_available
bool
Whether fanotify_init returns a usable fd.
netlink_sock_diag
bool
Whether the agent can open a NETLINK_SOCK_DIAG socket.
auditd_reachable
bool
Whether the audit netlink socket is reachable.
caps
object
Effective Linux capabilities — see below.
caps.bpf
bool
CAP_BPF (kernel 5.8+).
caps.perfmon
bool
CAP_PERFMON (kernel 5.8+).
caps.dac_read_search
bool
CAP_DAC_READ_SEARCH.
caps.sys_admin
bool
CAP_SYS_ADMIN.
caps.sys_ptrace
bool
CAP_SYS_PTRACE.
caps.net_admin
bool
CAP_NET_ADMIN.
probed_at
timestamp
RFC3339 timestamp when the probe ran.
probe_duration_ms
int
Total wall-clock duration of the probe in milliseconds.
All boolean fields default to false on per-check failure (the probe never returns an error; failures are recorded as flags on the result, per capability package documentation).
Examples
Pretty-print a probe to stdout
Sample stdout on a typical Ubuntu 22.04 host with sufficient privileges:
JSON probe for CI parsing
Fail a CI step when any required capability is missing
probe always exits 0, so the CI step must parse the JSON and decide:
Probe inside a container image
A reduced-capability container will show caps.sys_admin = false etc. while the kernel-level booleans remain accurate.
Probe via Ansible pre-flight
The changed_when: false is important because probe is read-only — Ansible should not record a change.
Related: start | config | CLI Reference | Reference
Last updated
Was this helpful?