Watch
0
0
Fork
You've already forked hyperhive
0

full-setup and the host swarmctl reach the controller as a pod, not through a host socket

This commit is contained in:
atlas 2026-11-26 09:22:29 +01:00 • committed by maia
commit ee6b5f69f6

View file

@ -136,14 +136,6 @@ let
SWARM_CONTROLLER_AGENT_PKI_ROLE = deployCfg.bao.agentPkiRoleName;
};
# Where `swarmctl agent create` posts to. Unconditional: this binary is
# only installed where the daemon runs, so the socket is always the one
# right below it — and it is the same `socketPath` the daemon binds, read
# once rather than restated.
controllerSocketEnv = {
SWARM_CONTROLLER_SOCKET = deployCfg.swarm-controller.socketPath;
};
forgeCfg = config.services.hyperhive.swarm.forge;
swarmDomain = config.services.hyperhive.swarm.domain;
matrixCfg = config.services.hyperhive.swarm.matrix;
@ -159,10 +151,8 @@ let
# The swarm the host's `swarmctl` talks to: this host's own, through the
# gateway, as the operator's own SSO account (`swarmctl login`). The
# controller socket then serves the gateway alone, which always sets
# `Remote-User`. Both are defaults, so an operator's own value wins: an
# empty `SWARMCTL_SWARM` puts the socket verbs back on the socket for
# root.
# controller runs as a pod and has no socket on the host, so the gateway is
# the only way in. Both are defaults, so an operator's own value wins.
swarmDefaultEnv = lib.optionalAttrs (swarmDomain != null) {
SWARMCTL_SWARM = "https://${swarmDomain}";
SWARMCTL_LOGIN_DEFAULT_SWARM = "https://${swarmDomain}";
@ -341,7 +331,7 @@ let
wrapProgram $out/bin/swarmctl ${
lib.concatStringsSep " " (
lib.mapAttrsToList (name: value: "--set ${name} ${lib.escapeShellArg value}") (
controllerSocketEnv // swarmctlTrustEnv // deployCfg.swarm-controller.swarmctlEnvironment
swarmctlTrustEnv // deployCfg.swarm-controller.swarmctlEnvironment
)
++ lib.mapAttrsToList (
name: value: "--set-default ${name} ${lib.escapeShellArg value}"
@ -662,10 +652,8 @@ in
per-agent sockets, and the directory is `0750` owned by the
`${clientsGroup}` group. Members of that group (the gateway's
nginx, for `/api/` and `/webhook/forge/`) and root (which bypasses mode
bits) can reach the socket. The host's `swarmctl` goes through the
gateway by default, so only a root-run verb with an empty
`SWARMCTL_SWARM` opens it; every other local
user gets `EACCES` at the directory. What keeps `0666` safe is that
bits) can reach the socket. The host's `swarmctl` does not open it: it
goes through the gateway, and sets no socket path. What keeps `0666` safe is that
the directory holds exactly one socket.
Moving this path under a directory that carries anything else —
`/run/hyperhive`, which holds the host admin socket, above all —
@ -838,7 +826,7 @@ in
internal = true;
description = ''
Variables the installed `swarmctl` wrapper sets, on top of the
controller's socket path. Empty unless another module on this host
trust bundle. Empty unless another module on this host
supplies some: ./glue-controller-env.nix adds the configured authelia
where authelia runs here.
'';