23 Commits

Author SHA1 Message Date
UNITRONIX bb2ff08f65 Fix NTP server config not reaching betterdesk-server (Fixes #223).
Wire billing/NTP env from console .env into Go on Linux, Windows, and Docker; add OS NTP fallback and Commercialization settings UI to configure and restart the server.
2026-06-27 20:33:56 +02:00
UNITRONIX 47f4aa680c fix(docker): share console auth.db with Go for panel folder sync (#138)
Mount console-data read-only into the server container and set AUTH_DB_PATH
so RustDesk clients receive panel folders/groups in SQLite deployments.
Wait for auth.db on first boot and start console before Go in single-container
layouts to avoid empty /api/device-group/accessible responses.

Refs #138
2026-06-06 13:58:44 +02:00
UNITRONIX 43e0b6f40a Integrate P2P/relay controls for issue #157.
Expose global connection strategy in the web panel with systemd/Docker persistence, extend server health diagnostics, enforce org network policy in the signal handler, and document when relay fallback is expected vs misconfiguration.
2026-06-04 00:26:58 +02:00
UNITRONIX 1508c739b2 fix(api): Go :21114 default API and Node :21121 compat proxy (#160)
RustDesk clients could not log in after v3 when handlers moved to Go but
nothing listened on :21121 (API_ENABLED off) or Go bound the wrong port.
Go serves /api/login on 21114; the console proxies legacy :21121 URLs to
Go. Installers repair .env/systemd, Docker publishes both ports, and
firewall rules allow 21114 and 21121 on full installs.

Also includes betterdesk-support-agent (Fyne desktop helper) and
docs/important/ operator notes (API ports, update flow, agent roadmap).
2026-06-03 02:16:24 +02:00
UNITRONIX 923602d679 feat(enrollment): operator approval queue for stock RustDesk clients
Add a device verification/enrollment workflow so new registrations are
held for operator review instead of connecting silently.

Go server (signal + api):
- Signal-mode pending: in 'managed' mode, unknown stock RustDesk clients
  are queued (pending_device_<id>) instead of being silently rejected.
- Rich approve: handleApproveDevice accepts display_name, sync_mode and
  normalized tags; handleRejectDevice supports an optional ban.

Node.js console:
- registrations.ejs approve modal (name, sync mode, tags, folder) and
  reject modal with ban option; betterdeskApi + routes wire display_name,
  sync_mode, tags and folder assignment through to the Go server.
- EN/PL/ZH i18n for all new strings.

Installers (managed default for FRESH installs only; existing installs
stay on the Go default 'open' or their DB-persisted mode):
- betterdesk.sh / betterdesk.ps1 write ENROLLMENT_MODE=managed to the
  server env only when no existing database is detected (FRESH_INSTALL).
- Docker single + multi container entrypoints detect fresh volumes via a
  sentinel plus id_ed25519/db_v2.sqlite3 presence and default to managed;
  ENROLLMENT_MODE is now passed through supervisord and all compose files.

This commit was made possible thanks to Insolve.
2026-05-31 01:10:38 +02:00
UNITRONIX 0f161181f1 feat(installers): run services under unprivileged accounts by default
Privilege separation across all installers so the long-running services no longer run with full administrative rights:

betterdesk.sh: installer keeps root but systemd units now run as a dedicated unprivileged 'betterdesk' system account by default (auto-created via ensure_service_user). Added full systemd hardening for the Go server (NoNewPrivileges, ProtectSystem=strict, ProtectHome, PrivateTmp, ReadWritePaths) and light hardening for the Node.js console. chown migrates existing root-owned data to the service account on update. Opt-out via --run-as-root / BETTERDESK_RUN_AS_ROOT=1; custom account via BETTERDESK_SERVICE_USER. Minimal mode covered too.

betterdesk.ps1: NSSM services now run under their per-service low-privilege virtual accounts (NT SERVICE\<service>) instead of LocalSystem, with scoped icacls grants on the install/data dirs (Set-ServiceLeastPrivilege helper). Applied to the Go server, Node.js console and minimal-mode service. Opt-out via -RunAsRoot / BETTERDESK_RUN_AS_ROOT=1.

Docker: verified already privilege-separated (supervisord drops both programs to user=betterdesk; multi-container images drop via su-exec).

Also bundles in-progress changes to the Go server API, Node.js console services and Docker compose/Dockerfiles.

This commit was made possible thanks to Insolve.
2026-05-31 00:35:28 +02:00
UNITRONIX 97d228545f fix(docker): restore SETUID/SETGID/CHOWN/FOWNER caps for su-exec (#153)
cap_drop: ALL removed capabilities needed by su-exec to drop from root to betterdesk user. The entrypoint scripts chown volumes then su-exec to UID 10001, which calls setgroups() — requires SETGID. Added cap_add with the 4 minimal capabilities across all 3 compose files.

This commit was made possible thanks to Insolve.
2026-05-28 01:08:43 +02:00
Knienartowicz f8fbb88e47 security: apply 12 audit fixes (H-03/H-04/M-03/M-04/M-05/M-06/M-07/L-01/L-02/L-04/I-02/I-04)
Node.js (no recompile required):

- H-04: RUSTDESK_API_DISABLE_TOTP now requires explicit _ACKNOWLEDGED flag

- M-03: drop Referer-based skip from apiLimiter; add dedicated widgetLimiter

- M-06: gate /api/system/info, /logs/recent, /database/stats, /docker/containers, /speed-test behind requirePermission('metrics.view')

- L-01: startup banner now warns when TRUST_PROXY is off in production / errors when TOTP bypass is set without acknowledgement

Scripts / Docker:

- M-04: betterdesk.sh migration tool invocation switched from eval(cmd-string) to bash array exec

- M-05: all admin / PostgreSQL password generators switched from openssl rand -base64+tr+head to openssl rand -hex 16 (full entropy)

- L-02: docker-compose.yml / single.yml / quick.yml services gain security_opt: no-new-privileges and cap_drop: ALL

Documentation:

- I-04: add SECURITY.md (supported versions, reporting channels, SLA, scope, hardening defaults)

Go server (requires rebuild on host: cd betterdesk-server && go build ./...):

- H-03: /metrics now gated by METRICS_IP_ALLOWLIST / METRICS_PUBLIC; per-username login + 2FA rate-limit added on top of per-IP

- M-07: enrollment (/api/devices/register*) and branding (GET /api/branding) endpoints rate-limited per IP

- I-02: bd-mgmt WebSocket gets SetReadLimit(16 MiB) to bound memory

- L-04: auth middleware skips noisy public probes and redacts /peers/{id} segments

This commit was made possible thanks to Insolve.
2026-05-26 13:58:16 +02:00
UNITRONIX e19703dd25 fix: implement signal registration rate limiting per IP 2026-05-15 00:30:15 +02:00
UNITRONIX 3a73870706 Fix port 21121 connection refused in Docker (API_HOST binding)
Root cause: config.js defaults apiHost to 127.0.0.1 (localhost-only).
Inside Docker containers, this means port 21121 only listens on the
loopback interface, making it unreachable from outside the container
despite docker port mapping.

docker-compose.single.yml already had API_HOST=0.0.0.0, but
docker-compose.yml (multi-container) and docker-compose.quick.yml
(GHCR pre-built) were missing it.

Fixes:
- docker-compose.yml: Add HOST=0.0.0.0 and API_HOST=0.0.0.0
- docker-compose.quick.yml: Add HOST=0.0.0.0 and API_HOST=0.0.0.0
- Dockerfile.console: Add ENV API_HOST=0.0.0.0
- Dockerfile (single): Add ENV API_HOST=0.0.0.0
- docker/entrypoint.sh: Export API_HOST and HOST defaults
- docker/supervisord.conf: Add API_HOST and HOST to console env

Fixes #78
2026-04-06 17:03:11 +02:00
UNITRONIX 1e2047c033 BetterDesk 3.0.0 Alpha 2026-03-24 00:26:25 +01:00
UNITRONIX 2d6b730f99 Add Docker quickstart and GHCR publish workflow
Add Docker quickstart flow and CI to publish images to GitHub Container Registry. Creates a new GitHub Actions workflow (.github/workflows/docker-publish.yml) that builds multi-arch images (server, console, all-in-one) and pushes to ghcr.io. Adds docker-compose.quick.yml using pre-built GHCR images and a DOCKER_QUICKSTART.md with a 30s one‑line quick start, troubleshooting, and configuration notes. Update README Docker section to surface the quick start and adjust docker-compose.yml header to reference the quick file. Also update .github/copilot-instructions.md to document the Docker quick start and publishing phase.
2026-03-19 06:47:18 +01:00
UNITRONIX fc943e808d Streamline Docker builds, add .dockerignore
Add .dockerignore to trim Docker build context and exclude local artifacts (node_modules, dev files, secrets, runtime DBs, etc.). Simplify Dockerfiles: remove unnecessary sqlite-dev and rely on better-sqlite3's bundled SQLite; use npm install --production in build stages; copy application files first then overlay compiled node_modules from the builder to avoid local node_modules clobbering Alpine-compiled native modules. Update Docker console image similarly. Change supervisord to log to /dev/stdout and /dev/stderr so logs appear in docker logs. Remove explicit compose 'version' keys. Also set SQLite busy_timeout for main and auth DBs to reduce locking errors during concurrent access.
2026-03-14 23:05:02 +01:00
UNITRONIX 82475de81d Disable CGO, use DB_URL env for DB config
Switch Go builds to CGO_ENABLED=0 and remove system SQLite build deps and static extldflags (modernc.org/sqlite is pure-Go). Remove hardcoded -db flags from server CMD/supervisord and introduce a DB_URL environment variable propagated from entrypoint.sh. entrypoint.sh now sets DB_URL based on DB_TYPE/DATABASE_URL (Postgres or SQLite) and prints the chosen DB, and supervisord is updated to inject DB_URL into the server process. docker-compose files and docs updated to default to SQLite, expose DB_TYPE/DB_URL configuration, and document using a .env or postgres profile for PostgreSQL setups.
2026-03-14 18:45:31 +01:00
UNITRONIX 6f5c6b09bb Switch to Apache-2.0, update docs & Dockerfiles
Replace AGPL-3.0 with Apache License 2.0 across the repository and update related documentation and metadata. Remove legacy RustDesk-specific architecture docs, delete deprecated Dockerfile.hbbr, rename Dockerfile.hbbs → Dockerfile.server and update docker-compose / install scripts to use it. Add Apache license headers to protobuf defs, remove obsolete web service (hbbsApi.js), and adjust README, CONTRIBUTING and PROJECT_STRUCTURE to reflect the license and commercial/clean-room notices. Includes a small formatting tweak in client_api_handlers.go.
2026-03-06 23:45:46 +01:00
UNITRONIX aa9424845a Support Postgres, API key sync, and auth migration
Add PostgreSQL support for the web console password reset and install scripts, and improve cross-language auth handling.

Key changes:
- Introduce a unified reset-password.js that supports SQLite and PostgreSQL (reads DB_TYPE / DATABASE_URL) and make shell/PowerShell/Docker helpers prefer it with fallbacks.
- Update betterdesk-server to load an API key from API_KEY or .api_key (key/db dirs) and sync it into the database so Go server and Node console share the same key.
- Adjust docker-compose default command to run the all-in-one mode and point at the bundled DB/key paths.
- Improve dashboard health checks to avoid raw TCP probes in single-binary BetterDesk mode and derive signal/relay status from the API health; allow /api/currentUser to accept POST as well as GET.
- Enhance authService to recognize Go-style PBKDF2 hashes, verify them, auto-migrate verified PBKDF2 hashes to bcrypt, and migrate default admin if needed.

These changes improve interoperability between the Go server and Node console (shared API key and DB modes), add Postgres support for admin tooling, and provide a smooth auth migration path from the Go server's hashing scheme to bcrypt.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
2026-03-05 00:21:56 +01:00
UNITRONIX e855f5786d Add Go server and security audit; update web console
Add a new betterdesk-server Go codebase (server, api, auth, db, relay, signal, metrics, audit, ratelimit, proto, tools, tests) and related deployment/migration scripts. Add a comprehensive SECURITY_AUDIT_2026-03-01 report and .gitattributes; update copilot-instructions (ALL-IN-ONE v2.4.0), README, VERSION, Dockerfiles, scripts, docker-compose and entrypoint. Large updates to web-nodejs (translations, routes, services, frontend assets and middleware) and numerous new utilities; remove legacy Flask web files and archive hbbs-patch-v2 artifacts. Prepares repository for PostgreSQL support, DB migration tooling and the new Go server as the production backend.
2026-03-02 00:43:04 +01:00
UNITRONIX 18dac36661 Use local BetterDesk binaries; fix Docker build
Update Dockerfiles and compose to use local BetterDesk (hbbs-patch-v2) binaries, avoid pulling unpublished images, and improve build reliability. Dockerfile.hbbr/hbbs now copy patched binaries, set executable symlinks and run the BetterDesk binaries by default. Dockerfile.console adds DNS fallback entries to mitigate resolver failures during build. docker-compose.yml sets image names and pull_policy: never and runs the enhanced binaries directly. Documentation updated (DOCKER_TROUBLESHOOTING.md, README, .github/copilot-instructions.md) with troubleshooting steps for "no such table: peer", pull access denied, and DNS build issues.
2026-02-06 20:28:28 +01:00
UNITRONIX cf219a3e5a Add diagnostics, Docker build notes & hbbs v2
Add an offline-diagnosis script and Copilot guidelines, update Docker flow to require local image builds, and promote hbbs-patch-v2 binaries with checksums.

Highlights:
- New dev_modules/diagnose_offline_status.sh to detect and fix "all devices offline" issues.
- Added .github/copilot-instructions.md with project state and build guidelines for Copilot.
- Emphasized local Docker builds in DOCKER_SUPPORT.md, DOCKER_TROUBLESHOOTING.md, docker-compose.yml and docker-quickstart.sh (replace pull with build/rebuild).
- Updated docs/TROUBLESHOOTING_EN.md and README to document offline-status causes/fixes and Windows/Linux v2 binaries (API port 21114).
- Added hbbs-patch-v2 Windows binaries, updated CHECKSUMS.md, and removed legacy hbbs-patch v1 files.
- Bumped VERSION to 1.5.5 and adjusted installer scripts (install-improved.sh/ps1) accordingly.

These changes improve diagnostics, clarify deployment (Docker/local builds), and roll out the v2 BetterDesk server binaries with verification info.
2026-02-04 21:34:17 +01:00
UNITRONIX 7657983b91 Add custom Dockerfiles for HBBS/HBBR with shell support
Introduced Dockerfile.hbbs and Dockerfile.hbbr to build BetterDesk HBBS and HBBR images based on busybox for shell and tool support, improving troubleshooting and healthchecks. Updated docker-compose.yml to use these custom images. Expanded DOCKER_TROUBLESHOOTING.md with guidance on shell availability and migration steps.
2026-02-01 18:47:46 +01:00
UNITRONIX 118d7aabc3 Remove Watchtower and update security guidance
Watchtower has been removed from docker-compose.yml due to maintenance and security concerns. Updated README and troubleshooting documentation to provide safe manual update instructions and recommend modern alternatives such as Dependabot and Renovate for automated updates.
2026-01-21 18:36:38 +01:00
UNITRONIX 4f718c1d1a Add Docker admin migration automation and troubleshooting
Introduces automatic database migration and admin account creation for Docker deployments via a new entrypoint script and updated Dockerfile. Adds troubleshooting documentation (DOCKER_TROUBLESHOOTING.md), quick-fix scripts (fix-admin.sh, fix-admin.bat), and updates README and docker-compose.yml with clear admin credential recovery instructions. Also includes minor improvements: health check endpoint, language tag fixes in HTML templates, and documentation updates.
2026-01-21 18:26:07 +01:00
UNITRONIX 55072b3834 Add Docker support and BetterDesk v2 patch files
Introduces full Docker support with docker-compose, quickstart, and installation scripts. Adds BetterDesk v2 patch source, build, and documentation files. Updates .gitignore for sensitive data, enhances Docker and update documentation, and improves troubleshooting and migration instructions in README. Also updates install scripts and adds new database migration scripts for v1.5.0.
2026-01-20 19:07:10 +01:00