Bug 1542 - Send echo on/off flag to SSH_ASKPASS
Summary: Send echo on/off flag to SSH_ASKPASS
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: -current
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 19:33 AEDT by Tomas Mraz
Modified: 2021-03-04 09:54 AEDT (History)
1 user (show)

See Also:


Attachments
/home/djm/askpass-env-echo.diff (1.17 KB, patch)
2010-06-18 15:06 AEST, Damien Miller
wittayahom5: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Mraz 2008-12-02 19:33:46 AEDT
When the SSH_ASKPASS helper is used for getting answer for a question it might be a question which is not a passphrase but for example a yes/no question when a new host key is received.

Unfortunately the helper is not getting any hints about what it should present to the user, whether it should echo the answer the user types or not. Even better in case of questions with limited number of answers it could get a list of the possible answers so the askpass dialog could use a radio buttons instead of text entry box. But for start it would be good enough if the askpass at least know about the echo on/off flag.
Comment 1 Damien Miller 2010-06-18 15:06:56 AEST
Created attachment 1874 [details]
/home/djm/askpass-env-echo.diff

Set SSH_ASKPASS_ECHO=1 environment for askpass child when echo is to be enabled.
Comment 2 Damien Miller 2010-08-03 15:40:54 AEST
We are freezing for the OpenSSH 5.6 release. Retargetting these bugs to the next release.
Comment 3 Damien Miller 2010-08-03 15:42:32 AEST
Targetting OpenSSH 5.7
Comment 4 Damien Miller 2011-01-24 12:30:48 AEDT
Retarget unclosed bugs from 5.7=>5.8
Comment 5 Damien Miller 2011-09-06 10:34:15 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 6 Damien Miller 2011-09-06 10:36:28 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 7 Damien Miller 2011-09-06 10:39:03 AEST
Retarget unresolved bugs/features to 6.0 release

(try again - bugzilla's "change several" isn't)
Comment 8 Damien Miller 2012-02-24 10:34:24 AEDT
Retarget from 6.0 to 6.1
Comment 9 Damien Miller 2012-02-24 10:38:03 AEDT
Retarget 6.0 => 6.1
Comment 10 Damien Miller 2012-09-07 11:38:01 AEST
Retarget uncompleted bugs from 6.1 => 6.2
Comment 11 Damien Miller 2012-09-07 11:40:31 AEST
Retarget bugs from 6.1 => 6.2
Comment 12 Damien Miller 2013-03-08 10:23:40 AEDT
retarget to openssh-6.3
Comment 13 Damien Miller 2013-07-25 12:17:41 AEST
Retarget to openssh-6.4
Comment 14 Damien Miller 2013-07-25 12:20:36 AEST
Retarget 6.3 -> 6.4
Comment 15 Damien Miller 2014-02-06 10:17:54 AEDT
Retarget incomplete bugs / feature requests to 6.6 release
Comment 16 Damien Miller 2014-02-06 10:19:51 AEDT
Retarget incomplete bugs / feature requests to 6.6 release
Comment 17 Damien Miller 2014-04-12 14:49:54 AEST
Retarget to 6.7 release, since 6.6 was mostly bugfixing.
Comment 18 Damien Miller 2014-04-12 14:54:38 AEST
Remove from 6.6 tracking bug
Comment 19 Damien Miller 2014-08-30 04:38:06 AEST
Retarget incomplete bugs to 6.8 release.
Comment 20 Damien Miller 2014-08-30 04:40:06 AEST
These bugs are no longer targeted at the imminent 6.7 release
Comment 21 Damien Miller 2015-03-03 07:59:15 AEDT
OpenSSH 6.8 is approaching release and closed for major work. Retarget these bugs for the next release.
Comment 22 Damien Miller 2015-03-03 08:01:32 AEDT
Retarget to 6.9
Comment 23 Damien Miller 2015-08-11 22:59:25 AEST
Retarget pending bugs to openssh-7.1
Comment 24 beer 2019-06-09 07:58:54 AEST
Comment on attachment 1874 [details]
/home/djm/askpass-env-echo.diff

>Index: readpass.c
>===================================================================
>RCS file: /cvs/src/usr.bin/ssh/readpass.c,v
>retrieving revision 1.47
>diff -u -p -r1.47 readpass.c
>--- readpass.c	3 Aug 2006 03:34:42 -0000	1.47
>+++ readpass.c	18 Jun 2010 05:06:21 -0000
>@@ -44,7 +44,7 @@
> #include "uidswap.h"
> 
> static char *
>-ssh_askpass(char *askpass, const char *msg)
>+ssh_askpass(char *askpass, const char *msg, int echo_on)
> {
> 	pid_t pid;
> 	size_t len;
>@@ -69,6 +69,10 @@ ssh_askpass(char *askpass, const char *m
> 		close(p[0]);
> 		if (dup2(p[1], STDOUT_FILENO) < 0)
> 			fatal("ssh_askpass: dup2: %s", strerror(errno));
>+		if (echo_on)
>+			setenv("SSH_ASKPASS_ECHO", "1", 1);
>+		else
>+			unsetenv("SSH_ASKPASS_ECHO");
> 		execlp(askpass, askpass, msg, (char *) 0);
> 		fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno));
> 	}
>@@ -141,7 +145,8 @@ read_passphrase(const char *prompt, int 
> 			askpass = getenv(SSH_ASKPASS_ENV);
> 		else
> 			askpass = _PATH_SSH_ASKPASS_DEFAULT;
>-		if ((ret = ssh_askpass(askpass, prompt)) == NULL)
>+		if ((ret = ssh_askpass(askpass, prompt,
>+		    flags & RP_ECHO)) == NULL)
> 			if (!(flags & RP_ALLOW_EOF))
> 				return xstrdup("");
> 		return ret;
Comment 25 Damien Miller 2020-08-07 14:53:40 AEST
OpenSSH 8.2 sets a $SSH_ASKPASS_PROMPT environment variable that passes context through to the askpass program. The contrib/gnome-ssh-askpass[23] helper has been updated to use it too.
Comment 26 Damien Miller 2021-03-04 09:54:03 AEDT
close bugs that were resolved in OpenSSH 8.5 release cycle