Skip to content

rustdesk-server: add new package - #30572

Open
luminoso wants to merge 1 commit into
openwrt:masterfrom
luminoso:feature/rustdesk-server
Open

luminoso wants to merge 1 commit into
openwrt:masterfrom
luminoso:feature/rustdesk-server

Conversation

@luminoso

@luminoso luminoso commented Sep 21, 2026

Copy link
Copy Markdown

📦 Package Details

Maintainer: @luminoso (new package)

Description:

Adds the RustDesk self-hosted server, built from the upstream 1.1.16 tag.

Two packages come out of one Makefile:

  • rustdesk-server: the ID server hbbs and the relay server hbbr, one procd init script (/etc/init.d/rustdesk-server) and one UCI file (/etc/config/rustdesk-server). The key pair hbbs writes to /etc/rustdesk is listed under conffiles, so the server identity survives sysupgrade.
  • rustdesk-utils: the rustdesk-utils command line tool for generating and checking key pairs. Optional.

Notes for review:

  • Source is the GitHub tarball of the tag plus a second tarball for the libs/hbb_common submodule, pinned to the commit the tag records.
  • One patch: the upstream build script pulls all of hbb_common, including libsodium-sys, into the host build, which links the target libsodium into a host binary on every cross build. The patch writes src/version.rs from CARGO_PKG_VERSION with std only. Upstream-Status: Pending.
  • Runtime dependency is libsodium only. OpenSSL is a build-time dependency: hbb_common depends on tokio-native-tls, so openssl-sys has to compile, but neither daemon calls it and the linker drops libssl and libcrypto. readelf -d on hbbs and hbbr lists libsodium, libgcc_s and libc.
  • Architectures are limited to aarch64, arm, i386 and x86_64. The ring 0.16 crate in the dependency graph builds for no other target, which is also the set upstream builds. Widening needs upstream to move to jsonwebtoken 9 and the sqlx native-tls runtime.
  • Both daemons run through /usr/libexec/rustdesk-hbb, a four line wrapper that does cd /etc/rustdesk and execs the binary. Both daemons write their key pair to the working directory, and the wrapper name gives a stable syslog ident. The directory is created 0700.
  • The init script publishes fw4 firewall rules through procd instance data when open_firewall is set, and signals fw4 from service_started and service_stopped. hbbs opens the ID, NAT test and web socket TCP ports plus the UDP ID port; hbbr opens the relay and web socket ports. Default is off.
  • The peer database lives in /tmp on purpose: it is a cache of client registrations that clients redo on their next heartbeat, and hbbs writes it on every registration.
  • procd restarts both instances on any reload because it re-reads the instance set. That costs about ten seconds of downtime because the daemons ignore SIGTERM and wait for the kill. This is procd behaviour, not something the init script can avoid.
  • Config ships with both services disabled.

Motivation: openwrt/luci#8946 and openwrt/luci#8935. luci-app-rustdesk-server in the luci feed ships an init script but no binaries, so users copied hbbs and hbbr in by hand. Companion PR that makes the app depend on this package: openwrt/luci#9058. The current app owns the init script and config paths, so that PR has to follow this one.


🧪 Run Testing Details

  • OpenWrt Version: SNAPSHOT r36377-b6ba4e9142
  • OpenWrt Target/Subtarget: x86/64
  • OpenWrt Device: QEMU/KVM guest

Checked in the VM: both daemons listen on all six ports, syslog ident is rustdesk-hbb[pid], the six fw4 accept rules appear on start and disappear on stop with no manual firewall reload, hbbs --version prints 1.1.16, sysupgrade -l lists the config file and both key files, and a sysupgrade keeps them. test-version.sh checks both binaries. Only an x86_64 SDK is available here; the aarch64 and arm CI jobs are the cross-build check.


✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using make package/rustdesk-server/refresh V=s
  • It is structured in a way that it is potentially upstreamable

