Skip to main content

Module receive

Module receive 

Source
Expand description

The receiving half: POST /agentmux/remote/op on the peer listener (spec §4.1-4.2, §6). Every refusal is an answer, status: refused with a refused_reason, never a prompt and never a downgrade; the order below is the order of the checks.

  1. the call came over the LAN key (a peer), not a local credential;
  2. this machine takes remote operations at all (network:remote_ops);
  3. the envelope is well formed, and meant for this machine (audience);
  4. it is fresh (a minute either way) and not older than this srv: the nonce store is in memory, so a request signed before a restart could be replayed after it;
  5. its signature verifies under the key this machine pins for that agent (reactive::lan_signer, the same judgement a LAN jekt gets), and the install the agent’s certificate names, when one is on hand, is the install it claims;
  6. the operation exists, and a state-changing one has a caller whose key is vouched for by a fresh certificate from an install this machine trusts;
  7. the nonce is new, or the first answer is repeated;
  8. the operation runs under a RemoteCaller.

The broadcast lan_key only gets a request here; it never authorizes one.

Structs§

Entry 🔒

Enums§

Reservation 🔒
What a nonce said when it came in.
Seen 🔒

Constants§

MAX_NONCES 🔒
Answers kept at most. Past this, with every entry still live, a new request is refused rather than evict a nonce a captured copy could then pass as.
NONCE_TTL_SECS 🔒
Longer than the clock window on both sides of it, so a request can’t outlive its nonce.
RUN_TIMEOUT 🔒
How long an operation gets to run before the requester is told it failed.
UNPROVEN_AUDIT_EVERY_SECS 🔒
UNPROVEN_AUDIT_MAX_PEERS 🔒

Statics§

NONCES 🔒
STARTED_AT 🔒
When this srv started, in Unix seconds: forced when the routes are built.
UNPROVEN_AUDITED 🔒
Peers whose unproven refusal was written to the audit trail lately, so a flood of bad requests from one address makes one row a minute, not a row each.

Functions§

audit 🔒
The audit row on this machine: remote.<op>, by agent@machine, with how it was proven and how it ended.
audit_unproven 🔒
A request refused before its signature verified: nobody is proven, so the row names the peer’s address, not the agent the request claims to be, and keeps none of the request’s own text.
handle_remote_op 🔒
machine_in 🔒
The name of the machine at from, among the LAN peers; a short label when none is known.
machine_name 🔒
mark_started 🔒
receive 🔒
handle_remote_op without the HTTP: now is the clock and started_at when this srv began.
reserve 🔒
settle 🔒