How the sensor works
Kprobe watches one process tree, not the whole machine. When you start an agent with kprobe run, the CLI creates a cgroup v2 directory for it (/sys/fs/cgroup/kprobe/run-PID), moves the agent into it before exec, and scopes every BPF program to that cgroup id. Children inherit the cgroup, so a subshell, a background job or a postinstall script is still the agent.
Files
The file policy picks the strongest backend the kernel offers:
| Backend | When | What it does | |
|---|---|---|
| lsm/file_open | BTF present and "bpf" in the active LSM list | A real LSM hook. Protected inodes return -EACCES. | |
| ksyscall/openat, openat2, open + kprobe/security_file_open | BTF and the kprobe PMU present (stock Ubuntu, Debian, Fedora, GitHub runners) | Path and basename match at syscall entry with bpf_override_return(-EACCES). The syscall entries are on the kernel's error-injection list. security_file_open checks the inode as a backstop and sends SIGKILL to an opener that got through by a link. | |
| seccomp user-notify | Kernels without BPF tracing, such as Firecracker microVMs | A seccomp filter installed before exec sends open and exec calls to the supervisor, which resolves the path (cwd, dirfd, realpath) and answers -EACCES or lets the call continue. | |
Egress always runs in eBPF, on every backend.
Egress
cgroup/connect4, connect6, sendmsg4 and sendmsg6 programs are attached to the agent's cgroup. Each connect is looked up in an LPM trie of allowed addresses. Host names in the policy resolve when the run starts. UDP to port 53 is only allowed to the first resolver in /etc/resolv.conf, which closes DNS tunnelling from inside the tree.
Timeline
Events go through a BPF ring buffer to the CLI, which prints one JSON object per line on stdout and to --log.
{"t":1751.1,"ev":"open","pid":1614,"comm":"cat","path":"/var/lib/agent/.ssh/id_ed25519","verdict":"denied","rule":"KP-0001","hook":"seccomp:openat"}
{"t":1793.4,"ev":"connect","comm":"curl","addr":"203.0.113.7","port":8443,"verdict":"denied","rule":"policy/arena","hook":"cgroup/connect4"}
{"t":1797.2,"ev":"kill","reason":"secret-then-egress","rule":"KP-0007","scope":"process tree"}| Field | Meaning | |
|---|---|
| t | milliseconds since the run started | |
| ev | start, exec, open, connect, sendmsg, kill, exit | |
| verdict | allowed, denied, would-deny (audit mode), killed | |
| rule | the id of the rule or policy that answered | |
| hook | the kernel hook that produced the event | |
