Commit Graph
125 Commits
Author SHA1 Message Date
rustdeskandClaude Opus 5.5 44de977af3 Validate relay UUIDs before forwarding
The peer sends the relay uuid to whatever relay_server names, so a uuid
carrying line breaks reaches that service verbatim. RequestRelay and
RelayResponse with a uuid that is empty, longer than 128 bytes, or outside
[A-Za-z0-9_-] now close the connection. The empty ack a peer sends for a
RequestRelay is still allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkh9Gd5dwGW8vL9JNV8
2026-11-04 17:28:10 +08:00
fufesou 873230e35a fix: key file perm (#705)
* fix: key file perm

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: enforce secure private key permissions on Unix

Create new keys with mode 0600 and verify permissions before writing.
Tighten existing keys to 0600 and propagate permission failures.
Preserve dangling symlinks and clean up failed key creation.

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: preserve read-only keys and prevent public key clobbering

Accept existing 0400 keys without changing their permissions.
Write the public key only after private key creation and writing succeed.

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: generate missing public keys and reject mismatched key pairs

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: publish public keys atomically without overwriting existing files

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: key file perms, comments

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: reject key conflicts and clean up failed private key writes

Reuse symlink resolution and simplify key loading and regression tests.

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: key file perm, simple refactor

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
2026-10-10 17:34:18 +08:00
RustDeskandClaude Opus 5.5 5e37f45dfe Fix/punch reqs bound (#713)
* fix(hbbs): bound the punch-request record store

PUNCH_REQS grew without limit; its dedupe scan only covers the newest 30
entries, so cycling 31 online peer ids from one source appended a record
per request for the lifetime of the process. Keep at most 10,000 entries,
evicting the oldest.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

* feat(hbbs): make the punch-request record cap configurable

MAX_PUNCH_REQUESTS sets how many records the punch-requests console
command keeps (default 10000); 0 disables recording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

* fix(hbbs): cap peer id length at 253 bytes

RegisterPk accepted ids up to a whole UDP datagram, so 31 registered
peers with ~64 KB ids still let the bounded punch-request store reach
hundreds of MB. Reject longer ids in RegisterPk and RegisterPeer, the
same bound the Pro server uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

* feat(hbbs): keep 100000 punch-request records by default

With peer ids capped at 253 bytes a full store is roughly 45 MB at
worst, so a larger default keeps more console history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

* test(hbbs): assert which punch-request records survive eviction

The length check alone passed if the newest record were evicted or new
records were dropped once full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

* test(hbbs): cover MAX_PUNCH_REQUESTS=0 in the punch-request test

At zero capacity the loop never ran and the new front/back asserts
unwrapped an empty queue. Make at least one request so the disabled
path is exercised, and only check eviction order when records are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PkpVy2ufxgEjKd3SjXPnJ8

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 16:51:29 +08:00
rustdesk af7d7f0b02 fix bin 2026-07-25 11:42:45 +08:00
rustdesk 538aef71d1 bind interface and refactor doc 2026-07-24 10:56:56 +08:00
rustdesk 109d9a2351 fix more UDP reflection/amplification 2026-07-23 18:43:32 +08:00
rustdesk 70dcfdeb95 https://github.com/rustdesk/rustdesk-server/issues/634 2026-07-21 07:12:57 +08:00
Luc BusquinandClaude Opus 4.8 91fb928c6e Fix i32 overflow: peers offline 24.9-49.7 days wrongly reported online (#676)
`Duration::as_millis()` returns u128; casting it `as i32` in the
online-status and punch-hole checks keeps only the low 32 bits as a
signed integer. Once a peer has not registered for more than 2^31 ms
(~24.855 days), the value wraps negative and passes the
`elapsed < REG_TIMEOUT` test, so a long-offline peer is reported online
and connection attempts are relayed to its stale socket_addr. The
in-memory peer map is never evicted, so last_reg_time stays frozen until
hbbs restarts, making the false-online window 24.86-49.71 days (and it
repeats every ~49.71 days).

Widen REG_TIMEOUT and the two elapsed casts from i32 to i64 so the
comparison no longer overflows.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 10:14:03 +08:00
rustdesk 80d3a50566 https://github.com/rustdesk/rustdesk-server/issues/670 2026-07-01 12:17:57 +08:00
rustdesk 46e9ecd47d fix pr 2026-01-12 17:28:25 +08:00
rustdesk 5d1b4ba78a connection log query 2026-01-06 23:59:47 +08:00
rustdesk 4e8d6d08e2 fix https://github.com/rustdesk/rustdesk-server/issues/435 2025-11-03 13:03:19 +08:00
乐 621da3c8fe fix: 127.0.0.1 is not loopback (#515) 2025-02-06 20:25:10 +08:00
21pages 7a509f6975 replace libs/hbb_common with submodule (#502)
cargo update -p schannel to fix crash on higher rust toolchain, https://github.com/seanmonstar/reqwest/issues/2311

Signed-off-by: 21pages <sunboeasy@gmail.com>
2025-01-20 17:34:22 +08:00
Integral 772db7422f refactor: replace static with const for global constants (#494) 2024-12-07 17:54:53 +08:00
rustdesk 6f18a97644 v1.1.12 2024-10-07 16:21:36 +08:00
rustdesk e40994d62e remove useless KEY_FOR_API 2024-05-26 21:43:13 +08:00
rustdesk 5078a1f797 reuse port, and revert hbbr -k 2024-05-24 18:37:11 +08:00
Paolo Asperti 94ae51458c fix Pk size check (#361)
* more descriptive error

* fix key size check
2024-01-31 11:21:00 +08:00
paspo cea8403dbc private key size check 2024-01-30 11:18:43 +01:00
rustdesk 1142cf105b Fix #324 to remove unsafe 2023-12-01 11:32:07 +08:00
rustdesk f1e941bf9f fix is_loopback 2023-06-16 15:13:23 +08:00
rustdesk 411502cd0b https://github.com/rustdesk/rustdesk-server/issues/260 2023-06-08 20:02:30 +08:00
rustdesk fd1c21b114 fmt 2023-06-08 14:11:37 +08:00
RustDesk d8e3cb9e65 Merge pull request #249 from nsgundy/FixNoDirectConnectionWhenBothPeersOnLan
Fix no direct connection when both peers on LAN
2023-06-08 13:53:09 +08:00
rustdesk 3a7904fa8e fix test_hbb and bump version 1.1.8 2023-06-08 13:42:34 +08:00
nsgundy 85a20769fb Consider peers to be on same intranet if is_lan() returns true for both 2023-05-19 15:21:59 +00:00
nsgundy aeeca0d7d1 Fix ip4 mapped ip6 addresses not considered to be part of network 2023-05-19 15:21:20 +00:00
rustdesk 675bf3c1f5 fix command line buffer and test addr 2023-03-16 00:53:58 +08:00
rustdesk ec202209f3 fix ID_EXISTS not sent out due to ipv6 change 2023-02-18 13:41:45 +08:00
rustdesk 7e307a5a1c CI 2023-02-08 16:00:12 +08:00
rustdesk fc83fa0a04 try_into_v4 2023-01-10 16:09:25 +08:00
rustdesk 55b841afb5 one more clippy 2023-01-07 00:37:12 +08:00
RustDesk 0e01cfcd3a Merge branch 'master' into fix-clippy-warning 2023-01-07 00:28:18 +08:00
rustdesk e70d82b30f ipv6 support draft 2023-01-06 20:31:15 +08:00
Bo Zhang 60a6d672c5 Fix: clippy warning in rust 1.66.0 2023-01-06 18:48:18 +09:00
RustDesk 75a40412b4 Merge branch 'master' into listern-for-unix-signal 2023-01-06 11:09:52 +08:00
Huabing Zhou 2314783d42 sync rustdesk's hbb_common here 2023-01-06 10:40:26 +08:00
fufesou 099aaa6b55 query_onlines: trivial refactor
Signed-off-by: fufesou <shuanglongchen@yeah.net>
2022-10-04 13:09:56 +08:00
dlhxzb ca2bc99a38 Feat: listen for unix signal 2022-08-04 18:02:10 +09:00
fufesou f7fc45a3d2 peer_online_state: response online state bits
Signed-off-by: fufesou <shuanglongchen@yeah.net>
2022-07-27 00:35:40 +08:00
fufesou a4940f4634 peer_online_state: serve online state
Signed-off-by: fufesou <shuanglongchen@yeah.net>
2022-07-26 23:03:30 +08:00
rustdesk 51d8cd80c1 protbuf 3.1 with_bytes 2022-07-22 00:28:10 +08:00
rustdesk acaee5b7a4 https://github.com/rustdesk/rustdesk-server/issues/24 2022-07-14 18:39:42 +08:00
rustdesk 39153ce147 fix slow connection, '/' in pub key, and hbbr wait for key, and possible
solution for https://github.com/rustdesk/rustdesk-server/issues/24
2022-07-13 00:22:45 +08:00
rustdesk cb26ce5bbc remove confusions 2022-05-13 09:56:44 +08:00
rustdesk df2e4bb411 remove lic check 2022-05-12 20:22:19 +08:00
rustdesk b3f39598a7 change sled to sqlite and remove lic 2022-05-12 20:00:33 +08:00
open-trade 411e963187 some guys use empty id 2021-05-11 20:28:43 +08:00
open-trade af4469711c bug fix 2021-05-11 19:30:43 +08:00