feat: add reverse ssh sandbox targets
A sandbox behind NAT could not reach the room. A reverse target dials a tunnel-only sshd on the server, forwards localhost:22 to a loopback port, and the worker connects there. The server assigns the port and writes one authorized_keys line per tunnel target. The key carries permitlisten for that port; the sshd allows remote forwarding only, with no shell or local forwarding. The tunnel private key is shown once and never stored; rotating it rewrites the file. The target list and setup dialog carry the command, and the docs include the sshd config and sidecar requirements.
This commit is contained in:
1 parent
fc684115b5
commit
d85f68a176
20 files changed
+893
-38
No files matched your search
+32
-5
@@ -272,14 +272,18 @@ belong to the API and the config, not to the worker.
|
||||
The ssh backend already runs commands on a remote box with no daemon on
|
||||
the far end. It can offer the three things the panes need: a pty for
|
||||
the terminal, long-lived processes for a dev server, and file reads for
|
||||
the editor.
|
||||
the editor. The connector link changes how the server reaches that sshd,
|
||||
not what it speaks.
|
||||
|
||||
### What ecrou needs for a terminal
|
||||
|
||||
The ecrou backend is one microVM per command. It boots, runs the command
|
||||
with the workspace shared in, and powers off. Its stdin is null, it
|
||||
exposes no pty, and nothing outlives the command. `--persist` keeps disk
|
||||
state across boots, not processes.
|
||||
exposes no pty, and nothing outlives the command. The ecrou repository's
|
||||
`SPEC.md` is explicit about the boundary: a guest agent, long-lived
|
||||
machines, and port publishing are Later rows, and the current engine
|
||||
publishes no guest port. Disk state persists only through a virtiofs
|
||||
share, not through processes.
|
||||
|
||||
A web terminal needs a byte stream into a live process. Two ways to get
|
||||
one from ecrou:
|
||||
@@ -307,6 +311,13 @@ files, and preview. Option 1 stays a candidate as a degraded mode for
|
||||
accounts that only have ecrou, if a command runner is acceptable. Option
|
||||
2 is the one to design when ecrou grows sessions.
|
||||
|
||||
ecrou is the preferred runtime when that happens, not a replacement for
|
||||
reachability. The connector client still dials out; the client then runs
|
||||
one long-lived room machine and speaks the sandbox protocol to an
|
||||
in-guest agent. A per-command machine can back the agent's `exec` without
|
||||
the terminal or preview, so it is a fallback for accounts that accept
|
||||
that loss, not the room's default.
|
||||
|
||||
### Seam additions
|
||||
|
||||
The `Sandbox` trait gets three capabilities. Each has a default method
|
||||
@@ -562,6 +573,21 @@ are rejected. An operator on one private network can set
|
||||
the control plane. A DNS name that resolves to a public address when the
|
||||
worker starts and to a private one later is outside this check.
|
||||
|
||||
Reverse ssh is a second opt-in fallback for a machine behind NAT that
|
||||
cannot install the connector. The sandbox dials a tunnel-only sshd on
|
||||
the server and forwards its `localhost:22` to a loopback port; the
|
||||
worker dials `127.0.0.1:<port>`. A tunnel target is the only kind for
|
||||
which the loopback rejection is skipped, and only the target's own port
|
||||
is reachable. The API allocates the port from
|
||||
`tunnel_port_start..=tunnel_port_end` and writes one restricted key per
|
||||
target to the tunnel sshd's `authorized_keys` file. The key line carries
|
||||
`permitlisten="127.0.0.1:<port>"`; the sshd allows remote forwarding
|
||||
only, no shell, no local forwarding, and no non-loopback bind. The
|
||||
tunnel private key is shown once and never stored; deleting the target
|
||||
removes the line, and rotating the key replaces it. The tunnel sshd must
|
||||
share the app's network namespace, which makes it a sidecar, not a
|
||||
separate deployment or the node's sshd.
|
||||
|
||||
### Secrets
|
||||
|
||||
Provider keys and sandbox private keys are encrypted at rest with a key
|
||||
@@ -701,8 +727,9 @@ explanation.
|
||||
Settled:
|
||||
|
||||
1. Sandbox: the per-room disposable worker owns every transport. A
|
||||
connector link is the default; direct SSH is opt-in. ecrou waits for a
|
||||
live mode, with the shell-on-top runner as a possible degraded mode.
|
||||
connector link is the default; direct SSH and reverse SSH are opt-in
|
||||
fallbacks. ecrou waits for a live mode, with the shell-on-top runner
|
||||
as a possible degraded mode.
|
||||
2. Provider and model: the room owner picks both, and only the owner
|
||||
changes them. Every turn spends from that config.
|
||||
3. Interrupts: any member. v1 has no rate limit.
|
||||
|
||||
Reference in new issue
Block a user