default the host's swarmctl to the gateway; login takes a callback port
This commit is contained in:
parent
ef817ed5a0
commit
58236e1b7f
1 changed files with 183 additions and 67 deletions
|
|
@ -154,11 +154,14 @@ let
|
|||
storeRetry = import ./lib/store-retry.nix { };
|
||||
tcpOn = deployCfg.swarm-controller.enable && tcpCfg.enable;
|
||||
|
||||
# Which swarm `swarmctl login` logs in to when given none: this host's own.
|
||||
# Read by `login` alone. `SWARMCTL_SWARM` would also move every socket verb
|
||||
# onto the gateway, where each needs a login. A default, so an operator's
|
||||
# own value still wins.
|
||||
loginDefaultEnv = lib.optionalAttrs (swarmDomain != null) {
|
||||
# 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.
|
||||
swarmDefaultEnv = lib.optionalAttrs (swarmDomain != null) {
|
||||
SWARMCTL_SWARM = "https://${swarmDomain}";
|
||||
SWARMCTL_LOGIN_DEFAULT_SWARM = "https://${swarmDomain}";
|
||||
};
|
||||
|
||||
|
|
@ -339,7 +342,7 @@ let
|
|||
)
|
||||
++ lib.mapAttrsToList (
|
||||
name: value: "--set-default ${name} ${lib.escapeShellArg value}"
|
||||
) loginDefaultEnv
|
||||
) swarmDefaultEnv
|
||||
)
|
||||
}
|
||||
'';
|
||||
|
|
@ -633,8 +636,10 @@ in
|
|||
the socket itself is `0666`, exactly as hive-c0re publishes the
|
||||
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 (`swarmctl`,
|
||||
which bypasses mode bits) can reach the socket; every other local
|
||||
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
|
||||
the directory holds exactly one socket.
|
||||
Moving this path under a directory that carries anything else —
|
||||
|
|
|
|||
Loading…
Reference in a new issue