fix(hivectl): ask the daemon whether an agent exists

The agents root is 0700 and owned by the daemon's user, so hivectl's
client-side existence guard hit EACCES on traversal for anyone not root.
It reported that as "this command needs root; re-run with sudo", which
turned three verbs' pre-flight check into a permission error about the
wrong thing: `choom`, `subvol upgrade` and `subvol snapshot create` all
failed at the guard rather than at whatever they actually needed.

The daemon runs as the owning user and already answers this question for
its own provisioning paths, so expose it on the host socket as
`AgentExists` and have hivectl ask. Operators reach that socket through
the `hive-admin` group, so the guard now works without sudo.

`choom` still needs root for `machinectl shell` — we ship no polkit rule
granting those actions — so it now checks the effective uid and says so
directly instead of failing later inside systemd's authorisation.
This commit is contained in:
atlas 2026-07-26 20:57:49 +02:00 committed by mara
commit 170fd817ea
9 changed files with 119 additions and 36 deletions

1
Cargo.lock generated
View file

@ -1817,6 +1817,7 @@ dependencies = [
"hive-sh4re",
"hive-types",
"indicatif",
"libc",
"serde_json",
"tokio",
"tracing-subscriber",