How it works
Short version: a signed file, a key, and a blind relay.
The three roles
| ๐ master | Holds the flock key, mints invites, sends commands. Needs no reachable address, so it can be a laptop that is usually off. |
| ๐ sheep | A managed machine. Dials out and keeps the connection open. Holds only its own private key. |
| ๐ก connector | A directory and a relay. The only machine that needs a reachable address โ and it can be any machine, including one of the sheep. |
It is one binary. The role is just the subcommand you run.
What actually keeps it safe
The roster is a file, and it is public
It lists who is in the flock and their public keys, and it is signed by the flock key. Every member holds a copy, so there is no database to back up and no server to restore. Keep it in git and you have an audit trail of every machine ever added.
The only secret is the flock key
It signs rosters, so it is needed to add or remove a machine โ and for nothing else. Keep it offline, and never on a connector.
Peers verify each other, not the relay
A connector checks that a connecting machine holds the key the roster says it holds, and then forwards opaque payloads. Master and sheep agree on an encryption key between themselves, using ephemeral keys signed by their permanent ones. The connector sees ciphertext it can neither read nor forge. That is why it does not matter whose machine a connector runs on.
| A connector can | see which machines are talking, when, and what they are called |
| A connector cannot | read a command or its output, forge one, impersonate anyone, or add itself to the flock |
Adding and removing machines
ssheep invite --name pi generates a key pair for the new machine, adds its
public key to the roster, re-signs it, and prints a single-use ticket. The ticket carries
that machine's private key, so hand it over privately. ssheep forget --name pi
removes it and publishes the new roster; connectors drop it within seconds.
More than one connector
A single connector is a single point of failure, which is a strange thing for a tool whose point is not needing anyone. A flock can list several: every sheep keeps a link to each of them, and a master tries them in order. Losing one costs the flock nothing.
What is missing
Direct peer-to-peer connections, an interactive shell, and file transfer. Today every
byte goes through a connector, and run executes a command and streams its
output back. The relay path is the floor; direct connections would sit on top of it
rather than replace it.