A self-hosted API server for RustDesk — user & device management, address books, audit logs and a built-in admin web UI, all shipped as a single self-contained binary.
It is a from-scratch Rust rewrite of lejianwen/rustdesk-api,
with its own brand-new admin web interface (not the original web project).
English · 中文
- Works with the RustDesk client out of the box — login, heartbeat, device (peer) registration, address books, groups, and the web client config. JSON shapes, headers and tokens match the original server, so existing clients need no changes.
- Admin web console (served at
/_admin/) to manage:- Users, groups, device groups, tags, devices
- Address books, collections and share rules
- OAuth providers, login logs, connection/file audit logs, share records, tokens
- Light/dark theme, English / Русский / 中文
- Sign-in options: username/password (with captcha + rate limiting), third-party login (GitHub, Google, OIDC, LinuxDO), web SSO, and LDAP.
- Personal area for each user to manage their own devices, address book, tags, share records and login history.
- Developer access: scoped, expiring API keys, Rust/Go/Node.js SDK examples,
and public OpenAPI at
/api/v1/openapi.json. See the integration guide. - Server commands: send commands to your RustDesk ID/relay server from the console.
- Geo relay routing: manage ordered country/city/subdivision/ASN/network rules and optional MMDB downloads from the existing admin console.
- Single binary: the web UI, translations and templates are embedded — nothing else to deploy. Works with SQLite, MySQL or PostgreSQL; tables are created automatically on first run.
- Observability: public
/healthand Prometheus-compatible/metricsendpoints for containers, load balancers and monitoring systems. - File upload: local uploads out of the box, or direct-to-OSS with a signed policy.
docker compose up -d --buildThen open http://<host>:21114/_admin/.
docker run -d --name rustdesk-console -p 127.0.0.1:21114:21114 \
-e TZ=Asia/Shanghai \
-v $PWD/data:/app/data -v $PWD/conf:/app/conf \
ghcr.io/dockers-x/rustdesk-console:latestRelease tags build images for GHCR (ghcr.io/dockers-x/rustdesk-console).
# 1) build the admin web UI (outputs into resources/admin)
cd web && npx pnpm@10.34.0 install --frozen-lockfile && npx pnpm@10.34.0 run build && cd ..
# 2) build the server (embeds the UI)
cargo build --release
./target/release/rustdesk-console -c ./conf/config.yamlThere is no fixed default password. The server listens on 0.0.0.0:21114; open
/_admin/ after the first start.
If admin.password / RUSTDESK_API_ADMIN_PASSWORD is empty, the login page shows
an initial setup wizard. Create the first local administrator there.
If admin.password / RUSTDESK_API_ADMIN_PASSWORD is set before the first
database seed, the server creates the initial administrator automatically:
- Username:
adminby default, orRUSTDESK_API_ADMIN_USERNAME - Password: the configured
admin.password/RUSTDESK_API_ADMIN_PASSWORD
If you need to recover access later, reset the password any time:
rustdesk-console reset-admin-pwd --password-file /path/to/console-passwordThese initial admin settings are applied only when the database is first
initialized; later restarts never overwrite an existing admin user. Set
admin.force-change-password / RUSTDESK_API_ADMIN_FORCE_CHANGE_PASSWORD=true to
require the environment-created initial admin user to change the password after
the first sign-in.
Settings live in conf/config.yaml. Every setting can also be provided via an
environment variable named RUSTDESK_API_<PATH> — uppercase the key path, join with
_, and replace - with _.
| Setting | Environment variable |
|---|---|
rustdesk.id-server |
RUSTDESK_API_RUSTDESK_ID_SERVER |
rustdesk.relay-server |
RUSTDESK_API_RUSTDESK_RELAY_SERVER |
rustdesk.api-server |
RUSTDESK_API_RUSTDESK_API_SERVER |
rustdesk.ws-host |
RUSTDESK_API_RUSTDESK_WS_HOST |
rustdesk.ws-id-host |
RUSTDESK_API_RUSTDESK_WS_ID_HOST |
rustdesk.ws-relay-host |
RUSTDESK_API_RUSTDESK_WS_RELAY_HOST |
rustdesk.key |
RUSTDESK_API_RUSTDESK_KEY |
admin.title |
RUSTDESK_API_ADMIN_TITLE |
admin.username |
RUSTDESK_API_ADMIN_USERNAME |
admin.password |
RUSTDESK_API_ADMIN_PASSWORD |
admin.force-change-password |
RUSTDESK_API_ADMIN_FORCE_CHANGE_PASSWORD |
db.type |
RUSTDESK_API_DB_TYPE (sqlite / mysql / postgresql; default sqlite) |
db.max-idle-conns / db.max-open-conns |
RUSTDESK_API_DB_MAX_IDLE_CONNS / RUSTDESK_API_DB_MAX_OPEN_CONNS |
mysql.addr / mysql.dbname / … |
RUSTDESK_API_MYSQL_ADDR / RUSTDESK_API_MYSQL_DBNAME / … |
jwt.key |
RUSTDESK_API_JWT_KEY |
app.register |
RUSTDESK_API_APP_REGISTER |
app.disable-pwd-login |
RUSTDESK_API_APP_DISABLE_PWD_LOGIN |
app.web-sso |
RUSTDESK_API_APP_WEB_SSO |
record-storage.type |
RUSTDESK_API_RECORD_STORAGE_TYPE (local / s3 / webdav) |
record-storage.local-dir / record-storage.temp-dir |
RUSTDESK_API_RECORD_STORAGE_LOCAL_DIR / RUSTDESK_API_RECORD_STORAGE_TEMP_DIR |
record-storage.s3.endpoint / bucket / prefix |
RUSTDESK_API_RECORD_STORAGE_S3_ENDPOINT / RUSTDESK_API_RECORD_STORAGE_S3_BUCKET / RUSTDESK_API_RECORD_STORAGE_S3_PREFIX |
record-storage.s3.access-key-id / secret-access-key |
RUSTDESK_API_RECORD_STORAGE_S3_ACCESS_KEY_ID / RUSTDESK_API_RECORD_STORAGE_S3_SECRET_ACCESS_KEY |
record-storage.webdav.url / username / password |
RUSTDESK_API_RECORD_STORAGE_WEBDAV_URL / RUSTDESK_API_RECORD_STORAGE_WEBDAV_USERNAME / RUSTDESK_API_RECORD_STORAGE_WEBDAV_PASSWORD |
logger.path / logger.level |
RUSTDESK_API_LOGGER_PATH / RUSTDESK_API_LOGGER_LEVEL |
Database default is SQLite at ./data/rustdeskapi.db, so RUSTDESK_API_DB_TYPE
is normally not needed. Logs go to logger.path
(default ./runtime/log.txt) at logger.level, or to stdout if the path is empty.
Container images default to TZ=Asia/Shanghai, and docker-compose.yaml lets you
override it with the standard TZ environment variable. Set it to your IANA time
zone, for example TZ=Europe/Berlin, if you do not want Asia/Shanghai local time.
Business timestamps remain stored in UTC; TZ is used for server-local logs/start
time and for the admin UI's local-time display.
Notification Routing supports ntfy, Bark, Server Chan and Webhook. A device can trigger several rules, each with its own template and test action. See the notification guide.
Administrators who have enrolled still verify TOTP at sign-in. Console permits
unenrolled administrators to sign in with a persistent security reminder when
account and global rules allow it. To recover a lost factor, run
rustdesk-console -c ./conf/config.yaml reset-totp <user-id> on the Console host
with access to its database, then enroll again. See the
security upgrade guide for deployment details.
Authentication and sensitive administration events always emit JSON on stdout
with target security_audit, independently of logger.level and RUST_LOG.
Forward them to a collector outside the container. Log the upstream X-Request-Id
and the request path without the query string at the reverse proxy.
The Compose example publishes Console on loopback. For a proxy on the same Docker network,
remove the published port and use the service address; set gin.trust-proxy to the actual
proxy addresses or CIDRs.
Geo settings and MMDB source URLs are stored in the Console database. Console uses
the parent directory of rustdesk.key-file as the shared HBBS/HBBR data directory.
HBBS discovers these optional files there by convention:
GeoLite2-Country.mmdbGeoLite2-City.mmdbGeoLite2-ASN.mmdb
If Console and HBBS run in separate containers, mount the same host directory into
both containers and make rustdesk.key-file point to the public key inside that
mount. The mount path may differ between containers, but the key and MMDB files must
refer to the same host directory. Missing or invalid MMDB files do not prevent HBBS
from starting and do not disable its normal relay pool. Console only creates a
short-lived .geo-config-*.json file while applying settings, and removes it after
HBBS responds.
Automatic updates are optional and disabled by default. When enabled in the Geo
routing page, Console checks every 15 minutes and downloads a database only after
its configured interval has elapsed; the same full MMDB integrity and type checks
run before every replacement.
The embedded WebClient supports three WebSocket modes:
- Leave
rustdesk.ws-host,rustdesk.ws-id-hostandrustdesk.ws-relay-hostempty to preserve the original behavior: derive21118fromrustdesk.id-serverand21119fromrustdesk.relay-server. - Set
rustdesk.ws-hostfor path-based HTTPS/WSS reverse proxy deployments. WebClient will use<ws-host>/ws/idand<ws-host>/ws/relay. - Set
rustdesk.ws-id-hostandrustdesk.ws-relay-hostwhen the ID and relay WebSocket services are exposed as separate endpoints or ports, for examplewss://rd.example.com:21118andwss://rd.example.com:21119. Explicit endpoints take precedence overrustdesk.ws-host.
To override the embedded WebClient, put a single web.zip at ./data/web.zip and
restart the service. The server extracts it into a temporary directory at startup,
serves it as /webclient2/. The built-in /webclient/ remains the embedded v1
client. If web.zip is missing or invalid, /webclient2/ is unavailable and the
admin UI falls back to v1 links. The zip can contain either index.html and its
assets at the root, or a web/ directory containing index.html and its assets.
If both exist, the root index.html takes precedence. Either layout is served at
/webclient2/ without an extra web/ URL prefix. The zip is not unpacked into the
persistent data directory.
Open System settings → LDAP to set the directory endpoint, bind credentials, TLS trust, search scope, and user mappings. Test connection validates the draft and binds to the server without saving settings or creating a user. The console stores overrides in the database. Fields without overrides continue to use the server configuration file and environment. Re-enter the bind password when changing the endpoint, bind DN, or TLS trust settings.
Use LDAP with StartTLS or LDAPS and certificate verification. For a private CA,
provide PEM certificates in the console or configure ldap.tls-ca-file in YAML.
Use entryUUID for OpenLDAP or objectGUID for Active Directory. Users provisioned
by LDAP start as standard users. Manage roles in the console. If an allowed group
is set, ldap.user.admin-group also allows members to sign in.
LDAP accounts created by older versions lack a directory identity. The upgrade retains these records as local accounts, including roles and TOTP settings. A local administrator can set a console password for such an account. To let its owner sign in through LDAP under the original username, first rename the legacy account and then review the new directory account’s permissions separately. Keep a local administrator account for recovery.
RustDesk clients discover third-party login entries from GET /api/login-options.
The server only exposes providers that are complete enough to start login:
- GitHub, Google and LinuxDO require both
client_idandclient_secret. - Generic OIDC requires
client_id,client_secretandissuer. - Web SSO is exposed as
webauthwhenapp.web-ssois enabled.
Open Personal Center → Sign-in methods to link a provider account after signing in. Linking preserves the local role and local verification requirements. You can unlink the provider there while keeping another usable sign-in method.
By default, only linked identities can sign in. If both provider auto-registration and site registration are enabled, an initialized Console can provision regular members. An email match never links an existing account.
For Google and generic OIDC, Console uses discovery and verifies the ID Token
signature, issuer, audience, subject and nonce. The default callback is
<rustdesk.api-server>/api/oidc/callback.
To configure a deployment-managed provider that requires explicit linking, set
RUSTDESK_API_OIDC_CLIENT_ID, RUSTDESK_API_OIDC_CLIENT_SECRET and
RUSTDESK_API_OIDC_ISSUER. Optional overrides are RUSTDESK_API_OIDC_NAME
(default OIDC), RUSTDESK_API_OIDC_REDIRECT_URL (the registered callback)
and RUSTDESK_API_OIDC_SCOPES (default openid,profile,email). Start a
Console binding from the same origin as its callback.
The admin OAuth page includes a provider test action. It checks saved settings,
discovery endpoints and the callback URL without starting a real user login.
The embedded and external WebClient can also start the same RustDesk OAuth flow
through the WebClient account_auth JavaScript bridge.
RustDesk recording upload keeps the client protocol unchanged: new, random-offset
part, tail, and remove requests still go to /api/record. The server records
the storage backend and object key on each record_files row, so downloads and
deletes use the backend/key saved for that recording. Changing storage settings only
affects new recordings.
Supported backends:
local: writes directly torecord-storage.local-dir, or<gin.resources-path>/recordwhen empty.s3: stages chunks inrecord-storage.temp-dirand uploads the completed file tos3.prefix + filenameontail.webdav: stages chunks inrecord-storage.temp-dirand uploads the completed file towebdav.prefix + filenameontail.
S3 and WebDAV credentials are server-side only. The admin UI never returns saved secret values; leaving a secret field empty keeps the existing value.
The Client settings page can generate RustDesk deployment commands, including optional client-side access settings. These preview-only options can add:
sudo rustdesk --password 'MyStrongPassword'
sudo rustdesk --option approve-mode 'password'
sudo rustdesk --option verification-method 'use-permanent-password'Supported approve-mode values are password, click, and password-click.
Supported verification-method values are use-temporary-password,
use-permanent-password, and use-both-passwords.
The password and access-mode choices are not written to conf/config.yaml, the
database, localStorage, encoded config, or installer filename. Run the generated
commands on the client machine with administrator/root privileges.
Deployment tokens are bearer tokens for RustDesk CLI deployment and assignment
calls to /api/devices/deploy and /api/devices/cli. Tokens are stored as
hashes, can be scoped to deploy, assign, strategy_assign, and
address_book_assign, and may carry default user, device group, and strategy
assignments.
The console stores deployment registration material on its own peers rows:
uuid, pk, and guid. It does not write to the hbbs database. This avoids
risky double-writes when hbbs owns its own device registry; if your deployment
uses a separate hbbs database, treat these APIs as console-side fleet metadata
and keep hbbs registration state owned by hbbs.
The server exposes machine-readable observability endpoints without admin login:
| Endpoint | Purpose |
|---|---|
GET /health |
Liveness/readiness JSON. Returns 200 when the API and database are available, or 503 when the database check fails. |
GET /metrics |
Prometheus text metrics with counts for users, peers, online peers, active connections, audit rows, login logs, uptime and database status. |
rustdesk_console_peers_online uses peers seen in the last 90 seconds, matching the
RustDesk heartbeat update cadence while avoiding short boundary flaps.
The admin console under web/ is a brand-new interface we wrote ourselves
(it does not use the original project's web app). Its production build is embedded into
the binary and served at /_admin/.
For UI development:
cd web
npx pnpm@10.34.0 install --frozen-lockfile
npx pnpm@10.34.0 run dev # dev server; proxies /api to http://127.0.0.1:21114rustdesk-console version --json
rustdesk-console config validate
rustdesk-console database status --json
rustdesk-console database migrate --json
rustdesk-console reset-admin-pwd --password-file /path/to/console-password
rustdesk-console reset-pwd 42 --password-stdin < /path/to/console-password
rustdesk-console -c ./conf/config.yamlSee the local maintenance CLI guide for schema states, exit codes, and account recovery.
Server: Rust · axum · SeaORM (SQLite/MySQL/PostgreSQL) · tokio · JWT · bcrypt · rust-embed. Web: React + Cloudflare kumo · Vite · TanStack Query.
This project is a Rust port of lejianwen/rustdesk-api
by 乐见文. The admin web UI is our own rewrite. Licensed under MIT.