Watch
0
0
Fork
You've already forked hyperhive
0

egress: the forward chain refuses by default where the intercept is on

egress.forward defaults to reject while egress.intercept.enable is on (a
hive controller host turns it on) and to log otherwise, because reject
without the intercept would refuse all web traffic and an assertion
already forbids it. log stays an explicit choice.

The hive-squid VM test runs its log-mode half on the base node, so the
base pins forward = log at mkDefault priority and the reject
specialisation overrides it. A module-eval case covers the default on a
controller host, on a host without the intercept, and an explicit log.
This commit is contained in:
maia 2026-11-22 17:42:02 +01:00 • committed by mara
commit b8851743e8
2 changed files with 86 additions and 35 deletions

View file

@ -61,10 +61,10 @@ key changed and you didn't change the machine, don't clear it: something else
answers at that address.
The SSH switch and the CA don't open the network. The default `egress.forward`
of `log` lets the agent's direct connection to the machine's port through. If
you set it to `reject`, the hive refuses the connection unless you gave the
agent a named connection to that host and port (see
[Named connections](#named-connections)). See
is `reject`, so the hive refuses the agent's direct connection to the machine's
port unless you gave the agent a named connection to that host and port (see
[Named connections](#named-connections)). If you set `egress.forward` to `log`,
the connection goes through. See
[the network page](../../4-implementation/networking/network.md).
## 2. Make a machine trust the CA

View file

@ -233,9 +233,10 @@ when it speaks HTTP on port 80 or TLS on port 443 and its agent is `restricted`
or in `log` mode: the host redirects that traffic into squid's intercept ports
(see _Intercepted web traffic_ below). Everything else goes straight out through
the NAT, as before: the `unrestricted` agents, the service containers and every
other port and protocol. By default nothing blocks that. The host logs the direct
connections of the `restricted` and `log` agents, and `egress.forward =
"reject"` refuses them (see _Agent bridge egress log_ below).
other port and protocol. A hive controller host refuses the direct connections
of the `restricted` and `log` agents (`egress.forward = "reject"`, the default
while the intercept is on); `egress.forward = "log"` only logs them (see _Agent
bridge egress log_ below).
Squid filters on the destination hostname: a `CONNECT` target or a plain-HTTP
host. It never decrypts TLS. The one TLS key it loads is a throwaway that the
@ -727,7 +728,8 @@ loopback — the hive-c0re admin socket is a UDS, not TCP.
`services.hyperhive.deploy.hive-controller.egress.forward` sets what the `forward` chain of
the `inet hive_egress` table does with traffic the host routes from the agent
bridge to anywhere but the bridge. It takes
`accept`, `log` (the default) or `reject`. In `log` mode the chain blocks
`accept`, `log` or `reject`; the default is `reject` where the intercept is on
(see _The default_ below) and `log` elsewhere. In `log` mode the chain blocks
nothing. It logs each new flow and counts every packet. In `reject` mode it
also refuses the flow.
@ -756,12 +758,15 @@ also refuses the flow.
(and `hive-egress-reject-unmetered `); the rate limit and the counter work as
in `log` mode. Still open to every agent are the host's own addresses: the
proxy ports, DNS and DHCP from the bridge address, and the gateway.
- **Switching on.** Leave `log` running for about a week, then read the
`hive-egress-would-drop` lines. Each is a flow that `reject` would refuse; a
flow that belongs to a legitimate use needs a fix first (a service container
missing from `direct_mac`, an agent that should be `unrestricted`). Then set
`services.hyperhive.deploy.hive-controller.egress.forward = "reject"`. Making it the default
is a one-line change of the option's default.
- **The default.** `reject` while `egress.intercept.enable` is on, which
`hive-squid.nix` turns on for a hive controller host, and `log` on a host
without the intercept, because `reject` there would refuse all web traffic
too. The soak ran with `log` first: the `hive-egress-would-drop` lines are
each a flow that `reject` would refuse, and a flow that belongs to a
legitimate use needed a fix before the switch (a service container missing
from `direct_mac`, an agent that should be `unrestricted`). To go back to
logging, set
`services.hyperhive.deploy.hive-controller.egress.forward = "log"`.
- **What `reject` can break.**
- A service container with no pin yet isn't in `direct_mac`, so the
chain refuses it until `hive-egress-pin` binds its port. The bridge table