CLI-Anything Bundle #82 — BPF Program Trust Recon Pack
Four agent-native, read-only trust-recon CLI tools for the Linux eBPF program trust surface — the layers that decide whether a box's BPF story can still be TRUSTED: the BPF toolchain + BPF-filesystem mount posture census (bpftool/tc binaries statted — never executed — /proc/mounts fstype classes, unprivileged_bpf_disabled posture, /sys/fs/bpf pinroot one level deep stat-only), the pinned-program artifacts + loader-unit census (bpf*/tc loader unit presence + drop-in counts, depth-limited stat-only pin walk, program objects sniffed to the 4-byte ELF magic only), the map-declaration grammar + pinned-map posture census (map NAME { / NAME: decl grammar, public map-type vocabulary, max_entries/key_size/value_size bounded shapes, pin-root stat-only census), and the program-source / struct / section / license grammar census (SEC() attach vocabulary, struct presence rows, bpf_map_def + .maps counts, GPL/DUAL-MIT-BSD license law). Each tool reads documented surfaces and stats what it must never open — and nothing is ever executed, no pinned node is ever opened (pinned nodes belong to the kernel's map objects), nothing networks, and no credential value, raw kernel address, hostname or serial ever prints (values ride BIN1/TOKEN1/UNIT1/PROG1/MAP1/CONF1/OBJ1/SRC1/SEC1/ADDR1/HOST1 class tokens only).
- bpftoolpeek — BPF toolchain + BPF-filesystem mount posture census: standard lookup-dir name-search for bpftool/tc shapes (glob bpftool* covers the loader helpers; identities ride BIN/BIN2 tokens; nonstd dirs ride DIR tokens); /proc/mounts capped 64KB, SEARCH-matched on fstype bpf/tracefs/debugfs only (the mount line never prints; ro/rw option class only; standard roots /sys/fs/bpf and /sys/kernel/debug/tracing may print, other mountpoints ride MNT tokens; device fields dropped at parse); unprivileged_bpf_disabled capped 256B (0 = UNPRIV_BPF_ENABLED finding, 1/2 restricted, unparsed rides a len-only verdict; the knob is never written); /sys/fs/bpf walked ONE level deep stat-only; findings BARE_TOOL, MOUNT_WITHOUT_TOOL, DUAL_INSTALL, UNPRIV_BPF_ENABLED, SYSCTL_UNPARSEABLE; honest rc6.
- bpfprogpeek — pinned-BPF program artifacts + loader-unit census: unit-dir name-shape scan for bpf*.service / *bpfload*.service / tc-*.service loader shapes (presence classes + drop-in counts; matched unit identities ride UNIT tokens; unrelated units counted, never carried); /sys/fs/bpf walked depth-limited (3) STRICTLY stat-only (pinned nodes never opened, never dereferenced; PROG/MAP tokens unless public shapes); program-object census under /etc/bpf.d, /etc/bpf and /usr/lib/bpf (glob *.o/*.bpf.o/*.elf; content NEVER parsed beyond the 4-byte ELF magic; zero-length objects ride honest EMPTY_PROGOBJ notes); SEC( attach-grammar from capped unit/config text; password/username/token KEY-PRESENCE rows only (values never read or printed; no IP, hostname or kernel-address literal ever rides a row); findings UNIT_WITHOUT_PINS, UNPARSEABLE_CFG, PROGDIR_PERM, PIN_WORLD_WRITABLE; honest rc6.
- bpfmappeek — map-declaration + pinned-map census: /etc/bpf.d, /etc/bpf, /usr/lib/bpf *.conf/*.json/*.yaml map-decl grammar (map decl opens via the "map NAME {" keyword shape, a NAME { brace shape or a NAME: colon shape; public map-type vocabulary MAPTYPE rows; max_entries/key_size/value_size MAPSIZE rows with bounded numeric shapes; off-numeric MAPSIZE_NONNUMERIC findings; foreign UNPARSEABLE_MAPCONF); /sys/fs/bpf pinning posture ONE level deep STRICTLY stat-only (pinned nodes never opened; MAPPIN_WORLD_WRITABLE stat-class findings); cred blackout (username/password/password2 KEY_PRESENCE rows only — values never read or printed; HOST1/HOST2 + ADDR1/ADDR2 token laws); MAPCONF_PERM group/world-writable findings; CONF_WITHOUT_PINS; DUP_MAPCONF public-grammar fingerprint notes; EMPTY_MAPDECLS / EMPTY_PINS honest notes; honest rc6.
- bpfstructpeek — program-source/struct grammar census: /etc/bpf.d, /etc/bpf, /usr/share/bpf *.c/*.h/*.bpf.c source-tree census (SRCFILES rows with SRC1/SRC2 tokens + perm classes); SEC("...") section grammar against the public attach vocabulary (suffixes and custom titles ride SEC1/SEC2 tokens); struct-declaration presence rows for public shapes (custom shapes suppressed); bpf_map_def + .maps MAPDEF/MAPS declaration counts; license declarations (GPL / DUAL MIT BSD public; other values honest lic-None rows); credential blackout (KEY_PRESENCE rows only; hex-address ADDR1/ADDR2 tokens); SRCDIR_PERM group/world-writable findings; UNPARSEABLE_SRC for invalid UTF-8; EMPTY_GRAMMAR / EMPTY_SRCDIR / NO_LIC_DECL honest notes; honest rc6.
The contract
Every tool: rc0 clean / rc4 findings / rc6 honest nothing-readable / rc3 bad usage (argparse subclass law); --json emits exactly one report object with the keys data/findings/notes/rc/summary/tool; the default mode prints one human summary line plus capped findings rows. python3 -m cli_anything.<tool> [--json] with per-tool BPF* env overrides (see each SKILL.md). Pure Python stdlib — zero spawned lines, zero writes, zero network; binaries are name-searched and statted once, pinned nodes stat/listdir only, object content is read only to the ELF magic, and nothing is ever executed. No BPF tool binary is ever run (tc is the classic loader path and stays unpulled); no pinned node is ever opened (they belong to the kernel); no credential value, raw kernel address, hostname, IP or serial is ever printed (BIN1/UNIT1/PROG1/MAP1/CONF1/OBJ1/SRC1/SEC1/ADDR1/HOST1 class tokens only). The census never "fixes" a posture — it names it.