egress: document the allowed ssh connections
This commit is contained in:
parent
8ece0b7e0b
commit
eab2dcb0a2
1 changed files with 73 additions and 19 deletions
|
|
@ -147,7 +147,8 @@ stores a connection and by the agent before it renders one:
|
|||
its own proxy, so no direct connection there can exist.
|
||||
|
||||
The swarm doesn't check the hive's own bridge subnet, because each hive sets its
|
||||
own and an agent can move between hives.
|
||||
own and an agent can move between hives. Each hive drops an address of its own
|
||||
subnet when it resolves a host (see [Egress](#egress)).
|
||||
|
||||
`hive-agent`'s `ssh_connections.rs` renders the list each time the harness reads
|
||||
the record (every ten seconds) into `/run/hive-agent-ssh-connections/config`:
|
||||
|
|
@ -159,11 +160,35 @@ agent user, because ssh refuses an included file that another user owns.
|
|||
A controller older than the field drops the list when it next writes the
|
||||
record through `PUT /permissions`.
|
||||
|
||||
## Not covered
|
||||
## Egress
|
||||
|
||||
Egress. The default `egress.forward = "log"` lets a direct connection from an
|
||||
agent to a machine's SSH port through, and `reject` blocks it; there is no
|
||||
per-agent allowance for it yet.
|
||||
The hive's forward chain accepts a named connection of an agent that has `ssh`
|
||||
on, whatever `egress.forward` is (`log` or `reject`). Each hive does this for
|
||||
the agents it has:
|
||||
|
||||
1. `hive-c0re`'s `workers::egress_connections` reads the permissions the hive
|
||||
last read from the swarm and, for each agent with `ssh` on, resolves the
|
||||
`host` of each connection with the host's resolver. An IPv4 literal passes
|
||||
through. It asks the hosts of a pass together, each for at most five seconds,
|
||||
so a hung resolver delays the file by that long and no more. It keeps an
|
||||
answer for ten minutes and keeps the last answer when a lookup fails or
|
||||
times out (one warning, until the name resolves again). It drops loopback,
|
||||
link-local, multicast and IPv6 answers, and any address inside the hive's
|
||||
bridge subnet (`HIVE_NETWORK_SUBNET`) with one warning per host, because a
|
||||
flow to the bridge never reaches the forward chain. It writes
|
||||
`<agent> <ipv4> <port>` lines to `egress.connectionsFile`, beside squid's
|
||||
users file.
|
||||
2. `hive-priv egress-pin` maps each agent to the MAC of its port and fills the
|
||||
`agent_allow` set of the `inet hive_egress` table, in the same transaction
|
||||
as `direct_mac`. `hive-egress-connections.path` runs a pass when the file
|
||||
changes.
|
||||
3. The forward chain accepts `ether saddr . ip daddr . tcp dport @agent_allow`
|
||||
right after the `direct_mac` rule, so a matching flow is neither counted
|
||||
nor logged.
|
||||
|
||||
The allowance is for TCP and IPv4 only: the agent bridge has no IPv6
|
||||
addressing. An agent whose port has no binding yet has no allowance until it
|
||||
gets one. See [the network page](../networking/network.md).
|
||||
|
||||
## Revocation
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue