| Filename | Latest commit message | Latest commit date |
|---|---|---|
hive-priv read requests with BufReader::lines, which cannot surface SCM_RIGHTS: ancillary data is attached to one specific recvmsg call, so a buffered line reader takes the bytes and silently drops the descriptor. Replace it with a recvmsg loop. The pairing is deliberately trivial. hive-sock-client connects per request, so a connection carries one line and at most one descriptor; a second descriptor arriving before its line is a protocol error rather than something to queue. check_fd_agreement rejects both mismatches -- an fd-taking op that got none, and a descriptor sent to an op that takes none -- and dropping the OwnedFd on that path closes it. recv_with_fds claims every descriptor the kernel attaches, including ones this protocol never expects, because an fd we fail to claim leaks for the life of the process. MSG_CMSG_CLOEXEC keeps a received descriptor out of every btrfs and nixos-container child. The control buffer is only cmsghdr-aligned, so descriptors are copied out byte-wise instead of read through a more strictly aligned pointer. SendAgentSnapshotToFd is SendAgentSnapshotToFile without the staging file: same validation and -p parent handling, stdout wired to the passed descriptor. It exists so hive-c0re can connect to a peer hive's snapshot store, write the header itself, and hand over the connected socket -- leaving this helper with no address, no protocol, and nobody in the data path once the send starts. |
||
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
hive-priv-sock
Wire types for the hive-priv privileged-helper socket
(/run/hive/priv.sock) — the contract between hive-priv (the root helper,
server) and hive-c0re (client, via its priv_client).
Why it's its own crate
Split out of hive-sh4re so hive-priv — a root-privileged binary —
depends on just this narrow protocol crate instead of the much larger
daemon-shared crate. Two wins: fewer dependencies in a root process's supply
chain, and a small, self-contained interface makes the privilege boundary this
crate encodes easier to audit. Mirrors hive-host-sock's split for the host
admin socket.
Shape
Serde-derived request/response types only — no server or client logic. Both
sides import them so the shapes stay in sync. See docs/boundary.md +
docs/security.md for the privilege boundary these types sit on, and
hive-priv/README for the helper itself.