From 4035c25b3d3f9c787641dd04f1d1de9453728bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 7 Jul 2025 16:51:22 +0200 Subject: [PATCH] don't enable ssh askpass for now if we have a build_host set --- pkgs/clan-cli/clan_lib/machines/update.py | 6 +++++- pkgs/clan-cli/clan_lib/ssh/remote.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/machines/update.py b/pkgs/clan-cli/clan_lib/machines/update.py index 62cd98c75..c112e9739 100644 --- a/pkgs/clan-cli/clan_lib/machines/update.py +++ b/pkgs/clan-cli/clan_lib/machines/update.py @@ -167,7 +167,11 @@ def run_machine_deploy( if become_root: host = sudo_host - remote_env = host.nix_ssh_env(control_master=False) + # Disable SSH_ASKPASS when using a build host (headless machines) + use_ssh_askpass = build_host is None + remote_env = host.nix_ssh_env( + control_master=False, use_ssh_askpass=use_ssh_askpass + ) ret = host.run( switch_cmd, RunOpts( diff --git a/pkgs/clan-cli/clan_lib/ssh/remote.py b/pkgs/clan-cli/clan_lib/ssh/remote.py index f0e6dbae0..e222a9cc9 100644 --- a/pkgs/clan-cli/clan_lib/ssh/remote.py +++ b/pkgs/clan-cli/clan_lib/ssh/remote.py @@ -296,13 +296,14 @@ class Remote: self, env: dict[str, str] | None = None, control_master: bool = True, + use_ssh_askpass: bool = True, ) -> dict[str, str]: """Return environment variables for nix commands that use SSH.""" if env is None: env = {} env["NIX_SSHOPTS"] = " ".join(self.ssh_cmd_opts(control_master=control_master)) # Set SSH_ASKPASS environment variable if not using password directly - if not self.password: + if not self.password and use_ssh_askpass: env["SSH_ASKPASS"] = SSH_ASKPASS_PATH env["SSH_ASKPASS_REQUIRE"] = "force" return env