Watch
0
0
Fork
You've already forked hyperhive
0

egress: let every agent reach the swarm's own endpoints under forward reject

With the egress intercept on, the forward chain rejects what `agent_allow`
does not hold, and `agent_allow` only held an agent's ssh connections. An
agent whose secret store, queue, logs or metrics endpoint is not on the
bridge was refused, so no agent started on a hive away from the swarm host.

hive-c0re's egress worker now also renders a `* <ipv4> <port>` line for each
endpoint URL it hands to agents (HIVE_AGENT_BAO_ADDR, HIVE_AGENT_LOGS_QUERY_URL,
HIVE_AGENT_METRICS_URL, HIVE_AGENT_NATS_URL), resolved like the ssh hosts.
`hive-priv egress-pin` expands a `*` line to the MAC of every agent port. An
older hive-priv skips the line, as it skips any unknown name.

Closes #6902
This commit is contained in:
maia 2026-11-27 07:52:24 +01:00 • committed by mara
commit ecfc21b962
2 changed files with 205 additions and 13 deletions

View file

@ -381,7 +381,10 @@ in
The file hive-c0re renders with the SSH connections each agent may open,
one `<agent> <ipv4> <port>` per line: the addresses behind the `host` of
each connection in the permissions record of an agent whose `ssh` switch
is on. `hive-priv egress-pin` turns each line into elements of the
is on. A `*` line instead of an agent name allows the address and port to
every agent: hive-c0re writes one for the secret store, the queue, the
logs and the metrics endpoint of the swarm, so that `reject` does not cut
agents off from them. `hive-priv egress-pin` turns each line into elements of the
`agent_allow` set of the `inet hive_egress` table, keyed by the MAC of
the agent's port, and the forward chain accepts TCP to an address and
port in it before it logs or refuses. The file is read when a port is

View file

@ -616,6 +616,22 @@ let
name = "a hive with no store identity forwards no store address to its agents";
ok = !(bare.systemd.services.hive-c0re.environment ? HIVE_AGENT_BAO_ADDR);
}
{
# hive-c0re's egress worker reads these three names and lets every agent
# open a connection to each address (`egress_connections.rs`,
# `ENDPOINT_ENVS`). The names are spelled in both places, so this is the
# nix half of that agreement, with the file's own variable as the
# presence control that the worker runs on this host at all.
name = "the environment of a hive that runs the egress worker names the store, logs and metrics endpoints its agents use";
ok =
let
e = allLocal.systemd.services.hive-c0re.environment;
in
e ? HIVE_EGRESS_CONNECTIONS_FILE
&& lib.hasPrefix "https://" e.HIVE_AGENT_BAO_ADDR
&& lib.hasSuffix "/select/logsql/query" e.HIVE_AGENT_LOGS_QUERY_URL
&& lib.hasPrefix "https://" e.HIVE_AGENT_METRICS_URL;
}
{
# The gateway's per-name issuer choice. If this ever collapses to a
# constant, every swarm-service vhost serves a certificate its CA