Bug#1068353: openssh-client: ssh-agent and ControlMaster=ask options don't work on pure Wayland

Daniel Kahn Gillmor <[email protected]>
Newsgroups gmane.linux.debian.devel.ssh
Message-ID <877cheggu1.fsf__45600.6916983583$1712187580$gmane$org@fifthhorseman.net>
Package: openssh-client
Version: 1:9.7p1-4
Severity: normal
X-Debbugs-Cc: Daniel Kahn Gillmor <[email protected]>
Forwarded: https://github.com/openssh/openssh-portable/pull/479
Tags: patch

On a pure wayland system, without X11, openssh-askpass-gnome works just
fine.

But ssh-agent won't use it when passed the -c option, and ssh won't use
it to prompt for permission to use a ControlMaster=autoask because the
$DISPLAY environment variable isn't set.

Attached is a patch accepted by upstream to allow the presence of
$WAYLAND_DISPLAY to have the same enabling capability as $DISPLAY.

It would be great to have this applied in debian too, so i don't have to
keep patching it myself, or spuriously setting $DISPLAY even though
there is no X11 server.

                 --dkg

-- System Information:
Debian Release: trixie/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (200, 'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.6.15-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages openssh-client depends on:
ii  adduser           3.137
ii  libc6             2.37-15
ii  libedit2          3.1-20230828-1
ii  libfido2-1        1.14.0-1
ii  libgssapi-krb5-2  1.20.1-5+b1
ii  libselinux1       3.5-2
ii  libssl3t64        3.1.5-1.1
ii  passwd            1:4.13+dfsg1-4
ii  zlib1g            1:1.3.dfsg-3+b1

Versions of packages openssh-client recommends:
ii  xauth  1:1.1.2-1

Versions of packages openssh-client suggests:
pn  keychain                         <none>
pn  libpam-ssh                       <none>
ii  monkeysphere                     0.44-1
ii  ssh-askpass-gnome [ssh-askpass]  1:9.7p1-4

-- no debconf information
0001-upstream-allow-WAYLAND_DISPLAY-to-enable-SSH_ASKPASS.patch (text/x-diff, 1.5 KB)
From 697359be9c23ee43618243cdbcc9c7981e766752 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Sat, 30 Mar 2024 04:27:44 +0000
Subject: [PATCH] upstream: allow WAYLAND_DISPLAY to enable SSH_ASKPASS

From dkg via GHPR479; ok dtucker@

OpenBSD-Commit-ID: 1ac1f9c45da44eabbae89375393c662349239257
---
 readpass.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/readpass.c b/readpass.c
index b52f3d6b1..d42b1185d 100644
--- a/readpass.c
+++ b/readpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readpass.c,v 1.70 2022/05/27 04:27:49 dtucker Exp $ */
+/* $OpenBSD: readpass.c,v 1.71 2024/03/30 04:27:44 djm Exp $ */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  *
@@ -127,8 +127,9 @@ read_passphrase(const char *prompt, int flags)
 	const char *askpass_hint = NULL;
 	const char *s;
 
-	if ((s = getenv("DISPLAY")) != NULL)
-		allow_askpass = *s != '\0';
+	if (((s = getenv("DISPLAY")) != NULL && *s != '\0') ||
+	    ((s = getenv("WAYLAND_DISPLAY")) != NULL && *s != '\0'))
+		allow_askpass = 1;
 	if ((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) != NULL) {
 		if (strcasecmp(s, "force") == 0) {
 			use_askpass = 1;
@@ -261,7 +262,7 @@ notify_start(int force_askpass, const char *fmt, ...)
 		debug3_f("cannot notify: no askpass");
 		goto out;
 	}
-	if (getenv("DISPLAY") == NULL &&
+	if (getenv("DISPLAY") == NULL && getenv("WAYLAND_DISPLAY") == NULL &&
 	    ((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) == NULL ||
 	    strcmp(s, "force") != 0)) {
 		debug3_f("cannot notify: no display");
-- 
2.43.0
signature.asc (application/pgp-signature, 324 B)
-----BEGIN PGP SIGNATURE-----

wr0EARYKAG8FgmYN58cJEHctFh41zUuBRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
LnNlcXVvaWEtcGdwLm9yZylE9uBEwoX/zSfvRy2r4F3npVXlRDMmJ2ZSHGJkHTEI
FiEEdLwExD2GCEvoZywGdy0WHjXNS4EAALtcAQCvbS/UqIkHgasyvUtwr4fP/3fM
6Nb2kyANUdfmxiHTjAEAsKb2rCIoR1rFdjQFN9eg0gor5U6ORP+GjGkd+3qGiAc=
=K2RW
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.