GatewayUse
Publish a devserver
Dial a devserver in with an access token, open it in a browser or Chan Desktop, and share it.
Publish a devserver
Publish one devserver to see the whole path work. It runs on a Linux host with chan installed, as in Install on the host.
-
Create its token
In the Tokens tab, choose New token, label it
build-host, pick an expiry, and copy the token: it is shown once. The token is the devserver's identity: a new token makes a new devserver, at a new address. -
Start the devserver with it
On the devserver's machine, with the token in the environment:
$export CHAN_TUNNEL_TOKEN=chan_pat_... chan devserver start --port 8787 \ --tunnel-url https://proxy.example.com/v1/tunnel \ --tunnel-devserver-name build-host -
Check the connection
The devserver's log names your username:
$journalctl --user -u chan-devserver -fchan devserver: tunnel connected as user aliceOn the gateway,
chan-gateway-admin tunnel pslists it.
Details and limits
- The systemd service keeps the token and the URL, so a later
start,restartorjoinreuses them. - Pass the token in the environment, not as
--tunnel-token: a flag is visible to every user in the process list. --port 8787keeps the devserver's local listener on its usual port, so Chan Desktop can still connect over ssh. Without it, a tunneled devserver picks a free port.- On macOS the launchd service cannot carry a tunnel: use
chan devserver runwith the same flags, or--service=chan. - A dropped tunnel dials again by itself.
- To publish more machines, such as build hosts, GPU boxes or a VM per person, give each one its own token and run the same command on it.
Dial in through WireGuard
A devserver can reach a gateway that sits behind a WireGuard peer. chan runs the peer inside the devserver's own process: no network interface, no host routes, no root and no VPN client.
$chan devserver run \
--tunnel-url https://proxy.example.com/v1/tunnel \
--tunnel-wireguard /absolute/path/to/devserver.conf
- The token still comes from
CHAN_TUNNEL_TOKEN.CHAN_TUNNEL_WIREGUARDnames the file in place of the flag. - The tunnel URL's destination must be inside the peer's
AllowedIPs. - An
http://tunnel URL is accepted inside WireGuard, which pins the peer's key and encrypts the connection. - The file is the wg-quick subset that Chan Desktop reads. On Unix it must not be readable by the group or others:
chmod 600it.
Open it from a browser
Under My devservers, build-host is online. Click Open: the browser lands on the devserver's own origin, such as https://alice--3f9c2a7b1e04.p1.proxy.example.com/, on the Computers screen of Chan in a browser. The URL holds no token: the gateway's OAuth2 sign-in is the key.
Connect Chan Desktop
Chan Desktop adds your self-hosted gateway by its URL and signs in through the browser; Connect to a gateway has the steps. The gateway carries the connection, with no connect script or control terminal, and cs tunnel works through it.
Details and limits
- A desktop gives back a sign-in token it does not keep, as after a cancelled sign-in. The token's audit reads
revoked_via_desktop. - A token given back after it was used also disconnects that account's tunnels and gateway sessions.