Implement RUSTDESK_UNATTENDED_PWD_VISIBILITY to enable visibility of unattended passwords within the Admin UI even when User is logged in.
build / build-linux-amd64 (push) Successful in 1m45s

This commit is contained in:
2026-05-18 18:25:29 +02:00
parent 5ec9776207
commit e22e4f6fb6
5 changed files with 31 additions and 4 deletions
+5
View File
@@ -25,6 +25,11 @@ RUSTDESK_BOOTSTRAP_ADMIN_PASSWORD=changeme
# Force relay for all sessions even on LAN. # Force relay for all sessions even on LAN.
#RUSTDESK_ALWAYS_USE_RELAY=Y #RUSTDESK_ALWAYS_USE_RELAY=Y
# When the admin UI shows a device's unattended (per-boot) password.
# logged-out only when nobody is logged in on the device (default)
# always also while an interactive user is logged in
#RUSTDESK_UNATTENDED_PWD_VISIBILITY=logged-out
#RUST_LOG=info #RUST_LOG=info
# --- Optional build source --------------------------------------------------- # --- Optional build source ---------------------------------------------------
+3
View File
@@ -55,6 +55,9 @@ services:
- --bootstrap-admin-password=${RUSTDESK_BOOTSTRAP_ADMIN_PASSWORD:-changeme} - --bootstrap-admin-password=${RUSTDESK_BOOTSTRAP_ADMIN_PASSWORD:-changeme}
# - --key=- # "-" auto-generates a key; "_" forces encrypted-only with no explicit key # - --key=- # "-" auto-generates a key; "_" forces encrypted-only with no explicit key
# - --http-port=21114 # admin HTTP API/UI port; 0 disables # - --http-port=21114 # admin HTTP API/UI port; 0 disables
# When the admin UI shows a device's unattended password.
# logged-out (default) = only when nobody is logged in; always = also while a user is logged in.
- --unattended-pwd-visibility=${RUSTDESK_UNATTENDED_PWD_VISIBILITY:-logged-out}
environment: *rustdesk-env environment: *rustdesk-env
ports: ports:
- 21114:21114 - 21114:21114
+3
View File
@@ -298,6 +298,9 @@ order per peer:
The peer's `Config::get_option` calls reflect the resolved values within The peer's `Config::get_option` calls reflect the resolved values within
~15 s of any change to `modified_at` on the strategy row. ~15 s of any change to `modified_at` on the strategy row.
See [STRATEGIES.md](STRATEGIES.md) for the full list of `config_options`
keys and what each one does.
--- ---
## Address books ## Address books
+19 -4
View File
@@ -211,8 +211,9 @@ async fn render_table(state: &Arc<AppState>, lang: Lang) -> Result<String, ApiEr
t(lang, "devices.no_devices"), t(lang, "devices.no_devices"),
); );
} }
let always_show_pwd = unattended_pwd_always_visible();
for d in &devices { for d in &devices {
render_device_row(&mut s, lang, d, now); render_device_row(&mut s, lang, d, now, always_show_pwd);
} }
let _ = write!( let _ = write!(
s, s,
@@ -225,11 +226,24 @@ async fn render_table(state: &Arc<AppState>, lang: Lang) -> Result<String, ApiEr
Ok(s) Ok(s)
} }
/// Resolves the `--unattended-pwd-visibility` setting (env key
/// `UNATTENDED-PWD-VISIBILITY`, also settable via `.env`). Returns `true`
/// when the admin UI should surface the unattended password even while an
/// interactive user is logged in. Default (`logged-out`, or any
/// unrecognised value) keeps the original behaviour: shown only when nobody
/// is logged in.
fn unattended_pwd_always_visible() -> bool {
crate::common::get_arg_or("unattended-pwd-visibility", "logged-out".to_owned())
.trim()
.eq_ignore_ascii_case("always")
}
fn render_device_row( fn render_device_row(
s: &mut String, s: &mut String,
lang: Lang, lang: Lang,
d: &DashboardDeviceRow, d: &DashboardDeviceRow,
now: chrono::DateTime<chrono::Utc>, now: chrono::DateTime<chrono::Utc>,
always_show_pwd: bool,
) { ) {
let parsed: serde_json::Value = let parsed: serde_json::Value =
serde_json::from_str(&d.sysinfo_payload).unwrap_or(serde_json::Value::Null); serde_json::from_str(&d.sysinfo_payload).unwrap_or(serde_json::Value::Null);
@@ -290,11 +304,12 @@ fn render_device_row(
// Per-boot unattended-access password reported by hello-agent. Visible // Per-boot unattended-access password reported by hello-agent. Visible
// only when (a) the device is online (offline rows show stale data), // only when (a) the device is online (offline rows show stale data),
// (b) no interactive user is logged in (otherwise the supporter // (b) no interactive user is logged in (otherwise the supporter
// should be using the per-session approval popup, not the password), // should be using the per-session approval popup, not the password)
// and (c) the agent has actually reported one (vanilla rustdesk // — unless `--unattended-pwd-visibility=always` overrides (b), and
// (c) the agent has actually reported one (vanilla rustdesk
// never will). Otherwise show a neutral dash so the column lines up. // never will). Otherwise show a neutral dash so the column lines up.
let unattended_pwd_cell = if is_online let unattended_pwd_cell = if is_online
&& active_user.is_empty() && (always_show_pwd || active_user.is_empty())
&& !d.unattended_password.is_empty() && !d.unattended_password.is_empty()
{ {
format!( format!(
+1
View File
@@ -40,6 +40,7 @@ fn main() -> ResultType<()> {
--public-base-url=[URL] 'Externally reachable HTTP base URL (e.g. https://rustdesk.example.com:21114) — required for OIDC redirect callbacks' --public-base-url=[URL] 'Externally reachable HTTP base URL (e.g. https://rustdesk.example.com:21114) — required for OIDC redirect callbacks'
--oidc-config=[PATH] 'TOML file describing OIDC providers (upserted into oidc_providers at startup)' --oidc-config=[PATH] 'TOML file describing OIDC providers (upserted into oidc_providers at startup)'
--admin-ui-dir=[PATH] 'Directory of static admin-dashboard files served at /admin/ (default: ./admin_ui; empty disables)' --admin-ui-dir=[PATH] 'Directory of static admin-dashboard files served at /admin/ (default: ./admin_ui; empty disables)'
--unattended-pwd-visibility=[always|logged-out] 'When the admin UI shows a device unattended password. logged-out (default) = only when nobody is logged in; always = also while a user is logged in'
, --mask=[MASK] 'Determine if the connection comes from LAN, e.g. 192.168.0.0/16' , --mask=[MASK] 'Determine if the connection comes from LAN, e.g. 192.168.0.0/16'
-k, --key=[KEY] 'Only allow the client with the same key'", -k, --key=[KEY] 'Only allow the client with the same key'",
); );