Wuming 無名

Blog

Terminals in Your Pocket (4): The Computer Decides Who Gets In

· Technology · English

Previous: Teaching Coding Agents to Knock | Next: Troubleshooting Notes | 中文版:谁能进来,由电脑说了算

Something that reaches your computer from the public internet and can type into its terminals cannot have security bolted on afterwards. This post is about the trust model and a few rules fixed on day one.

The conclusion first: an account password is not a key to the computer. Even if someone has your account, without one of your devices they don’t get in.

One key per device

There are no “user keys” in the system, only device keys. Every computer, every phone, every browser session generates its own key pair on first use. The private key stays local, in the phone’s secure storage or in a tightly permissioned file in the user’s home directory on the computer. It never leaves the device and is never uploaded.

The account’s job is to group those devices. After signing in, the control plane issues the device a certificate saying: this public key belongs to this account, it is a computer or a phone, and it expires at this time. Certificates are short-lived, a few days, and devices renew their own.

When two devices connect, the encrypted handshake uses those two device keys. After the handshake they exchange certificates and each verifies: signed for the same account, not expired, not revoked. Fail any check and the connection drops.

Two gates

Before a computer accepts a connection, it passes through two gates.

The first is at the relay. Relays sync an allow list from the control plane and only forward between listed devices of the same account. Unknown nodes are refused before any handshake, with no chance to even attempt a punch. This gate stops scanning and noise.

The second is on the computer. The computer verifies the other side’s certificate itself. It doesn’t trust the relay’s judgement or the control plane’s online status; it trusts signatures and the revocation list. So even if a relay were compromised or the control plane made a mistake, the computer still accepts only correctly signed devices.

Both gates check the same certificates, but two parts that don’t trust each other each do their own check. That is the floor the whole system stands on.

New devices need your nod

Certificates alone aren’t enough. Consider this: an attacker has your account password and signs in on their own phone. The control plane issues their phone a certificate, because from the account’s point of view this is simply a new device. The certificate is valid and both gates pass.

So the computer has a third gate: local approval. A device it has never seen connects, and the computer parks it with no streams open, and waits. Approval can come from two places: a device that is already approved (usually the phone in your hand), or a command typed on the computer. Once approved, the device’s fingerprint is recorded in a local list and future connections go straight through.

This gate separates “account stolen” from “computer entered”. The thief can see how many computers you have; each one is waiting for a nod they can’t give.

It does add a step. The first time, the person is sitting at the computer anyway and types one command to approve their own phone; hardly a burden. Later devices get approved from the old phone, which is convenient. Anyone who finds it tiresome can switch the gate off, but it is on by default.

Revocation and expiry

Lost your phone? From any signed-in device or the web console, remove it. The control plane adds its certificate serial to the revocation list; relays and computers fetch that list regularly, and within minutes the phone can’t connect to anything. Existing connections are cut by the computer too.

Short-lived certificates are the second layer. Even if a revocation list is late reaching some computer, a revoked device can’t renew its certificate and goes dark within days.

Removing a computer from the account works the same way. The computer gets an explicit signal, forgets its pairing, and needs a fresh sign-in to come back.

What the computer never shares

Browsing and uploading files is handy, and the easiest place to get hurt. So the computer has a fixed deny list; whoever connects and whatever their permissions, these never leave through the system:

  • the SSH key directory;
  • credential files of the various cloud providers;
  • environment files starting with .env;
  • the system’s own keys and configuration.

All paths are resolved and validated on the computer’s side. A path from the phone that tries to escape the allowed directory with .. or a symlink is refused. None of these checks depend on the phone app being current or unmodified.

Sharing with someone, but only one window

Sometimes you want a colleague to look at a problem in the terminal. The system lets you share a single tmux window: generate a link, they open it in a browser, no account needed.

What they receive is a guest certificate: valid for that one window, view-only by default, expiring automatically. The computer treats guests as a separate role: no listing sessions, no files, no new windows, no port forwarding. To let them type, the person sharing has to choose that explicitly. The sharer can end it any time, and the guest’s connection drops the moment they do.

The principle is the same as before: the limits are enforced by the computer, not by hiding buttons in a UI. Even a modified guest app gets exactly one window.

Three rules

Looking back, this post reduces to three sentences.

Hiding a control is not authorisation. Every rule is enforced by the computer; phones and browsers are clients.

A password buys no key. Keys are devices, and devices are approved by your hand.

The less in the middle, the better. The control plane authenticates, relays forward, and neither sees content.

The last post in the series is about the things that won’t connect, won’t notify, or won’t type, and a few times the author dug a hole and fell in.

The series

  1. Why Reach Your Computer From a Phone
  2. An Architecture of Three Parts
  3. Teaching Coding Agents to Knock
  4. The Computer Decides Who Gets In (this post)
  5. Troubleshooting Notes

Comments

  1. Loading comments…

Leave a comment

Plain text; links are fine. Comments with many links wait for review.