rustdesk / rustdesk/rustdesk-server
hbbs server generates random key when no key is specified, making it impossible for clients to connect
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 10.4k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I've discovered what appears to be a logic issue in the hbbs (RustDesk ID/Rendezvous Server) implementation that makes it impossible for clients to connect when the server is started without an explicit key.
The Problem
When analyzing the code, I found the following behavior:
- In
src/main.rs, if no-k(key) argument is provided, the server defaults to"-":
RendezvousServer::start(port, serial, &get_arg_or("key", "-".to_owned()), rmem)?;
- In
src/rendezvous_server.rs, theget_server_skfunction treats"-"as a special value and generates a new random key pair:
if key.is_empty() || key == "-" || key == "_" {
let (pk, sk) = crate::common::gen_sk(0);
out_sk = sk;
if !key.is_empty() { // Since key is "-", this is true
key = pk; // Replaces "-" with newly generated public key
}
}
- Later in
handle_punch_hole_request, the server checks if the client's key matches:
if !key.is_empty() && ph.licence_key != key {
// Returns LICENSE_MISMATCH error
}
The Issue
This creates a situation where:
- If you start the server without specifying a key, it generates a random key
- Clients have no way to know this randomly generated key
- All client connections fail with
LICENSE_MISMATCH
The only way to disable key checking would be to have an empty key string, but that's impossible because:
- Empty input → replaced with
"-"in main.rs "-"→ generates new random key- Random key is never empty → key checking is always enabled
Question
Is this the intended behavior? If so, how are self-hosted servers supposed to work when no key is specified?
It seems like either:
- The server should not generate a random key when
"-"is provided (just keep it as"-"or empty) - Or there should be a way to truly disable key checking
- Or the generated key should be communicated to clients somehow
Am I misunderstanding the intended logic here? How is this supposed to work for self-hosted deployments?
Environment
- RustDesk Server (hbbs)
- Self-hosted deployment
Thank you for clarifying this behavior!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main.rs and trace the default key value into src/rendezvous_server.rs, especially get_server_sk and handle_punch_hole_request. Confirm the intended no-key behavior and how the generated or empty key reaches client validation. Done means the no-key path has an explicit, testable behavior that does not leave clients unable to connect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100