Skip to content

Latest commit

 

History

History
113 lines (88 loc) · 5.94 KB

remote.md

File metadata and controls

113 lines (88 loc) · 5.94 KB

Your phone, other machines, and from anywhere

Two things need two different things:

To A device needs
See the board the UI key, which the QR code carries (?k=…, then a cookie). localhost needs none
Act (send, allow, deny, stop, start) a passkey, which a browser makes only on https or localhost, under one DNS name

So a phone on plain Wi-Fi sees everything at once, and sends once it reaches the board over https. The /phone page (also step 4 of Setup) recommends one way for this machine and keeps the others under Other ways.

Seeing: the QR code

sessionpipe-gui prints a QR code in the terminal; the Connect and phone pages show the same one. Scan it on the same Wi-Fi and the board opens. Without the key, the network answers 401. Anyone with the link can read the board, so treat it like a password; sessionpipe-gui key renew (or New link… in a link's menu on Connect) makes a new one, in use at once. For a receiver on a computer without a browser (also one run as a service, which prints no banner): ssh -L <port>:localhost:<port> <that computer>, then open http://localhost:<port>/connect on your own computer; Connect shows the current link.

Sending, way 1: Tailscale (works away from home too)

No port forwarding, no certificate to install, and the board stays off the public internet. On the machine that runs the board:

tailscale serve --bg 7373                                          # https://<machine>.<tailnet>.ts.net → this port
sessionpipe-gui --public-url https://<machine>.<tailnet>.ts.net    # remembered; --no-public-url forgets it

The phone page and Setup's optional sixth step do both with one click once they see Tailscale running. The url's host becomes the passkeys' rp id, so use that one address on the Wi-Fi too; passkeys made for another name are made again on first use.

Behind the proxy the server trusts X-Forwarded-For, -Proto and -Host only on connections from this machine. The visitor's address is the last one in X-Forwarded-For, the one the proxy itself wrote. Whoever comes through the proxy needs the UI key, a browser on this machine too, and Setup's actions answer only at http://localhost:7373/setup. The proxy's name is one the server answers to because --public-url says so, and through the proxy only: a request under that name that the proxy did not mark as forwarded is refused (403 unknown_host), and so is a proxy on this machine that forwards under a name --public-url does not say.

Sending, way 2: the same Wi-Fi, with the GUI's own certificate

sessionpipe-gui --tls      # remembered until --no-tls; needs the openssl command

The same port then also speaks https, with a certificate from the GUI's own local CA for <machine>.local, localhost and every LAN address. The QR code opens a plain-http trust page that walks the phone through installing that one certificate (compare the SHA-256 fingerprint it shows with the one in the profile) and then forwards it to https://<machine>.local:7373. Sinks and the daemon keep using plain http.

On this machine, sessionpipe-gui tls trust adds the CA to the macOS login keychain and prints the steps elsewhere: on Linux, ~/.local/state/sessionpipe-gui/tls/ca.crt goes in by hand (update-ca-certificates on Debian and Ubuntu, trust anchor on Fedora), and Firefox and Chrome keep their own stores. tls status shows the names, expiry and fingerprint; tls reset starts over (phones then trust again). <machine>.local is mDNS: macOS advertises it, Linux needs avahi-daemon, Windows 10 and later resolve it.

A passkey for the phone

On the phone, Send from this phone (or /add-device) makes its passkey and shows six digits. A device this machine already trusts compares them and approves; nothing reloads. After that, the first send of a day asks for the passkey once and signs a day key that signs the rest of that day's commands.

A page opened on an address where its passkeys cannot work (say http://localhost while they live at the .local name) says "Sending works from https://…; open it there." instead of offering to add a device.

Other machines

Each machine runs sessionpipe and sends to this board with a sink. The line, filled in, is on the Connect page and in the banner:

sessionpipe sink add http://<this-machine>:7373 --tier 3 --token <sink token>

--tier is how much that machine sends (tiers). To answer its agents from here too, pair it at its own terminal:

sessionpipe control pair http://<this-machine>:7373

It prints a link and six digits; the page shows the same six; you approve with your passkey. Over Tailscale, sessionpipe connect https://<machine>.<tailnet>.ts.net does the hooks, the sink and the pairing in one approval. The link carries the pairing's code and nothing else; approve the request on the Machines page of the computer this board runs on, which lists it with the same six digits.

Other proxies and tunnels

Any https reverse proxy on this machine that sets X-Forwarded-For, -Proto and -Host works the way Tailscale does, once --public-url names its address. It must write the address it took the connection from as the last entry of X-Forwarded-For; appending to the header and replacing it both do. A proxy that adds no such header (nginx does not by itself: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;) is refused under the public url's name; one that also puts the port's own address in Host hands every visitor on as a program on this machine. A proxy over plain http, on any machine, must pass on the Host it was asked for (nginx: proxy_set_header Host $host;): the board's own writes name that host in Origin. A public tunnel (Cloudflare, ngrok) works too, but then the UI key and the sink token are all that stand between the internet and your sessions: put an access layer in front. Publishing the port itself to the internet is not supported.