Skip to content

Commit 5943f4d

Browse files
committed
docs: a router serves nothing before the handshake
1 parent 76d21c3 commit 5943f4d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎site/content/docs/contributing/security-architecture.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,3 +594,14 @@ response directly).
594594
members on charset grounds and quotes wildcard string literals with
595595
`strconv.Quote` before rendering `.starts_with(...)` or `.ends_with(...)`
596596
Datalog rules.
597+
7. Nothing interacts with the mesh unauthenticated. A router or a member
598+
serves a mesh protocol (the DHT, gossip, the relay, the data plane) only to
599+
a peer that completed the credential handshake on that connection and whose
600+
credential has not lapsed. The protocols open to a peer before that are the
601+
ones the handshake needs: the transport security handshake, identify and
602+
`/mesh/auth`. The DHT and gossipsub are built on a host wrapper that holds a
603+
stream until its peer is authenticated and resets it when the connection
604+
closes first, counted in `*_streams_refused_total{scope="unauthenticated"}`;
605+
a router's routing table admits authenticated peer routers only. A
606+
directory lookup and a gossip subscription are mesh data, so this covers
607+
reads as much as writes.

‎site/content/docs/reference/router.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ replica count.
6464
router on `/info` while the lease is live.
6565
4. Runs the mutual credential handshake on every inbound connection and
6666
refuses peers whose credential does not verify and peers on the ban list.
67+
Until a peer passes it, the router serves it nothing but the handshake:
68+
a DHT or gossip stream it opens waits, unread, and is served once the
69+
peer is authenticated, or reset when the connection closes at
70+
`--auth-deadline` first. A member's streams open on connect, a moment
71+
before its handshake completes, which is why they wait instead of being
72+
refused outright. The routing table admits authenticated peer routers and
73+
nothing else, and the router queries no one else either.
6774
5. Refreshes its own credential before it expires, like a node.
6875
6. Every 5 seconds, compares the members it holds, the peers that passed
6976
the handshake, with `--high-watermark`. At the mark it picks members at
@@ -120,7 +127,7 @@ The metrics address exposes, next to the Go runtime metrics:
120127
| `agentmesh_router_goaway_sent_total{reason,result}` | Members sent away, by reason (`DRAINING`, `OVERLOADED`) and outcome: `ok` when the member took the message, `unsupported` when it does not speak the protocol and was closed instead, `failed` when the stream broke. A rising `OVERLOADED` count on a router that is not draining is a fleet that has outgrown its routers. |
121128
| `agentmesh_router_unauthenticated_connections_closed_total` | Connections closed at `--auth-deadline` without a handshake. Members handshake with every router they connect to, so a steady rate is members running a node release that predates that, and a burst is a scanner. |
122129
| `agentmesh_router_inbound_connections_refused_total` | Inbound connections refused by the per-address cap. |
123-
| `agentmesh_router_streams_refused_total{scope,protocol}` | Streams the resource manager refused, by scope and protocol or service. A count on `/mesh/kad/1.0.0` or a `/meshsub/*` protocol is members the router keeps out of discovery; see the scalability guide. |
130+
| `agentmesh_router_streams_refused_total{scope,protocol}` | Streams refused, by scope and protocol or service. `scope="unauthenticated"` is a stream from a peer that never passed the handshake, reset when its connection closed; a steady rate is a scanner, or a member whose handshake fails. The other scopes are the resource manager's: a count on `/mesh/kad/1.0.0` or a `/meshsub/*` protocol there is members the router keeps out of discovery; see the scalability guide. |
124131
| `agentmesh_router_busiest_connection_streams{transport}` | The most streams any one connection carries. The connection to a service the router relays for holds one stream per relayed caller, and QUIC admits 256 per connection; see the scalability guide. |
125132
| `libp2p_relaysvc_*` | The relay service's own counters: `reservations_total{type}` and `connections_total{type}` (`opened`, `closed`, `renewed`), requests by response status, rejections and bytes relayed. The difference between `opened` and `closed` is the number in use; read it against `agentmesh_router_relay_limit` to see how close the relay is to its budget. |
126133

0 commit comments

Comments
 (0)