Skip to content

Joining the hoard by invite

Kata issue 86ta. Brainstormed with Gavin on 2026-11-23.

Why

Installing smaug by hand took about eight steps across two machines: CA init and client keygen and signing on the laptop; a first install.sh run that prints the host key; copying the host key to the laptop, signing it, and copying the certificate and ca.pub back; getting the client's node key (allmyram client-key) onto the runner's --allowed; a second install.sh run; and reading the runner's tailcat address out of a root-only file into client.json. On top of that, host certificates expire after 30 days and client certificates after 24 hours, and both are renewed by hand. Gavin: "we're going to need a better bootstrapping process", and "the current key exchange is not much fun".

The goal is one command on each side, a fingerprint compared on both screens, and an approval, with security kept as it is today or better.

Goals

  • A new runner joins with allmyram invite on the laptop, one install command with --join on the runner (invite pasted at a prompt), and the owner's approval after comparing a short fingerprint on both screens (Gavin: "have me manually allow it after presenting it and doing fingerprinting live").
  • Nothing is copied by hand except the invite. No host keys, certificates, CA keys or node keys cross between machines through a person, and no one reads a secret file: the runner's address reaches client.json inside the join session, and the laptop's tailnet IP (today's --tailnet-peer) reaches the runner the same way.
  • The CA key can live in the Secure Enclave behind Touch ID.
  • At most one Touch ID prompt a day in the background, however many runners there are (Gavin: "ONCE a day", "not once a day per computer"). A join uses the day key, so it prompts only if the day's prompt has not been given yet. Approving a new client key and revoking one are signed by the owner key itself and always prompt, as actions the owner starts. Early day-key renewals happen only at a terminal, while the owner is there.
  • A stolen laptop loses access on its own within a day, without the owner noticing or doing anything, because renewing its access needs Touch ID (Gavin: "having to do touch ID at least once a day on the laptop is 100% fine").
  • Host certificates expire ("on principle", Gavin) and renew themselves without adding prompts. A runner left unused until its certificate expires is recovered with one command, allmyram renew <runner>.
  • The owner can remove a runner and revoke a client key. A revocation takes effect on each runner as soon as that runner has it; the laptop keeps delivering it until every runner does.
  • The join protocol is independent of the CLI, so a UI (the tracker UI, a native app) can drive the same steps later (Gavin).
  • Every member joins the same way. The spec says of the hoard "none is special", and Gavin noted the single client "shouldn't be quite as special as it is". The CA is the one special thing: it is the owner's root key. The machine it happens to live on is not special.

Non-goals

  • A second client machine. The only client is the laptop that holds the CA; the tracker UI is assumed to run on that same laptop. An iOS app is a possibility "a ways off". Renewal for a client away from the CA is out of scope; nothing here may make it harder (see "Left open").
  • Moving the CA off the laptop.
  • Changing the transport, the job protocol, or the egress self-check. --registries stays an install flag; --tailnet-peer stays as an override.
  • Making certificate lifetimes configurable. They are constants for now.

Anti-goals

  • Weakening security. In particular, no join that rests only on the owner comparing a fingerprint. LAN discovery with fingerprint-only approval (Bluetooth style) was rejected: "C is a hard no".
  • A runner's long-lived tailcat address appearing on any screen or in any file a person has to read.
  • Dropping SSH certificates in favour of tailcat keys alone (see Approaches).
  • Touch ID prompts that scale with the number of runners.
  • Depending on an agent feature nobody has verified (such as one Touch ID covering several signatures).

Constraints

  • Transport is tailcat v0.7.0. Server.AllowedClients empty means "everyone" (transport.Listen refuses an empty list for that reason). Server.AddAllowedClient adds a key at runtime; there is no way to remove one without restarting the server.
  • A tailcat address is a bearer secret shared by every client of a runner. It can be revoked only by giving the runner a new key, which changes the address for everyone.
  • The runner's SSH server (internal/sshsrv) and the client (internal/client) both check certificates with ssh.CertChecker.
  • On Linux, /etc/allmyram is root-owned and not writable by allmyram-runner; the runner's writable state is under /var/lib/allmyram/runner/state. install.sh is the only step that runs as root. The macOS runner's allmyram install (on the plan-2 branch, not yet on main) has the same flags. My call: this work builds allmyram join as a command any installer can call, and wires it into install.sh. The macOS installer gains --join in whichever branch merges second.
  • The day key's private half is a file on the laptop, kept 0600 in a 0700 directory. Today prepareCADir checks the directory only when the CA is created, and loadCA checks only the key file; the day key's loader checks both.
  • OpenSSH certificates cannot chain: there is no intermediate CA. Any chaining is allmyram's own check, done in allmyram's client and runner.
  • The Secure Enclave holds only P-256 keys, so a CA key kept there is ecdsa-sha2-nistp256, which x/crypto/ssh and OpenSSH both support. Signing through an ssh-agent (x/crypto/ssh/agent) works for any key type the agent holds.
  • Secretive appears to ask for Touch ID on every use of a key; no setting that keeps a key unlocked for a while could be found.

Approaches

Five decisions shaped the design.

Whether SSH certificates stay.

  1. Keep them; fold the node key into joining (chosen). Approval signs the machine's certificate and puts its node key on the runner's allowed list.
  2. Drop them. Tailcat keys become the identity and runners sync an approved-members list. Less machinery, no expiry, and revoking means removing a key everywhere.

Gavin picked 1: it gives authentication at the SSH layer as well as the network layer, and certificates can be revoked one by one, while "it's unclear how we'd revoke addresses easily".

How the two machines find each other.

  • A. The laptop listens, the runner dials (chosen). allmyram invite opens a temporary tailcat listener and prints its address as the invite. The runner dials it. The runner's real address never reaches a screen. A future UI can keep a listener open and show joins as pending.
  • B. The runner listens, the laptop dials. The same protocol reversed; just as secure, and nicer when sitting at the new machine, but the approving side has to initiate, which suits a UI that waits for pending joins less well.
  • C. LAN discovery (mDNS) and fingerprint only. No paste at all, but LAN only, and the fingerprint becomes the only authentication. Rejected.

Where the CA key lives. Gavin asked to keep it in the macOS keychain.

  • A generic-password keychain item holding the key file. Encrypted at rest, but allmyram still loads the whole private key to sign. Small gain.
  • A Secure Enclave key, used directly. Never leaves the hardware, Touch ID per signature, but needs cgo and (probably) a signed binary with keychain entitlements.
  • Sign through an ssh-agent (chosen). The agent decides where the key lives: Secretive (Secure Enclave, Touch ID), 1Password, a YubiKey. No cgo or entitlements in allmyram.

How a stolen laptop is cut off, and how Touch ID prompts stay at one a day. Gavin asked how to stop a stolen laptop's access easily. The options were a lockdown command run as root on each runner, a signed stop notice that runners poll for, Touch ID on every connection, and access that lapses on its own unless Touch ID renews it. Gavin chose the last, with one prompt a day in total and host certificates that still expire. Ways considered to fit host renewals into one prompt:

  • A day key (chosen). The daily Touch ID certifies a fresh key for 24 hours; that key signs everything else that day. One prompt whatever the agent does. Costs a small chaining check of allmyram's own.
  • One Touch ID covering several signatures. No custom chaining, but no agent was found that does it.
  • Rejected along the way: a permanent quiet "renewal key" for client certificates (a stolen laptop could then renew itself forever); host certificates that never expire (Gavin: they "should still expire, on principle").

How runners know which client keys to admit, and how one is revoked.

  • A signed, versioned set of approved keys. The owner key signs the whole list of client keys plus a version number; runners keep the highest version. Tried first, and dropped: the number lives in a file on the laptop and goes backwards if ~/.config/allmyram is restored, and a set signed from stale contents can bring a revoked key back. Six rounds of security review each found another such path, and each patch (reconciling every runner's set, a per-runner record of removed keys, a "re-pinned" marker) made the next path possible. The write-ups are 2026-11-24-revocation-problem.md and its response.
  • Each key approved once, revocations permanent (chosen, from Carbon's response). The owner key signs an approval of each client key, which rides in that key's certificates, so runners keep no list of approved keys. Revoking signs a separate statement for one key; runners and the laptop keep every revocation they have seen and swap them on each connection. Revocations only accumulate and can only take access away, so nothing depends on order, versions or the laptop's files being current. The day key is not revoked this way (Gavin: that would leave "a bunch of those lying around"); it cannot approve a client key, so a copied day key gains nothing a revocation needs to stop.

Design

Operations are a library; the CLI is one front end

Every operation this design names as a command (init, invite and approving a join, join, making and renewing a day key, revoke, rotate-client-key, remove, renew) is a function in a Go package, with the CLI as a thin layer that parses flags, prints, and asks for confirmation (Gavin: "most of the things we're saying are cli commands should really be library commands that happen to have cli interfaces"). The library takes its interactions as parameters rather than reading a terminal: approving a join is a callback that receives the pending join (name, fingerprint) and returns approve or refuse; progress and "these runners were not reached" come back as values, not printed text. The tracker UI or a native app then calls the same functions. Whether the caller is at a terminal (for early day-key renewal) is an input to the library, decided by the front end.

A read-only status operation (Gavin: wanted "for debugging sanity"), allmyram info on the CLI (my call for the name: status already prints a run's state). It never asks the agent to sign, so it never prompts. It reports:

  • the fingerprint of owner.pub and whether the agent offers that key, so it is obvious which Secretive key the laptop points at;
  • the active client key's fingerprint, whether its approval verifies under owner.pub, and whether the laptop holds a revocation of it;
  • how long the day key and client certificate have left, or that they have expired;
  • the runners in client.json, each with its host-certificate expiry as last seen on connecting;
  • how many revocations the laptop holds.

The last-seen expiries live in a separate 0600 cache file beside client.json, never in client.json itself: every connection (including git-ssh during run) updates them, and the file holding the runners' addresses, which are bearer secrets, should not be rewritten on every connection.

My call, left to the builder to refine: one package for the owner's side (laptop: day key, invite, revoke, rotate-client-key, renew) and one for the runner's side of the join, beside the existing internal/client and internal/runner.

Members, roles and the owner key

Every machine in the hoard is a member with a key pair and a certificate. A runner's certificate is a host certificate whose principal is its name; a client's is a user certificate with principal client, as today.

There is one CA key, the owner key. It is reached through an ssh-agent (SSH_AUTH_SOCK, or a socket named in the config), so it can live in the Secure Enclave behind Touch ID. There is no key-file fallback (see below). The owner key signs only three things: day-key certificates (below), client-key approvals and revocations (both under "Removing and revoking"). An approval or a revocation is signed over a canonical binary encoding (SSH wire format) that starts with a fixed domain tag, "allmyram-client-key-v1\x00" or "allmyram-revoke-v1\x00", which no OpenSSH certificate can begin with, followed by owner.pub and the client key it names. Every signature the agent returns is verified against owner.pub on the laptop before anything is saved, so a wrong or hijacked agent socket fails at once rather than later on a runner.

The day key

Once a day, the laptop makes a fresh key pair, the day key, and asks the owner key to certify it for 24 hours. That is the day's one Touch ID prompt. The day key's private half stays on the laptop (0600, beside the client key) and is discarded when it expires.

The day key signs:

  • the laptop's client certificate (valid until the day key expires);
  • host certificates (30 days), at join and at renewal.

Every certificate the day key signs carries the day key's own certificate in an extension, so it can be checked on its own. The checks, done in allmyram's client and runner around CertChecker:

  • A day-key certificate is valid if the owner key signed it, it carries the day-key principal and nothing else, and it is a user certificate. Neither a client certificate nor a host certificate can pass as one. Verifiers cap its span themselves: Touch ID does not show what is being signed and any process of the owner's can reach the agent socket, so a rogue process could get a ten-year day key signed on one tap. A day-key certificate whose ValidBefore - ValidAfter exceeds 24 hours plus twice the clock-skew allowance (24h10m) is rejected, as is one whose ValidAfter is in the future.
  • A client certificate (checked by runners) is valid if it is valid now, its day key's certificate is valid now, it carries an owner-signed approval of the key it certifies (in an extension), and that key is not revoked on that runner. So a client certificate dies with its day key: at most 24 hours. The limit also holds for connections already open. An SSH connection authenticates once and can then open new sessions, so the runner closes each authenticated connection when the earlier of the client certificate's and its day key's expiry arrives, and when the certified key is revoked. A legitimate client renews and reconnects. Closing cancels the connection's context, so its child processes (such as git-receive-pack) stop too. Two details keep this tight: the connection is registered in the runner's set of live connections under the same lock that records revocations, then rechecked (not revoked, not expired), so a revocation landing during the handshake is not missed; and expiry is checked against the wall clock before each new channel is accepted and on a 30-second ticker, not only by a timer, because monotonic timers can stall while a Mac sleeps. Running jobs are not affected (they belong to the runner, not the connection); an attach or a service lease held on that connection drops and must be re-established, which the client does after renewing.
  • A host certificate (checked by the client) is valid if it is valid now, names the runner, certifies the host key pinned in client.json, and it ends no later than 30 days after its day key does (ValidBefore of the host certificate ≤ the day key's ValidBefore + 30 days). So a host certificate keeps up to 30 days after the day key that signed it has expired. A certificate's ValidAfter is chosen by the signer and proves nothing about when it was signed, so the bound is on the end date, which an expired day key cannot push forward: anyone holding an old day key can mint host certificates only until 30 days after it expired, and they must also hold that runner's host private key, since the pinned host key still has to match. The client checks the chain explicitly: the day-key certificate's signature under owner.pub, the host certificate's signing key equal to the day key, and the host certificate's signature under it. Host certificates carry their member's role (role@allmyram), checked exactly; today the only role is runner.

Rules for every certificate, on both sides. A host certificate keeps working after its day key has expired, so CertChecker.CheckCert cannot simply be run on the day-key certificate at the current time; the custom check must therefore restate everything CheckCert and sshsrv enforce today:

  • reject ValidBefore == ssh.CertTimeInfinity on day-key, client and host certificates, and do the "+ 30 days" arithmetic only after that, so it cannot wrap;
  • require ValidAfter < ValidBefore and ValidAfter <= now;
  • require no critical options on any of them, including the embedded day-key certificate (today's sshsrv rule);
  • client certificates: ValidBefore <= the day key's ValidBefore;
  • host certificates: span at most 30 days plus twice the skew allowance (30d10m).

The verification lives in one shared function used by runner and client, with tests for each rule.

Clocks that disagree are named as the cause. Every certificate is stamped by the laptop's clock and judged by the runner's, so a runner whose clock is more than the skew allowance from the laptop's refuses good certificates. The runner states its time in the SSH banner it sends before authentication (allmyram-time <unix seconds>) and in its join hello (covered by the fingerprint like the rest of the hello). The client warns once when the gap passes a minute; when a refused handshake comes with a gap past the skew allowance, the error names the gap and says to set the clock right, instead of pointing at a revoked key, and is not retried. The laptop refuses a join whose gap is past the skew allowance before asking the owner, and tells the runner why. The runner logs a refusal that looks like skew (a certificate or its day key not valid yet, or expired within ten minutes) with its own time and the certificate's.

Each machine checks its own clock, so the message can say which is wrong. The banner also carries the runner's offset from true time: "os" when the kernel keeps the clock in sync (Linux adjtimex read-only: state not TIME_ERROR, STA_UNSYNC clear), a measured offset from an NTP query otherwise (github.com/beevik/ntp, response validated), or "unknown". The runner checks at start and then every 6 hours give or take an hour, never more than 4 queries in an hour, pauses after a kiss of death until the next scheduled check, and also queries, within the same limit, after a refusal that looks like skew, even when the kernel reports sync. The laptop (macOS offers no unprivileged sync check, and keeps its clock in practice) queries only when it disagrees with a runner by more than a minute, at most once an hour, caching the result beside client.json; allmyram info shows the cached result and never queries. Messages then name the culprit ("runner "smaug"'s clock is 7m0s fast and this laptop's is correct"), falling back to the gap alone. NTP never gates anything: an unreachable server only makes an offset unknown. ntp_server in runner.json and client.json names the server ("" for the default, "off" for none).

What a stolen laptop yields:

State when stolen Today (CA file on the laptop) This design
Off or locked, FileVault on Nothing Nothing
Unlocked, or password known Every runner, for good: the thief can sign anything Every runner until the current day key expires, at most 24 hours, unless the owner revokes first. A new day key needs the owner key, which cannot leave the Secure Enclave and needs Touch ID

The owner key's unlock mode sets the guarantee. Secretive's SecureEnclaveStore.swift creates an authenticated key with one of two flag sets: "presence required" is [.userPresence, .privateKeyUsage] and "current biometry" is [.biometryCurrentSet, .privateKeyUsage]. Apple's documentation for SecAccessControlCreateFlags.userPresence says it is a "constraint to access an item with either biometry or passcode", and for .biometryCurrentSet a "constraint to access an item with Touch ID for currently enrolled fingers, or from Face ID with the currently enrolled user". So .userPresence accepts the device passcode (the login password on a Mac) and .biometryCurrentSet does not.

  • Presence required: a thief who knows the password can make new day keys, so the guarantee weakens to "until revoked".
  • Current biometry: the table above holds. But changing the enrolled fingerprints invalidates the key, which means a new CA and rejoining every runner, and with no Touch ID sensor at hand (a closed laptop on an external keyboard without one) no day key can be made.

Current biometry is the recommended mode (Gavin chose it). Losing the key costs only a fresh allmyram init and a rejoin of each runner (invite on the laptop, install.sh --join as root on the runner), which this design makes a few minutes' work: "Oh no, I have to spend a few minutes reconnecting the computers". allmyram still works with a presence-required key, and the docs say plainly what it gives.

My call: no key-file fallback for the owner key. A key file is readable by anyone using the laptop, so it would make day keys forever and void the 24-hour cutoff; offering it is a guardrail to get wrong. The owner key is always reached through an agent. Tests use an in-process agent (x/crypto/ssh/agent's keyring).

Recovering from a lost owner key, in order: create a new current-biometry key in Secretive, run allmyram init naming it, then rejoin each runner. init and every command that needs the owner key report clearly when the configured agent key is missing or no longer usable, and say these steps.

When the client needs a signature and the day key has expired, it makes a new one, prompting for Touch ID. New day keys may also be issued early (Gavin), so unattended work does not stall at an awkward hour:

  • A command run from a terminal (stdin is a TTY), meaning the owner is there to touch the sensor, renews the day key when it has fewer than 8 hours left.
  • allmyram renew-day-key renews it on demand, for instance before leaving agents running overnight.
  • Commands without a terminal (agents, scripts) never renew early; they prompt only once the day key has expired.
  • The decision is made once, when a command starts, not at each connection. allmyram run reaches the runner first through git push, whose allmyram git-ssh child has pipes rather than a terminal; deciding per connection would skip renewal there and then prompt halfway through the same run.

So a prompt the owner did not expect comes at most once a day; an early renewal is one they were present for. My call: 8 hours, a constant like the other lifetimes. A renewed client certificate is used for new connections; open ones keep running until the old certificate's expiry closes them. If the prompt is refused or the agent is unreachable, the command fails with a message saying so rather than waiting. Making a day key holds a lock file beside it; a process that waited on the lock rereads the day key and uses it if another process just made one, so concurrent commands never prompt twice.

Consequence, accepted: a long stretch of unattended agent work that crosses the day key's expiry stops at the first command after it, until the owner is back to touch the sensor.

Setting up the laptop: allmyram init

One command that does what ca init, keygen and ca sign-client do today: uses the owner key from the agent (named by its fingerprint), creates the laptop's client key and tailcat key, signs the client key's approval, makes the first day key, and signs the first client certificate. That is two Touch ID prompts, once. Every file under ~/.config/allmyram holding a secret is checked to be 0600 in a 0700 directory, at init and whenever it is loaded (today's client only creates the directory 0700 and never refuses a looser one). My call: ca init, keygen, ca sign-client and ca sign-host are removed: their certificates carry no day key, so runners on the new scheme would reject them, and keeping a second way to mint certificates is a guardrail to get wrong.

Joining a runner

  1. On the laptop, allmyram invite starts a tailcat server on a fresh, throwaway key with no allowed-client list (the invite's pre-shared key is what gates it), serving only the join port (ServedTCPPorts), and writing no key or address file to disk. It also makes a fresh, throwaway ed25519 invite signing key. It prints the tailcat address together with that signing key's public half: that is the invite. It waits for one connection, for at most 15 minutes, then closes the listener whether or not anyone joined. It never accepts a second connection. Once a connection arrives, the exchange in step 3 must finish within 30 seconds (separate from the time the owner takes to approve), and every join message is read through a 64 KiB limit.
  2. On the runner, install.sh --name smaug --join installs as today, with the runner service stopped. --join is a plain flag. Before any slow install step, install.sh reads the invite: it prompts Invite: on the terminal when there is one, and otherwise reads one line from stdin. The invite is never on the command line, where ps would show it to other local users and shell history would keep it. It then checks the invite's form at once (a local allmyram check, no network), so a bad paste fails before packages are installed. --join is never saved for reruns. install.sh (as root) makes the host key as it does today, then runs allmyram join as allmyram-runner (via runuser), passing the invite on stdin, so no network-facing code runs as root. join makes the runner's tailcat key in its state directory (choosing the DERP region now rather than at first start, so it knows its address) if it does not exist, and dials the invite with a fresh throwaway node key, never the runner's permanent one, so the relay cannot link the invite session to the runner's long-lived address.
  3. The exchange, commit first. The laptop opens with a commitment: a hash of a fresh 256-bit nonce and its whole message. The runner then sends its nonce and its message: its name, its SSH host public key, its tailcat address, the throwaway node key it dialed with, the owner key it currently trusts and the revocations it holds under that key (neither on a first join), all signed by its host key to prove it holds that key. Only then does the laptop reveal its nonce and message: the owner public key, its revocations, its tailcat node key, the invite signing key's public half, and its tailnet IP for the egress self-check (what --tailnet-peer gives today). The runner checks the reveal against the commitment, and checks that the invite signing key matches the invite it was given, before showing anything; a mismatch means the invite was changed in transit, and join stops. Because the laptop is bound to its message before seeing the runner's, and the runner sends before seeing the laptop's, someone who swapped the invite in transit and sits between the two cannot search offline for messages that make both screens match: they get one blind guess. The laptop also checks that the throwaway node key in the runner's message is the one tailcat reports for the connection, and that the runner's name is a valid runner name.
  4. Both sides show the same fingerprint, computed over the whole invite (server key, pre-shared key and invite signing key), the runner's throwaway node key, both nonces and the complete exchange, each part length-prefixed under a fixed domain tag ("allmyram-join-sas-v1\x00") with the direction of each message, so no two different exchanges can hash alike. It carries at least 40 bits (for instance four words from a fixed list). The laptop shows the runner's name and whether this is a new runner or a replacement for an existing one (same name, different host key or address), and asks the owner to approve.
  5. On approval, the laptop signs the host certificate with the day key (making one first, with Touch ID, if none is valid). If the runner trusts the same owner key, the laptop verifies the runner's revocations against it and adds them to its own. If one of them revokes the laptop's active client key, the join stops here, writing nothing, and points to rotate-client-key, after which the join is run again. The finish is serialized with revocations. From here until the runner acknowledges, the laptop holds the revocation lock: it rereads its revocations under the lock and sends them (so a revoke made while the owner was approving is included, and a revoke started now waits the few seconds until the join finishes and then reaches this runner through client.json like any other). It sends the certificate and the revocations. The runner's side validates every value it was sent (parses each key, rejects certificates where a plain key belongs, parses the tailnet IP, verifies each revocation against the owner key). It writes the owner-signed items, the revocations (added to those it holds under the same owner key; under a new owner key the old ones are discarded, since they only ever applied to the old key) and the host certificate, into its state directory. It does not write the trust settings (owner.pub, the allowed node keys, the tailnet peer). The laptop sends them as a trust bundle signed with the invite signing key, bound to this runner's name and host key; join passes the bundle unchanged on stdout to install.sh. install.sh, as root, hands the bundle and the invite it read itself to a local allmyram subcommand (no network; shell cannot check an ed25519 signature), never trusting anything the runner process says about which key to use. That subcommand verifies the signature, validates every value and writes them into root-owned /etc/allmyram. A process running as allmyram-runner cannot forge the bundle, because it never sees the invite signing key's private half. It then tells the laptop it is done and waits for the laptop's acknowledgement before exiting (calling tailcat's Client.DrainTCP with a short timeout, so the last bytes are not lost when the process ends). Only then does the laptop write the runner's name, address and SSH host public key into client.json, under its lock, rereading it first, and release the revocation lock. install.sh carries on to start the runner.
  6. Before approval, the only things written are the runner's own host and tailcat keys from step 2, which a retry reuses. On refusal or timeout, nothing else is written on either side, and both say so. If the session drops after approval, the runner may be configured while the laptop has no entry for it. The laptop then says the join did not finish, and the fix is to run invite and --join again: repeating a join is always safe.

The invite carries the laptop's key, so a runner given the genuine invite can only be talking to the laptop that printed it. The commitment and the fingerprint protect against an invite that leaked or was swapped: whoever uses it first is the one the laptop sees, and a person in the middle cannot make the two screens agree except by a one-in-2⁴⁰ guess.

Who may write what on a runner. The trust root and the outer gate (owner.pub, the allowed node keys, the tailnet peer) stay in root-owned /etc/allmyram, so a compromised allmyram-runner account cannot install its own owner key or admit its own client, now or after a restart. They change only through install.sh (a join), which writes them with Go's json.Marshal from validated values, never by splicing text into runner.json as install.sh does today with --tailnet-peer and --allowed. The runner's state directory holds only things that must be signed by the owner key (directly or through a day key) to be accepted: the revocations and the host certificate. A compromised runner account could delete revocations from its own state. That cannot admit a key the owner never approved, the laptop puts them back on its next connection, and a revoked key's certificates still die with their day key within 24 hours, so the most it buys is the rest of that day.

The protocol messages are defined in a package of their own (say internal/join), with the CLI and the future UI as two drivers. "Wait for a join, show it as pending, approve or refuse it" is the interface a UI needs.

My call: the invite listener is a second entry point in internal/transport (one connection, throwaway key, no allowed list, a deadline), so it shares the existing log redaction. "Not changing the transport" means not replacing tailcat; adding to the package is fine. tailcat v0.7.0 documents an empty AllowedClients as allowing every client, leaving the address's pre-shared key as the gate, which is what the invite needs. A future UI showing pending joins still makes one such single-connection, time-limited server per invite; it never keeps one open listener for several joins, which would make an invite reusable.

My call: the laptop's tailnet IP is found from Tailscale's own interface (tailscale ip -4 when available, given at most 5 seconds since it waits on the Tailscale daemon, otherwise the address on the Tailscale interface: tailscale0 on Linux, a utun interface with a /32 in 100.64.0.0/10 on macOS, never 100.100.100.100), since 100.64.0.0/10 is also used by carriers, VMs and other VPNs. With no candidate or more than one, invite stops and asks for --tailnet-peer. It prints the IP it chose.

The invite may also be shown as a QR code, for a joining device with a camera such as a future iOS client. The QR code is exactly as secret as the text. Not built until such a device exists.

Host certificate renewal

  • Automatic. Whenever the laptop's client connects to a runner and sees fewer than 10 days left on its host certificate, it signs a new 30-day one with the day key and sends it over the same SSH session (a new SSH exec command). No extra prompt: the day key is already unlocked for the day's client certificate. The runner applies every host-certificate rule the client does, and in addition requires the signing day key to be valid now and the new certificate to end later than the one it has, so a stolen day key cannot swap in a certificate that expires in a second. It saves it and uses it for new connections without restarting. If an automatic renewal fails, the client logs a warning and carries on with the connection; the current certificate still has days left.
  • After expiry. allmyram renew <runner> connects with every normal host-certificate check except the expiry ones (the day key's and the certificate's end dates): the chain to owner.pub, the host certificate type, the runner's name, the host key pinned in client.json, no critical options. It then pushes a new certificate. Only renew relaxes expiry; every other command keeps refusing an expired certificate.
  • My call: the host certificate has one home, the runner's state directory, for joins and renewals alike, because /etc/allmyram is not writable by the runner. One location means no rule is needed for which of two copies wins.

Removing and revoking

  • allmyram remove <runner> drops the runner from client.json: the laptop stops trusting and using it, at once. It changes nothing on the runner, which keeps trusting the laptop's key until that key is revoked or the runner is uninstalled, and it gets no later revocations. That costs nothing while the laptop is the only client: what the runner trusts is the laptop's own key. To retire a machine, uninstall allmyram on it as well.
  • A client key is approved once, and the approval travels with it. When init or rotate-client-key makes a client key, the owner key signs an approval of it (Touch ID). The laptop keeps the approval beside the key and puts it in an extension of every client certificate it makes. Runners keep no list of approved keys: a client certificate is accepted only if it carries a valid approval of its own key under owner.pub. The day key cannot make an approval, so someone holding a copied day key cannot bring in a key of their own.
  • A revocation is a signed statement about one key, and it is permanent. allmyram revoke <key> asks the owner key (Touch ID) to sign a revocation of that key. There is no un-revoke under a given owner key: a revoked key is replaced by a fresh one, which costs nothing. The laptop and every runner each keep the set of revocations they have seen, every one verified against owner.pub before it is kept. A runner refuses any client certificate whose key is revoked and closes that key's open connections as soon as the revocation arrives (under the lock described under "The day key").
  • Revocations only accumulate, and they spread both ways. Whenever the laptop connects to a runner, each sends the other the revocations it lacks, and each verifies and adds them. Both directions are safe because an owner-signed revocation can only take access away. Nothing depends on versions or order, and replaying an old message cannot remove a revocation. A restored or rebuilt ~/.config/allmyram gets its revocations back from the first runner it reaches, and a runner that missed one gets it on the laptop's next connection.
  • Changing the laptop's revocations is one exclusive step: take a lock file, reread them, add, save, release. A join finishing holds the same lock (see step 5 of "Joining a runner").
  • revoke pushes the revocation to every runner in client.json over SSH and names the runners it could not reach. Until reached, those still admit the key, for as long as it holds a valid certificate.
  • No lockout by mistake. revoke refuses the laptop's own active client key. Replacing that key is rotate-client-key: make a new key, sign its approval (Touch ID), sign its client certificate with the day key, switch to it and delete the old key, then sign the old key's revocation (Touch ID) and push it as revoke does. The new key works at once on every runner, including ones that are offline, because its approval comes with its certificate; those runners receive the revocation on their next connection. If the laptop learns that its own active key is revoked (say after ~/.config/allmyram was restored from a backup), it says so and points to rotate-client-key. No rejoin is needed.
  • At most 256 revocations under one owner key, enforced whenever a revocation is added or merged, so a stored set always fits well inside the size limit every message is read through. revoke at the cap is refused and says to run init with a new owner key and rejoin, which starts a new set.
  • With one client, the case this serves is a client key copied away: rotate-client-key. A stolen laptop needs no action, since its access lapses with its day key; revoking from another machine would need the owner key, which is on the laptop. A lost owner key (including one invalidated by a fingerprint change) means a new allmyram init and rejoining every runner; a join under a new owner key replaces owner.pub and discards the revocations made under the old one, so nothing else is needed. A runner cannot remove an old node key from tailcat without restarting; the SSH layer refusing is what makes revocation take effect.

Existing runners

My call: no mixed old-and-new state. There are only two runners (smaug, and the macOS runner once it merges), so the cutover is: run allmyram init, then rejoin each runner with --join. A runner not yet rejoined simply stops working with the new client until it is. Rejoining replaces ca.pub with owner.pub and replaces the host certificate and allowed list. The manual flags (--ca-pub, --host-cert, --allowed) are removed in favour of --join. This keeps one set of checks in the code instead of two, and means renew only ever deals with joined runners, which all have a pinned host key.

Left open

  • Renewal for a client away from the CA (another machine, an iOS app). Such a client cannot reach the owner key on the laptop for its own day key. Decide when there is a second client.
  • Adding a second client's node key to existing runners. An owner-signed push, delivered the way revocations are, would do it, with AddAllowedClient. Not needed while the laptop is the only client. (A second client's SSH key needs nothing on the runners: its approval travels in its certificates.)
  • Making lifetimes configurable, if one prompt a day turns out to feel wrong (Gavin: "we can configure if that ends up feeling wrong").
  • An NTP vendor zone before broad release. The default NTP server, pool.ntp.org, is acceptable only for small-scale testing: the NTP Pool does not allow software shipped to the public to default to it. Before broad release, request a vendor zone at https://manage.ntppool.org/manage/vendor and switch skew.DefaultNTPServer to it, querying its four numbered names ({0,1,2,3}.<vendor>.pool.ntp.org), one at random per query, another on failure.

Left to the builder

  • The wire format of the join messages, within the rules above (commitment first, length-prefixed, domain-tagged, size-limited).
  • The fingerprint's exact form (words or characters), as long as both screens show it whole, it carries at least 40 bits, and it is computed over everything step 4 of "Joining a runner" lists.
  • Names and flags of the new commands, beyond those used above.
  • How install.sh and the macOS allmyram install hand the invite to allmyram join and pick up what it wrote.
  • Where exactly the revocations and the host certificate live under the runner's state directory, and how the runner reloads them.
  • The day-key principal, and the extension names that carry a day key's certificate and a client key's approval.
  • How revocations are sent on a normal connection (an SSH exec command, as host renewal uses, is the obvious fit).