Comment thread net/rustdesk-server/Makefile Outdated
Comment thread net/rustdesk-server/Makefile Outdated
Comment on lines +77 to +78
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) ./files/rustdesk-server.upgrade $(1)/lib/upgrade/keep.d/rustdesk-server

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right. Why conffiles are not sufficient?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conffiles covers /etc/config/rustdesk-server, which the package installs, and that is already listed.

The keep.d entry is for /etc/rustdesk/, where hbbs writes its key pair on first start. That pair is not in the package file list, so it has no conffiles entry and sysupgrade would drop it. Clients pin the server by that public key, so every client would need reconfiguring after an upgrade. keep.d is how tinc, fastd, ocserv and openvpn keep the same kind of runtime key material.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be marked as resolved as it isnt. Have you tested it with only conffiles? :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake to mark as resolved. I tested it: the build turns every conffiles entry that is not shipped in the package into a generated /lib/upgrade/keep.d/<pkg> (include/package-pack.mk, KEEP_$(1) from the conffiles list), which is how dropbear keeps its host keys.

7d1db96 lists the two key files under conffiles and drops the hand-written keep.d file. In the VM the generated keep.d has the two paths and sysupgrade -l lists the config file and both keys.

@BKPepe

BKPepe commented Sep 21, 2026

Copy link
Copy Markdown
Member

Companion PR: openwrt/luci#XXXX.

You need to fix this in PR description.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/rustdesk-server/Makefile
Comment thread net/rustdesk-server/files/rustdesk-server.init
Comment thread net/rustdesk-server/files/rustdesk-server.init
Comment thread net/rustdesk-server/files/rustdesk-server.init
Comment thread net/rustdesk-server/Makefile Outdated
@luminoso
luminoso force-pushed the feature/rustdesk-server branch 2 times, most recently from 9fb5a10 to b3ddf10 Compare September 21, 2026 17:04

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment on lines +7 to +9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/rustdesk/rustdesk-server/tar.gz/$(PKG_VERSION)?
PKG_HASH:=846379e1555396ba8c8f26edbfbfb7f36618ef3e5d658b6022ed24617cf7edfa

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the PR body still describes the previous revision — it says "Source is the git tag, not the release tarball" and "No patches in this PR", while this revision uses the codeload tarball and adds patches/010-build-script-without-hbb_common.patch. It also gives the companion as openwrt/luci#8935, an issue, rather than the PR openwrt/luci#9058 named in the thread above.


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch header fixed in 7d1db96, git-am shape.

empty because nothing reads it and a constant value keeps the build
reproducible.

Upstream-Status: Pending

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it submitted to upstream?

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

Adds the RustDesk self-hosted server built from the upstream 1.1.16 tag.
The rustdesk-server package installs the ID server (hbbs) and the relay
server (hbbr) with one procd init script and one UCI configuration file,
and lists the key pair hbbs writes to /etc/rustdesk as conffiles, so the
server identity survives an upgrade. The optional rustdesk-utils package
installs the command line tool used to generate and validate key pairs.

GitHub tarballs leave out the libs/hbb_common submodule, so it is
fetched as a second tarball pinned to the commit the tag records.

Architectures are limited to aarch64, arm, i386 and x86_64. The ring
0.16 crate in the dependency graph builds for no other target, which is
also the set upstream builds itself.

luci-app-rustdesk-server will depend on this package, so installing the
LuCI application pulls the binaries in instead of leaving the user to
copy them by hand.

A patch replaces the build script so it no longer depends on
hbb_common. Building that crate for the host also built libsodium-sys,
which linked the target libsodium into a host binary and broke every
cross build; the replacement writes src/version.rs from
CARGO_PKG_VERSION with the standard library.

Signed-off-by: Guilherme Cardoso <luminoso@gmail.com>
@luminoso
luminoso force-pushed the feature/rustdesk-server branch from 35d4d79 to 9dcdc8d Compare September 22, 2026 07:32

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants