# Device signing

> Make your devices connect only to devices one of your own trusted devices signed, so nobody who gets into your account or our servers can add a device they'll talk to.

Normally your devices trust the list of devices Underpass's coordination server gives them: a device you add in the dashboard, or with an auth key, is one they connect to. That makes the dashboard, and our servers, something worth attacking: someone who got into your account could add a device of their own and reach yours.

**Device signing** takes that away. With it on, your devices only connect to devices that one of your **trusted devices** signed, with a key that never leaves that device. The dashboard can't sign, and neither can our servers. Someone who gets into either can still add a device to the list, but none of your devices will talk to it.

It's off until you turn it on, and it's per workspace.

## What it protects against

- **Someone gets into your dashboard account**, or an admin's, and adds a device or makes an auth key. The new device shows up as **Not signed**, and your devices don't connect to it.
- **Underpass's coordination server is broken into**, or someone makes it lie. It can't sign devices either, and your devices check every change to who's trusted themselves.
- **A device registers again with a new key** (someone copied its sign-in, or it was reinstalled). A signature is for one device's key, so it needs signing again.

## Who it's for

- **Companies whose security review asks "what if Underpass gets hacked?"** With device signing on, nobody at Underpass, and nobody who breaks into our servers, can put a device into your network.
- **Networks with servers that matter** (finance, health data, production databases), where one device that shouldn't be there would be a disaster.
- **Regulated teams** that need no single point of trust: adding a device takes someone at one of your own computers, not only a dashboard login.

Small teams that add devices often may prefer to leave it off. It's an extra step for each new device.

## How it looks day to day

1. **Once,** the owner runs `sudo underpass lock init` on their computer. Every device you have now is signed, and you keep two recovery secrets somewhere safe.
2. **A new laptop joins** as usual and shows as **Not signed**. Your devices don't connect to it yet. Someone at a trusted computer runs `sudo underpass lock sign new-laptop`, and it connects within seconds.
3. **Someone steals an admin's dashboard login** and approves a device of their own. It shows as **Not signed**, and none of your devices ever talk to it.
4. **The trusted computers are all lost** (stolen, wiped): a recovery secret turns device signing off (`sudo underpass lock disable <secret>`), and you start again.

What it doesn't do: it doesn't stop a trusted device that's been taken over from signing things, so keep trusted devices to computers you look after, and remove one you lose (below). It also doesn't change [access controls](/features/access-controls): a signed device still only reaches what your rules allow.

## What you need

- Underpass **0.8.19 or later** on your devices. Devices on an older version **don't enforce it**: they still connect to every device, signed or not, until they update. The dashboard and `underpass lock status` list them.
- A computer of your own, which you added to the workspace yourself, to be the first trusted device. Only the workspace owner's own computer can turn device signing on.
- An administrator's terminal there: `sudo` on Mac and Linux, or a terminal opened with **Run as administrator** on Windows.

## Turn it on

On your computer:

```bash
sudo underpass lock init
```

It lists the devices in your workspace and asks before going on. Check the list: every device on it gets signed, as it is now. Then it:

1. makes this computer's lock key the first trusted one;
2. signs every device in the list;
3. shows two **disablement secrets**, once. Keep them apart from your devices: in a password manager, or printed. They're the way back if you lose every trusted device ([below](#if-you-lose-every-trusted-device)).

`--yes` skips the question (for scripts). To trust more devices from the start, name their keys: `sudo underpass lock init lk:… lk:…` (each device's `underpass lock status` shows its key, starting `lk:`).

Your devices pick it up within a few seconds. From then on, a device nobody signed is left out: `underpass status` says which, and the dashboard shows it as **Not signed**.

## Add a device

A new device joins as usual, but your other devices don't connect to it, and it doesn't connect to them, until it's signed. On a trusted device:

```bash
sudo underpass lock sign office-pc
```

Use the device's name from the dashboard or `underpass status`. You can name several at once. The new device connects within a few seconds. **Settings → Devices** in the dashboard lists the devices waiting, with the command to copy.

A device that signs in again with a new key (reinstalled, or its state reset) needs signing again.

## Trust another device

Keep at least two trusted devices, so losing one isn't a problem. On the device to trust, find its key:

```bash
underpass lock status
```

Then, on a device that's already trusted:

```bash
sudo underpass lock add lk:…
```

## Stop trusting a device

When you lose a trusted device, or give it away, on another trusted device:

```bash
sudo underpass lock remove lk:…
```

Devices it signed **aren't signed any more**: `remove` lists them, with the command to sign them again from this device. Check that list before you sign them: if the device was stolen, something on it may be one you don't want back. The last trusted key can't be removed; turn device signing off instead.

## If you lose every trusted device

Any device turns device signing off with one of the disablement secrets:

```bash
sudo underpass lock disable <secret>
```

Your devices connect to every device in the workspace again, and the secret can't be used again. Turn device signing back on with `lock init` from a computer of yours; that makes new secrets.

> [!IMPORTANT]
> Underpass doesn't keep the disablement secrets, only a fingerprint of each. If you lose them and every trusted device, nobody can turn device signing off for you: your devices keep refusing devices they can't check. You'd remove Underpass's saved state on each device (`lock.json` in its [state directory](/reference/cli#state)) to start again.

## See where it stands

```bash
underpass lock status
```

Shows whether it's on, this device's lock key and whether it's trusted, the trusted keys and their devices, the devices waiting for a signature, and any devices on a version that doesn't enforce it.

In the dashboard, **Settings → Devices** shows the same, read-only, with each command to copy. The dashboard can't turn device signing on, sign a device or trust a key: that only happens on your devices, which is the point.

## How it works

- **Lock keys.** Each device makes its own lock key (Ed25519) and keeps it in Underpass's state directory, readable only by the service. It never leaves the device.
- **The list of trusted keys** is a chain of signed changes: the first names the trusted keys; each later one adds or removes keys and must be signed by a key trusted at that point. Every device checks each change itself before taking it, and keeps what it checked. A change the coordination server sends that doesn't check out is refused, and `underpass status` says so.
- **Signing a device** signs its WireGuard key and its ID together. Every device checks each other device's signature, against the keys it trusts, before adding it to its tunnel.
- **A new device** takes the workspace's list of trusted keys the first time it sees it, since it has nothing else to check it against. That doesn't let anyone in: your other devices still refuse the new one until a trusted device signs it.
- **Disablement secrets.** The first change holds only a fingerprint (SHA-256) of each secret, so whoever shows a secret can turn device signing off, and nobody else.

## Things to know

- **Devices before 0.8.19** connect to everything, as before. Update them; until then they're the weak spot.
- **Machines shared with you** from another workspace need signing too, like your own.
- **Phones** enforce it like computers. Signing happens from a computer.
- **The Underpass app** doesn't sign devices yet: use the command line on a trusted computer.
- Turning it on, trusting or removing a key, signing a device and turning it off all go in your workspace's [logs](/manage/logs).
