500 Commits
Author SHA1 Message Date
rustdeskandClaude Fable 5.2 5ff66f4cfc Pin the datagram formats with a recorded exchange
Only HPKE had fixed vectors. Every other test seals and opens with
the same code, so a label, a field order or a derivation changed on
both ends still passes, while a build already released could no
longer follow and would go on in plaintext. One test now opens a
hello and a welcome recorded with fixed keys, and compares the data,
the proof, the one-shot, the answer and the cookie reply sealed after
them with their recorded bytes. No production code changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-11 22:02:06 +08:00
rustdeskandClaude Fable 5.2 9bfc46eda5 Take the proof state from any answer on the session
An answer used to change the state only when nothing newer had
arrived, but a push is newer and says nothing of the proof, so an
answer a push overtook was ignored: the client went on without the
proof the server had just asked for, or signed a round it need not,
until the next answer. Every answer on the current session counts
now. One that arrives after a newer answer can set the older state
for a round, and the next answer corrects it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-11 18:44:37 +08:00
rustdeskandClaude Fable 5.2 aeb18ccb17 Send the device's proof only until the server says it holds it
Data to the client now starts with one byte that says whether the
server holds the proof of this session. A client signs its data until
it is told so and again once it is told otherwise, so a registration
after the first carries no 64-byte signature: the session key already
authenticates it, as TLS 1.3 and WireGuard authenticate once per
session. Only an answer to a registration says either; a push says
neither, a value this version does not know changes nothing, and an
answer that arrives after a newer one does not undo it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-11 04:40:18 +08:00
rustdeskandClaude Opus 5.5 398e9c2df3 Prove the device inside the session instead of in the hello
A hello now carries no device signature and no time, so a recorded one
names no device even to a server key taken later. Data to the server
carries the proof instead: the device key signs a value derived from the
session key (RFC 9266's tls-exporter), after the key exchange and under
its keys, as SIGMA-I and TLS 1.3's CertificateVerify do. A one-off
datagram from another socket can go under the same session, sharing its
packet number counter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-08 12:28:10 +08:00
rustdeskandClaude Opus 5.5 50e3a3aa06 Answer a hello past the budget with a cookie for its address
A server past its hello budget dropped the hello, so a flood of forged
hellos kept every new socket from its welcome until it fell back to
plaintext. The server now answers such a hello with a cookie, a MAC of
the client's address, and takes the same hello again with the cookie
attached, which proves the address can receive: WireGuard's cookie reply
under load and QUIC's Retry (RFC 9000 8.1.2). The reply echoes part of
the hello's enc, so only one who saw the hello can forge it, and it is
shorter than any hello. The client keeps the cookie for two minutes and
attaches it to its hellos; the cookie is bound to the address, not the
socket, as QUIC's tokens are, so a one-off socket may carry it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-07 22:47:57 +08:00
rustdeskandClaude Opus 5.5 0f7670c0b9 Mix an ephemeral DH into the welcome for forward secrecy
The welcome now carries a fresh server ephemeral, and the DH of it with
the hello's ephemeral is mixed into the welcome key (Noise NK's
`<- e, ee`, folded in with Noise's MixKey). A server key taken later
redoes a recorded hello's HPKE but opens neither the welcome nor the
session it hands out. The hello itself stays readable to that key, as
WireGuard's first message does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-07 22:46:19 +08:00
rustdeskandClaude Opus 5.5 8b36deb350 Open pushes under the session a welcome replaced until the new one is
A server that waits to see a new session used before pushing under it
(key confirmation, as WireGuard's next_keypair) keeps pushing under the
old one after its welcome has gone out. The client now keeps that old
session for receiving until a datagram opens under the new one, the way
QUIC keeps old read keys for a while after a key update (RFC 9001 §6).
Sending always uses the newest session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-07 01:37:44 +08:00
rustdeskandClaude Opus 5.5 5573c9cba4 Name the standard behind each udp_seal construction
The module doc already pointed at HPKE, Oblivious HTTP and PSP. It now
also names what the packet numbers, the replay window, the first-byte
split and the subkey PRF follow, and the analysis of using the server's
signing key for X25519 as well. Comments only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-07 01:16:51 +08:00
rustdeskandClaude Opus 5.5 b6a92a6405 Treat a datagram too short for a hello as none
The server charges its hello budget for every hello, so a 5-byte header
spent it as well as a real one. A hello is at least an unsigned one with
no payload, 54 bytes; anything shorter is now neither counted nor opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-06 20:49:07 +08:00
rustdeskandClaude Opus 5.5 d98e65051f Widen the udp_seal replay window to 1024 numbers
Pushes take their packet numbers from one counter for the whole server,
so on a server with a hundred thousand devices the 64 numbers below the
highest seen cover about ten milliseconds, and a push the network
delays by more is dropped as a replay. A 1024-bit ring covers about
150 ms at that rate, for 120 more bytes per window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-06 16:04:00 +08:00
rustdeskandClaude Opus 5.5 94a6d132dc Keep the client session while a signed hello replaces it
A client that re-signs its session dropped it first, so until the new
welcome came back pushes under the old key could not open and a
plaintext push was taken even from a server that seals every push.
ClientSeal::hello builds a hello without touching the session; the
welcome replaces it as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-06 10:24:11 +08:00
rustdeskandClaude Opus 5.5 1462a4b17c Let a client seal switch device keys without losing its session
A device whose key pair changes at runtime re-registers its new public key;
its later hellos must be signed by the new secret key, or the server can
never tie a seal to the device again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-06 03:09:27 +08:00
rustdeskandClaude Opus 5.5 395c54da26 Add FramedSocket::send_bytes for datagrams built outside protobuf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-05 23:48:19 +08:00
rustdeskandClaude Opus 5.5 fbf11ddbc8 Add udp_seal: sealed datagrams between a client and its rendezvous server
One sealed datagram per message and no handshake: an RFC 9180 HPKE single
shot to the server's signing key converted to X25519, signed by the device
key the server has on record, answered by a welcome sealed under an exported
key and a fresh nonce (RFC 9458) that hands over a session key the server
re-derives from a process secret and the key id. Data carries the key id
and a packet number under per-direction subkeys, with a replay window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8
2026-11-05 23:43:20 +08:00
RustDesk fae47e024d Merge pull request #619 from fufesou/fix/trusted-device-v2
Add trusted-device storage with atomic legacy migration
2026-10-28 10:43:54 +08:00
RustDesk af4aa80adc Merge pull request #628 from jahvari/codex/fix-udp-send-recovery-upstream
Recover direct UDP sends after a failed datagram
2026-10-28 09:06:16 +08:00
jahvari 73633529f1 Document changed function contracts 2026-10-27 10:23:37 -05:00
jahvari 4db65ced52 Keep direct UDP send failures from poisoning later datagrams 2026-10-26 13:11:38 -05:00
fufesou 3ee3afd438 Serialize peer deletion with credential writes
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-26 15:22:00 +08:00
fufesou f15eb3d40d Merge branch 'main' into fix/trusted-device-v2 2026-10-25 18:07:47 +08:00
RustDesk edefa08b79 Merge pull request #626 from rustdesk/custom-websocket-port
feat(websocket): add websocket-port for a proxy off the default port
2026-10-22 17:52:30 +08:00
rustdeskandClaude Opus 5.5 dfb9d0d1c6 fix(websocket): match websocket-port only against configured servers
websocket_port() took the rendezvous host from get_rendezvous_server(),
which falls back to a cached or public server when none is set. With
only relay-server and websocket-port set, the public rendezvous server
also got the port, and registration failed. Match the servers this
client is set up with instead: the exe-name host, custom-rendezvous-server,
the build-time server, and relay-server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:28:28 +08:00
rustdeskandClaude Opus 5.5 b3bf7b76e2 fix(websocket): throttle the invalid websocket-port warning
check_ws runs on every rendezvous reconnect, online query and relay
connect, so an invalid websocket-port logged a warning each time.
Keep one line a minute with a count of the rest. Also import the key
with the other config keys instead of in the function body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:04:26 +08:00
fufesou cef0aedf40 Keep trusted-device credentials in configuration sync snapshots
Refresh cached trust fields after successful credential writes and provide explicit persisted credential synchronization. Ordinary settings saves continue to preserve the destination credentials.

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-22 16:25:27 +08:00
rustdeskandClaude Opus 5.5 34846eef9f feat(websocket): add websocket-port for a proxy off the default port
check_ws turns a domain endpoint into ws(s)://<domain>/ws/id or
/ws/relay with no port, so a reverse proxy that cannot take 443 (or 80)
is unreachable, even when api-server already points at it, for example
https://example.com:8443.

websocket-port adds that port for the hosts this client is configured
with: custom-rendezvous-server and relay-server. A relay that hbbs hands
out on another host, or a peer's server, keeps the default port, since
another machine has its own proxy. IP endpoints are unchanged, and an
empty option gives the same URL as before.

https://github.com/rustdesk/rustdesk-server-pro/discussions/1029

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:05:24 +08:00
fufesou 41d50c4052 Remove unused trusted-device import stripping helper
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-21 23:07:40 +08:00
fufesou 77f924d7a3 fix: support atomic legacy trusted-device migration
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-20 23:24:04 +08:00
RustDesk ed07431021 Merge pull request #620 from 21pages/suppress_log
fix: reduce noisy smithay client toolkit logs
2026-10-20 16:50:15 +08:00
fufesou 040bf3f662 refactor: remove unused legacy trusted-device detector
The V2 management UI no longer displays legacy enrollment metadata. Remove the unused presence helper while preserving legacy records during ordinary saves.

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-20 16:11:45 +08:00
fufesou e2b17fd06c fix: recover config saves while preserving valid legacy trust
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-19 01:21:02 -07:00
fufesou e4f0e8fa9b Merge branch 'main' into fix/trusted-device-v2 2026-10-18 20:45:59 -07:00
fufesou 2289227c5f fix: preserve legacy trust data and validate V2 storage
Retain legacy trusted-device records for migration without using them for authentication. Preserve malformed V2 values for strict validation while allowing explicit revocation to replace them.

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-16 05:21:07 -07:00
21pages 20d5019a42 fix: reduce noisy smithay client toolkit logs 2026-10-16 17:35:46 +08:00
RustDesk 5d52530b63 Merge pull request #609 from AzimovIz/remoteUSB
Add REMOTE_USB connection type
2026-10-14 20:51:07 +08:00
RustDesk a63c5b2301 Merge pull request #600 from 21pages/websocket-proxy
websocket proxy support
2026-10-14 20:50:15 +08:00
21pages 423fb71085 fix: return local address for direct WebSocket connections 2026-10-14 20:04:48 +08:00
fufesou dcc0381b7b fix: preserve trusted credentials when configuration reads fail
Stop ordinary Config2 and peer settings saves when the current file cannot be read. Keep first-save behavior for missing files and log failures without replacing V2 records with defaults.

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-14 02:21:27 -07:00
fufesou c11a5971a3 fix: minimize trusted-device configuration save changes
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-13 18:48:53 -07:00
fufesou 8791bf0d33 fix: simplify trusted-device configuration storage
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-13 18:18:38 -07:00
21pages 0ccaaf2cf6 fix: parse IPv6 HTTP proxy authorities correctly 2026-10-13 18:58:42 +08:00
fufesou a2df328d0b fix: preserve trusted-device grants in Config2
Add fallible grant persistence with file locking and atomic replacement. Preserve the persisted grant state during ordinary settings writes so stale configuration snapshots cannot restore revoked devices.

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-12 21:59:19 -07:00
21pages 2d998e7b02 fix: reuse the initial TCP connection for HTTPS proxies 2026-10-13 11:51:29 +08:00
21pages 4c04a7a130 fix: allow proxy reads while flushing is pending 2026-10-13 11:51:29 +08:00
21pages 19b8b2242d fix: always use configured proxy for WebSocket 2026-10-12 18:58:03 +08:00
21pages 9ee2f3ef9a fix: bracket IPv6 targets in HTTP CONNECT requests 2026-10-10 19:45:51 +08:00
21pages 3aade011c0 feat: add opt-in WebSocket proxy support
Support WS and WSS over SOCKS5, HTTP, and HTTPS proxies, including custom
ports. Use the configured proxy only when allow-websocket-proxy is enabled;
explicit proxy configuration takes precedence. Propagate proxy failures
without retrying a direct connection.

Add regression coverage for proxy routing, authentication, TLS, custom
ports, direct defaults, and failure handling.

Signed-off-by: 21pages <sunboeasy@gmail.com>

fix: flush WebSocket proxy tunnels before native TLS reads

Flush buffered HTTP and HTTPS tunnel writes before NativeTls reads so WSS handshakes can complete on macOS. Apply the adapter only to NativeTls WebSocket connections through HTTP or HTTPS proxies.

Extend the existing proxy round-trip test with HTTPS and SOCKS5 NativeTls cases. The websocket_proxy integration test passes in the rustdesk workspace.

Signed-off-by: 21pages <sunboeasy@gmail.com>

refactor: simplify WebSocket proxy configuration

Select the configured proxy inside WsFramedStream::new based on the WebSocket proxy option and remove the explicit proxy argument. Update the socket client and drop the unused Stream::connect_websocket wrapper.

Adapt integration tests to configured proxies and cover custom target ports and WebSocket close handling.
2026-10-10 11:50:09 +08:00
AzimovIzandClaude Opus 5.5 b4be9744bf Drop the REMOTE_USB connection type
USB forwarding now runs inside a normal remote desktop session
(rustdesk/rustdesk#16278), so it needs no connection type of its own. Only
ControlPermissions.Permission.usb remains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: AzimovIz <sergo.p.987@gmail.com>
2026-10-09 13:44:15 +00:00
AzimovIzandClaude Opus 5.5 bee7c2458c Add REMOTE_USB connection type and usb control permission
Adds ConnType::REMOTE_USB for the RemoteUsb feature (rustdesk/rustdesk#16278),
following the same pattern as TERMINAL, and ControlPermissions.Permission.usb
so USB forwarding can be controlled centrally like the other permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: AzimovIz <sergo.p.987@gmail.com>
2026-09-26 13:12:59 +00:00
rustdeskandClaude Opus 5.5 94ec710894 Build the webrtc feature standalone against the rustdesk-org fork
src/webrtc.rs calls fork-only APIs (set_ice_max_binding_requests,
set_no_congestion_control), which only rustdesk's root [patch] supplied,
so building this crate on its own with --features webrtc failed with
E0425/E0599. Mirror the root patch here; it applies only when this crate
is the root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019aokqJuhjvB3kijXtAg5Ns
2026-09-25 16:30:59 +08:00
RustDesk 229b904508 Merge pull request #614 from rustdesk/kx-v2
Kx v2
2026-09-23 14:48:27 +08:00