Skip to content

Machine groups: pair once with any machine, reach every machine in the group #935

Closed

Description

@Tryanks

Machine groups: pair once with any machine, reach every machine in the group

Problem

Every device pairs with every machine separately. A homelab user with a headless machine in Docker and a desktop pairs the desktop window with the headless machine, then pairs the phone with the headless machine, then pairs the phone with the desktop; a second phone repeats all of it. Removing a lost phone means removing it on every machine, and a stolen device.json keeps working on each machine that has not been visited yet (docs/remote.md).

Roles (unchanged)

Client Machine (host) Device (client)
Desktop app yes, with hosting on yes
tcode-headless yes no
Phone / tablet no yes
Browser no only the headless machine that serves it, by password

Decisions

  • A group is opt-in on each machine. It is off by default, and the documentation states the risk below; nothing changes for a user who never creates or joins one.
  • Every machine is equal. No creator, coordinator or group key. Any machine in the group admits devices and machines; devices (phone, browser) cannot.
  • One way in. Inside a group there is no separate group link: a member's one-time invitation names the group, a device that pairs with it joins the group, and another machine joins by presenting the same kind of invitation.
  • No direct and group devices. Every full-access device of a member is a member. Creating or joining a group brings all of them, behind a prominent warning that lists them; there is no per-device choice. Space members stay with their own machine.
  • The group outlives any member. Each machine stays the only authority over its own allow list. A device admitted through the group is written into the allow list of every machine, so when the machine that started the group is stopped or leaves, every other machine still admits it.
  • Accept new devices governs the group too. A device another member introduces is a new device on this machine: while this machine's Accept new devices is off, it is not admitted here; it is listed as declined, with Admit, and is not admitted later without it. Removals always apply.
  • Removal is group-wide. Removing a full-access device on any machine removes it from every machine, as soon as each one hears of it, and no machine admits it again through the group.

Scenario

headless (Docker) creates group "Home" with the devices already paired to it
desktop pastes the headless machine's invitation into Join group
                                   -> desktop's machine key joins as a machine,
                                      its window and its devices are admitted
phone pairs with the desktop's invitation
                                   -> desktop admits the phone, tells headless,
                                      headless admits the phone
phone's Machines page              -> headless and desktop
headless leaves (or is deleted)    -> phone <-> desktop unchanged
new phone pairs with the desktop   -> reaches desktop and every other member
lost phone removed on the desktop  -> every member drops it and closes it (code 3)

Model

Group state on each machine (traverse.json)

group: {
  id: 16 random bytes, name,
  machines: [ { id, name, traverse, relay, addrs, entry } ]
  devices:  [ { id, name, platform, entry } ]
  declined: [ { id, counter } ]              // this machine's own refusals
}
entry = { state: member | removed, counter, by: machine id, changed_unix }
  • One group per machine in this version. A machine outside any group writes traverse.json version 3, which older builds read; a machine in a group writes version 4.
  • The allow list stays the admission check; a group device is a DeviceGrant::Full record.
  • Merge rule for an entry seen from two machines: the higher (counter, removed, by) wins, so at an equal counter removed wins. A removal keeps a tombstone. A device that was removed comes back only through a new pairing on some machine, which writes the next counter. A joining machine does not bring back a device the group removed.
  • Addresses. A machine reports no direct addresses of its own; members and devices carry only the address a connection to that machine selected. An interface address is only meaningful on its own network, and iroh 1.3 fails a whole dial, relay included, when any candidate address is answered by a different endpoint (UnknownIssuer), then keeps failing for that id until the dialling endpoint restarts.

Invitation

  • The one-time invitation of a machine in a group carries group=<id>: tcode://pair?v=3&id=…&secret=…&group=…&traverse=…&port=…. It stays single-use, five minutes, and dies after five wrong secrets, checked only on that machine.

Joining

  • Device: the existing tcode/pair/1 exchange. On success the machine writes a member entry, admits the device, tells the members it can reach, and replies Paired { host_name, group }. The device saves every machine of the group in hosts.json with group_id. Only devices that are members receive the machine list, also with every hello_ok.
  • Machine (desktop with hosting on, another headless machine): the joining machine's host endpoint dials tcode/group/1 with the invitation's secret, spending the invitation, so QUIC authenticates the machine id. It brings every full-access device it has and, on a desktop, its own window, and receives the group.

Sync between machines

  • tcode/group/1 between members. A machine accepts a sync only from a member machine; a removed machine is told only of its own removal.
  • Both sides exchange the full state and merge it. Each machine syncs with the others at start, after every change to its group, and every five minutes.
  • When the group's machines change, a machine closes its full devices' connections with code 4; they reconnect at once and read the new machine list from hello_ok.

Leaving and removing

  • Leave group on a machine: writes removed for itself, tells the members, forgets the group. Its allow list keeps every device.
  • Remove a machine from any member: writes removed for it and tells it at once; it leaves as if it had left itself.
  • Remove a device from any member's Settings → Remote: one action, group-wide.

Security

  • Every member machine can admit devices and machines into every other member. A compromised member, or a leaked invitation, therefore reaches the whole group. This is why groups are off by default, and the docs say so.
  • A removal reaches an offline member only when it next syncs. Until then that member still admits the removed device.
  • Compared with today, a lost phone is removed everywhere with one action.

Principle 5 wording (approved, in CONTRIBUTING.md)

"a device's first contact with a machine, or with a group of machines, is always an invitation, scanned or pasted; a machine admits only devices it paired or that a machine in its group admitted."

Protocol

  • HostingAction::Group(GroupAction): Create { name }, Join { link, address }, Leave, RemoveMachine(id), Admit(id). HostingState.group: Option<GroupInfo { id, name, machines, declined }>.
  • RevokeDevice writes a group tombstone for a group member.
  • HostLine::Paired and HostLine::HelloOk carry the group's machines for a member device. New ALPN tcode/group/1.
  • Protocol version 16 (v0.3.0-rc.1) added groups; 17 (v0.3.0-rc.2) moved them to the single invitation.

Status

Merged in #888 (744fc93): transport and merge rule, tcode/group/1, device rosters, Settings → Remote → Machine group, the invitation's group note, docs and principle 5. Released for testing in v0.3.0-rc.1 to rc.3.

Decisions changed during implementation

  • One invitation instead of a reusable group link. The first draft gave every member a reusable group link, paused or regenerated like a space link, beside the one-time invitation. With both, pairing one device and joining the group were two separate things on the same page. A reusable link is also the most dangerous secret a group has: anyone holding it reaches every member, for as long as it lives. The invitation now names the group instead, single-use and five minutes long; Accept new devices takes over pausing. What is given up: each device needs a fresh invitation.
  • Every full-access device is a member. The first draft let creating or joining leave chosen devices out, so a machine could keep a full-access device that only it admits. That made two kinds of devices on one list, with a mark to tell them apart and two meanings for Remove. Now a group has one kind. What is given up: a device that should reach only one machine of a group has to be a space member there, or the machine stays out of the group.
  • Addresses (added): members carry only addresses a connection selected, never interface addresses, after UnknownIssuer failures on a real group traced to iroh 1.3 failing a whole dial when another endpoint answers any candidate.
  • Machine-list changes reach devices by reconnecting rather than by a separate host event, so the list has one carrier, hello_ok.

Activity

  1. added 20 commits that reference this issue on Oct 22, 2026
  2. added a commit that references this issue on Oct 24, 2026
  3. Tryanks commented on Oct 24, 2026

    @Tryanks
    OwnerAuthor

    Merged in #888 (744fc93). The final design and the decisions that changed during implementation are in the issue body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions