virt-manager: Set SSH_ASKPASS_REQUIRE=force

openssh 8.4p1 released in Sep 2020 finally added a feature
to force using SSH_ASKPASS instead of prompting on the commandline
for password, if a password would be required.

https://man.openbsd.org/ssh.1#SSH_ASKPASS_REQUIRE

Getting this behavior is basically what our whole fork dance is
about. Now we can do it with an environment variable

Let the user override it from the environment though, so there's
an escape hatch incase this causes unforseen problems

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-09-24 09:41:07 -04:00 committed by Pavel Hrdina
parent 6c9842a158
commit 17e39de021

View File

@ -185,6 +185,12 @@ def main():
# With F27 gnome+wayland we need to set these before GTK import
os.environ["GSETTINGS_SCHEMA_DIR"] = BuildConfig.gsettings_dir
# Force SSH to use askpass if a password is required,
# rather than possibly prompting on a terminal the user isn't looking at.
os.environ.setdefault("SSH_ASKPASS_REQUIRE", "force")
log.debug("Using SSH_ASKPASS_REQUIRE=%s",
os.environ["SSH_ASKPASS_REQUIRE"])
# Now we've got basic environment up & running we can fork
do_drop_stdio = False
if not options.no_fork and not options.debug: