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
build / build-linux-amd64 (push) Successful in 1m45s
This commit is contained in:
@@ -25,6 +25,11 @@ RUSTDESK_BOOTSTRAP_ADMIN_PASSWORD=changeme
|
||||
# Force relay for all sessions even on LAN.
|
||||
#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
|
||||
|
||||
# --- Optional build source ---------------------------------------------------
|
||||
|
||||
@@ -55,6 +55,9 @@ services:
|
||||
- --bootstrap-admin-password=${RUSTDESK_BOOTSTRAP_ADMIN_PASSWORD:-changeme}
|
||||
# - --key=- # "-" auto-generates a key; "_" forces encrypted-only with no explicit key
|
||||
# - --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
|
||||
ports:
|
||||
- 21114:21114
|
||||
|
||||
@@ -298,6 +298,9 @@ order per peer:
|
||||
The peer's `Config::get_option` calls reflect the resolved values within
|
||||
~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
|
||||
|
||||
@@ -211,8 +211,9 @@ async fn render_table(state: &Arc<AppState>, lang: Lang) -> Result<String, ApiEr
|
||||
t(lang, "devices.no_devices"),
|
||||
);
|
||||
}
|
||||
let always_show_pwd = unattended_pwd_always_visible();
|
||||
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!(
|
||||
s,
|
||||
@@ -225,11 +226,24 @@ async fn render_table(state: &Arc<AppState>, lang: Lang) -> Result<String, ApiEr
|
||||
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(
|
||||
s: &mut String,
|
||||
lang: Lang,
|
||||
d: &DashboardDeviceRow,
|
||||
now: chrono::DateTime<chrono::Utc>,
|
||||
always_show_pwd: bool,
|
||||
) {
|
||||
let parsed: serde_json::Value =
|
||||
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
|
||||
// only when (a) the device is online (offline rows show stale data),
|
||||
// (b) no interactive user is logged in (otherwise the supporter
|
||||
// should be using the per-session approval popup, not the password),
|
||||
// and (c) the agent has actually reported one (vanilla rustdesk
|
||||
// should be using the per-session approval popup, not the password)
|
||||
// — 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.
|
||||
let unattended_pwd_cell = if is_online
|
||||
&& active_user.is_empty()
|
||||
&& (always_show_pwd || active_user.is_empty())
|
||||
&& !d.unattended_password.is_empty()
|
||||
{
|
||||
format!(
|
||||
|
||||
@@ -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'
|
||||
--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)'
|
||||
--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'
|
||||
-k, --key=[KEY] 'Only allow the client with the same key'",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user