Repository navigation
Conversation
…6221) First build of #5694's recommendation B: let the fleet proxy expose a laptop TCP service through a loopback-only raw byte stream, using the existing CONNECT tunnel path, so RustDesk's direct-access port 21118 stops needing the dedicated raw SSH forward. - fleet-config: register port 21118 as `rustdesk` in the routing table (its presence is what makes a splice request for it legal), plus PORT_RUSTDESK and SPLICE_LISTEN_HOST. - fleet-proxy-proto: the `{ "splice": { "port": N } }` request and `{ "splice": { "status": …, "error": … } }` reply, with the `proxy-splice` / `splice-serve` capability ids. After a 200 the connection stops being a frame stream in both directions. - fleet-registry: ProxySplice and SpliceServe capabilities; the proxy domain gains the `desktop` subcommand. - fleet-proxy/tunnel: `TunnelMode` makes the post-setup timeouts a caller choice. `Raw` clears them — this is what stops a desktop session dying at the 660 s HTTP read timeout. - fleet-proxy/splice: the relay (opaque, bidirectional, hand-rolled read/write like the stdio relay — not io::copy, which stalled in this sandbox at #5431), the broker half (`serve_splice`, port must be in the routing table, spent tunnels never return to the pool) and the client half (`fleet proxy desktop`, loopback-only listener). - fleet-proxy/serve: advertise `splice-serve`; hand a splice frame to the raw relay instead of the request/response loop. Capability negotiation is the gate: a pre-splice broker (and every proto-0 Python broker) advertises neither id, so `fleet proxy desktop` reports it and exits 69 while the SSH forward stays the fallback. No RustDesk credential is read, stored, or logged anywhere in this path: the relay never inspects payload, and the permanent password's proof travels inside the spliced bytes. Tests: 13 new splice tests (byte transparency across all 256 values, concurrent bidirectional streams, two concurrent splices, raw mode clearing live socket timeouts, an idle splice outliving the HTTP timeout shape, loopback-only listener enforcement, and the negotiation gate proving a non-splice broker is never sent a splice frame), plus protocol, config, registry and CLI coverage. Refs #6221, #5694
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fb62b1e91
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if is_splice_frame(&frame) { | ||
| crate::splice::serve_splice( | ||
| &broker.config, | ||
| broker.egress.as_ref(), | ||
| stream, |
There was a problem hiding this comment.
Keep the broker alive while a splice is active
When a desktop session runs without unrelated HTTP requests, the broker still exits after idle_exit_secs (3600 seconds by default), terminating the session even while bytes are flowing. This branch bypasses do_request, the only path that updates Broker.last_used, while keepalive_loop calls process::exit(0) when that timestamp expires. Clearing the tunnel timeouts therefore does not make desktop sessions long-lived. Track active splices and prevent idle shutdown until they finish, including while an established desktop session is idle.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c98c33d (task 10516, lane code-a). The broker now counts live splices: Broker.active_splices (AtomicUsize) is passed to serve_splice, which holds an RAII SpliceGuard from the 200 handshake until the relay ends. keepalive_loop exits only via idle_exit_due(last_used, now, idle, active_splices), which is false while any splice is active — including an established but idle desktop session. Tests: serve::tests::idle_exit_waits_for_active_splices and splice::tests::splice_guard_counts_live_splices; full fleet-proxy suite 85 lib + 14 bin tests pass, rustfmt clean.
| None => connect_tunnel_mode( | ||
| None, | ||
| target, | ||
| req.port, |
There was a problem hiding this comment.
Require explicit direct mode before bypassing the egress proxy
When proxy_direct() is false but HTTPS_PROXY is missing or invalid, broker startup also stores egress = None. This branch interprets that state as permission to connect directly to the laptop, silently bypassing the configured proxy route. The existing HTTP path in Broker::open_conn_raw distinguishes explicit direct mode from missing egress configuration and refuses the latter. Apply the same check here so a splice reports the configuration failure rather than attempting an unintended direct connection.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c98c33d (task 10516, lane code-a). serve_splice now refuses before dialling when egress is None and config.proxy_direct() is false, returning the same message the HTTP path uses in Broker::open_conn_raw: "HTTPS_PROXY must be set (runtime proxy env)". Explicit direct mode (proxy_direct true, egress None) still dials directly. Test: splice::tests::serve_splice_refuses_missing_egress_when_not_direct asserts the 502 refusal frame over a UnixStream pair with Config::default(); full fleet-proxy suite passes.
…n egress unconfigured (#6221)
|
🤖 Agent note · parked (resumable — Codex fixes landed, rebase/port is the next step)
|
|
🤖 Agent note · closing as superseded by PR #8618
|
Implements the first build from #5694's recommendation B: the fleet proxy gains a raw byte splice, so RustDesk's direct-access port (21118) reaches the sandbox as a loopback listener instead of through the dedicated raw SSH forward.
Closes #6221.
What this adds
The wire (
fleet-proxy-proto): a splice is its own negotiated capability and its own frame.After a
200the connection stops being a frame stream in both directions. Capability ids:proxy-splice(client) andsplice-serve(broker).The gate is negotiation. A pre-splice fleet broker — and every proto-0 Python broker — advertises neither id, so
fleet proxy desktopreports it and exits 69. It never sends a splice frame to a broker that would try to parse it as a request. The SSH forward stays the fallback until this is verified live.Broker half (
serve_splice): the requested port must be in the broker's own routing table (the table is the negotiation — a splice must never become a way to reach an arbitrary laptop port), then one fresh tunnel is opened and the connection is handed to the relay. The tunnel is spent: it never returns to the pool, because the pool holds reusable HTTP conns and this one has another peer's protocol on it.Client half (
fleet proxy desktop): binds127.0.0.1:21118(RustDesk's own default, so the sandbox client needs no configuration), one splice per accepted connection, loopback-only enforced at bind time rather than trusted to the operator.The 660 s fix (
TunnelMode):tune()was HTTP-shaped, and applying it to a splice would kill every desktop session at 11 minutes.TunnelMode::Rawclears both timeouts;Httpkeeps today's values. This is the whole reason the timeouts became a caller choice.Acceptance from #6221
a_broker_without_the_capability_is_never_asked,the_legacy_dialect_is_never_askedrelay_is_byte_transparent_in_both_directions(all 256 byte values, 64 KiB+7),relay_carries_both_directions_concurrentlyconcurrent_splices_do_not_interfereraw_tunnels_clear_the_http_timeouts,a_raw_tunnel_really_has_no_timeouts,an_idle_splice_survives_past_the_http_timeoutThe >30-minute live session and the start-latency comparison against the
forward.shbaseline are activation checks, not unit tests — they need the laptop's RustDesk host and a real session. Recording them on #5694 as the activation caveat rather than claiming them here.Notes for review
read/write, deliberately notstd::io::copy: on Linux that lowers tosplice(2), which stalled mid-stream in this sandbox for the SSH ProxyCommand relay (fleet step 3: proxy domains — hello/capability frame, PATH shim regeneration, fleet init #5431).fleet-config's built-in services table grows to four entries (21118rustdesk), soservices_default_to_the_live_tablemoves from 3 to 4.Tests
cargo test -p fleetwith default features does not compile on currentmain—fleet-queue/src/validate.rsdeclaresFLEET_REPOS: [&str; 10]with 9 entries (pre-existing, untouched by this branch; verified againstorigin/main). The feature-scoped run above is the same capability set without the broken crate.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.