181 Commits
Author SHA1 Message Date
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
rustdesk 2c57e51ec5 higher default bandwidth 2025-06-22 15:03:13 +09:00
bato3 235a3c326c In cargo it is named "rustdesk-utils" (#551) 2025-04-29 20:40:55 +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
Fionera b37033d92c docs: the servers are by comma instead of colon (#462) 2024-09-28 23:34:47 +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
rustdesk c4c26dd6d7 change -k to default _ 2024-05-24 17:57:37 +08:00
writegr 6e91f41a10 chore: fix some typos in comments (#404)
Signed-off-by: writegr <wellweek@outlook.com>
2024-04-18 14:39:10 +08:00
rustdesk 79f0eb497b trim private key 2024-01-31 11:30:42 +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
RustDesk 324dfd6a1f fix https://github.com/rustdesk/rustdesk-server/issues/306 2024-01-30 19:02:30 +08:00
RustDesk 70242e6eb2 Update common.rs 2024-01-30 18:29:04 +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 e2f4962ba8 clippy 2023-02-08 16:45:30 +08:00
rustdesk 7e307a5a1c CI 2023-02-08 16:00:12 +08:00
rustdesk d88e4b5151 make hbbr / hbbs share the PORT value of .env 2023-02-01 23:31:00 +08:00
rustdesk fe3b42809a run gen_version no matter debug or release 2023-02-01 10:49:16 +08:00
rustdesk 32ee474813 fmt 2023-01-10 23:03:44 +08:00
rustdesk 46a7c025a0 update version 2023-01-10 22:56:28 +08:00
rustdesk fc83fa0a04 try_into_v4 2023-01-10 16:09:25 +08:00
rustdesk 6bd5621fb0 fix ci 2023-01-07 12:38:21 +08:00
rustdesk 605d0dd6c1 fix clippy 2023-01-07 11:59:53 +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