Docs › security

Security

The model

Your Mac runs its own SSH server inside Termfold. It accepts only public key login, never passwords. A phone gets in only if all of this is true:

Pairing

  1. The Mac shows a QR code. It holds a random one time code, the address and the key of this Mac.
  2. The Mac shows a six digit PIN. It is not in the QR code.
  3. The phone checks that the Mac has the key from the QR code, then sends the code, the PIN, its name and its public key.
  4. The Mac accepts if both match, adds the phone and closes the pairing.

The code and PIN last 90 seconds and work once. After five wrong tries the pairing is cancelled. A photo of the QR code alone is not enough: someone must also read the PIN from your Mac screen.

What is protected, and how

ThreatProtection
A fake Mac on the networkAfter pairing the phone stores the key of your Mac and refuses any other key.
Someone on the network trying to connectOnly paired phones are accepted. Connections from outside local network addresses are dropped.
GuessingAt most 3 unfinished connections per address, 8 in total and 16 connections overall. An address with 5 failed logins in a minute is blocked for 2 minutes. A login must finish within 20 seconds.
A copied QR codeIt works once, for 90 seconds, and the PIN is also needed.
A phone you stop trustingPause, Remove or Quit everywhere close its sessions at once.
A phone you trust lessAsk before each connection and a time limit (8 or 24 hours).
An unattended phoneTermfold asks for Face ID, fingerprint or the passcode before a terminal opens.
A forgotten open sessionA session with no typing for the chosen time is closed (default 1 hour).
A connection that dropped silentlyTCP keepalive notices within about 30 seconds and releases it.
Not knowing what happenedThe journal records connections and refused attempts, and a notification appears when a phone connects.
Programs setting your clipboardThe phone can refuse clipboard writes from the terminal, for each Mac or server.
Leaking the environment of the appThe shell starts with a small, clean environment.

What is not protected

Keys

What each part can see

SSH library

Termfold uses the Apple swift-nio-ssh library on both sides.

Advice