socialweb.computer

Request and provide VMs on an atproto compute market.

Guest Secrets

A secrets bundle is a list of {path, value, mode} entries in the requester's vault, named by the contract's spec.secretsRef. The guest fetches the bundle after boot. Secrets never appear in VM user-data, in a market record in the clear, or in logs.

The guest tries three delivery routes in order. Server to server, the peer transport is iroh, so a requester with an iroh listener does not open a WebRTC channel for secrets. WebRTC is reserved for requesters that cannot listen on iroh (such as those without a pipe binary, or a browser).

RouteWhen
1. Peer transportThe requester gave the guest a peer address
2. HTTPSThe requester has an HTTPS ingress
3. Sealed recordThe requester takes no inbound connection, and the guest asked

Contents

Workload Identity

Every route starts with the bidder's identity service issuing the guest a short-lived workload identity token for the requester's audience. The requester checks the token's issuer, audience, and subject on every fetch:

diagram
requesterbidder (identity service)guest VMrequesterbidder (identity service)guest VMsent as Authorization: Bearer on routes 1 and 2token for audience Rworkload identity token (this contract's VM)

Route 1: Peer Transport

When the requester provides a peer address, the guest fetches the bundle over the peer link:

diagram
requesterguest VMrequesterguest VMeach file written at its path with its modepeer link (iroh, or WebRTC to a browser requester)getSecrets + tokenbundle

The guest agent holds the peer link and exposes it as a local socket for the fetch, and iroh traffic goes through our relay, https://iroh.socialweb.computer. The requester runs an iroh listener only while one of its contracts has a secretsRef. If the listener has no address after 60 s, the guest gets HTTPS alone. If neither route is available, the contract fails with no secrets channel.

Route 2: HTTPS to the Requester

If the peer link returns no bundle and the requester has an HTTPS address, the guest falls back to HTTPS:

diagram
requesterrequester https ingressguest VMrequesterrequester https ingressguest VMhttps getSecrets + tokenforwardbundle

The guest tries route 1 and then route 2 for up to 10 rounds, 5 s apart (the loop is in internal/atproto/cloudinit/modules.go, and the numbers are in guestsecrets.go).

Route 3: Sealed Record

When the requester takes no inbound connection (comms mode Firehose) and its secretsFallback is Sealed, the guest requests a sealed bundle through market records:

diagram
requestermarket recordsbidderguest VMrequestermarket recordsbidderguest VMopens it with the key only it holdsguest.secretsRequestedsigns and publishes itguest.secretsRequestedbundle sealed to the guest's key (age x25519)sealed record

This route is never used if the requester has any inbound endpoint. The requester sends a sealed bundle only after the guest asks, never unasked. The bidder relays the ciphertext (at most 65536 bytes) and cannot open it.

Routes by Requester

Which route a contract uses depends on the requester:

RequesterRoute
CLI run requestiroh, then HTTPS
Any Go requester with no pipe binaryWebRTC, then HTTPS
k8s gateway (cluster nodes' join credentials)iroh, then HTTPS
ssh gateway (a paired account's co/core key)iroh, then HTTPS where the gateway has an HTTPS ingress (prod has none)
Browser pageSealed record

Requesters are wired up in four places, and all four get the iroh route through one shared function: internal/app/marketrequester, internal/app/gateway, and internal/app/sshgateway (its own requester plus one per signed-in account).

Guest Setup

Every path in the bundle must be clean and absolute. Only missing directories are created (0700, owned by root), and each entry's mode is honored with a default of 0600. If any entry is refused, the whole bundle is refused and nothing is written. setup-secrets.service runs once, and units that need the secrets start after it.

References

On the requester side, ensureSecrets and getSecrets live in internal/market/requester/secrets.go, and the sealed record path is in guestsecrets.go. Look for requester_guest_secrets_fetched ... channel <iroh|webrtc|https> and requester_guest_secrets_sealed in the requester logs.

On the guest side, secrets are applied by /usr/local/bin/setup-secrets.sh and logged under journalctl -u setup-secrets. The contract reports the SecretsApplied condition with reason GetSecretsIroh, GetSecretsWebRTC, GetSecretsHTTPS, or SealedFallback.

The design rationale is recorded in plan 0040 decision 64 (peer transports first) and plan 0060 (the ssh gateway, where server to server is iroh).