Skip to content

Latest commit

 

History

History
113 lines (90 loc) · 5.13 KB

remote.md

File metadata and controls

113 lines (90 loc) · 5.13 KB

A running system: shell, exec, push, pull

Four commands work on a system that runs on the device: a RAM payload, or an installed system. They start nothing and change no boot state.

orchard shell                       # a shell on it, at this terminal
orchard exec -- uname -a            # one command; its exit status is this command's
orchard push build/app /root/app    # a file to it
orchard pull /var/log/messages .log # a file from it

Which system

The device that --location or --ecid names (as orchard devices lists them); without them, inside orchard session, the session's device; else the one running system on USB. Two running systems and no name is ambiguous: several agents can each work on a device of their own, and none of them reaches another's by accident.

orchard exec --location 0x2100000 -- uname -a
orchard session --location 0x1100000 -- sh -c 'orchard push app /root/app && orchard exec -- /root/app'

Every system has the same address on its USB network (172.16.42.1), so the address alone does not say which device answers. SSH therefore goes out through the device's own network interface on this computer (found by its USB location, as its serial console is), with orchard net-proxy as its ProxyCommand. Plain ssh USER@172.16.42.1 still works with one device on the cable. A Linux kernel before 5.7 lets only root bind a connection to an interface; there the connection goes where the routing sends it, which reaches the device when it is the only one.

How it is reached

System Signed in as With
a RAM payload root this computer's key for payloads, which orchard build put into it
an installed system its user this computer's key, which orchard install --ssh imported
  • A payload's host key is new each time it starts. It is read over the USB serial console, which is the cable and so trusted, and pinned for that start and that USB port: nothing else on the network can stand in for the device, and a payload on another device keeps its own.
  • An installed system's host key is learned on the first connection and kept under the unit's own name, which the system says on USB: every device on the cable has the same address, and two tablets are still two hosts. orchard install --ssh forgets the unit's old key, since the new system makes a new one, and remembers the user per unit. --user NAME signs in as another user than the one the install set up; root is sudo there, as on any system.
  • --host ADDRESS reaches a system over a network instead of the cable, as an installed system; with --ram, as a payload and root. Its host key is trusted on first use, as ssh does: check it some other way the first time.

A payload built with transport = false, or one whose init does not run /usr/libexec/orchard/usb-session, has no SSH; push and pull then take --serial.

A device that refuses the key says so, with what gives it the key. Keys that another tool made are not tried.

A system installed without SSH

orchard ssh-access gives this computer its access afterwards. It signs in once on the system's USB serial console as its user, with the password you type, and adds this computer's keys to that user's authorized_keys, as install --ssh does. --user NAME names the user; without it, the one remembered for the device, else it asks. The password goes only to that login, over the cable; it is not kept.

Apple's device tree, for bringing up a board

orchard capture-adt --output private/j71b.adt

saves the device tree (ADT) iBoot made for the unit, which m1n1 hands on to the Linux it starts as a flash partition named adt. It is read from the running RAM payload over its USB serial console: no SSH, and nothing is written on the device.

  • The file must not exist; it is made readable by you only. It holds the unit's serial number and ECID: do not publish it.
  • A tree whose model is not one of the board the payload says it runs on, or whose ECID is not the --ecid given, is refused. What could not be checked is said as a note.
  • Not from an installed system, whose console is a login, and not on a 32-bit board, whose loader hands on no such partition.

Files

push LOCAL REMOTE writes the file beside its place (REMOTE.part), has the device compute its SHA-256, and moves it into place only when that is the file's. pull REMOTE LOCAL does the same the other way round. A checksum that differs leaves the .part file and fails.

  • Over SSH, any size. A connection that drops is made again once, and the file starts over.
  • --serial: over the USB serial console, for a payload without SSH, 1 byte to 16 MiB. A place that cannot be written is refused before any byte of the file is sent. Not for an installed system, whose console is a login.

--json gives {"from", "to", "size", "sha256"}.

Where the keys are

In the cache, readable by you only: private/ram-ssh/ (the key for payloads and the pinned host key of the payload that runs) and private/ssh/ (the key for installed systems, their host keys, and the user each install with --ssh set up: user-UNIT per unit, user for the last one).