-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve support for SSH_ASKPASS #31
base: master
Are you sure you want to change the base?
Conversation
I would also suggest a refactoring of the static methods residing in AgentManager. There are some functions which should be moved out of the class and some functions which should be turned to class methods. |
Background: Previously, ssh-agent was run in an empty environment. This caused the agent to fail when a key was added with ssh-add -c and SSH_ASKPASS is set. When ssh-add was called with SSH_ASKPASS, the passphrase was still read from the terminal and the askpass program was not called. In this commit - ssh-ident detects if SSH_ASKPASS is set and invokes ssh-add with </dev/null to force askpass to be used instead of terminal input. - ssh-agent gets started with specific environment variables to be able to call SSH_ASKPASS.
After some tweaking, everything should be working now and ssh-ident should automatically detect if |
Patrick, thanks for the good work. A couple questions though, by skimming through the patches:
https://github.com/s1kx/ssh-ident/blob/3a3a73d1aefa6d782cd3c9b01ccef886fb708834/ssh-ident#L946
|
Hey Carlo, Sorry I just pushed a big rebase that fixes all of the issues mentioned by
I believe that ssh-ident will currently start ssh/ssh-add with /dev/tty as You may also note that I have implemented debug output through use of I have changed the agent file back to being written via pipe in the shell
This is not directly transparent behavior, since the user may not want to Note that right now, SSH_ASKPASS is only forced for ssh-add, not for ssh. I'm not sure how we could force ssh to also use SSH_ASKPASS, since at least Note that the change to ssh-agent is unrelated and required for SSH_ASKPASS |
To clarify, currently the way that ssh-ident with the PR patches behaves is
that if SSH_ASKPASS is set, it is used for all password entries and
confirmations of the ssh-agent.
This behavior is similar to that of other ssh agents such as gpg-agent.
As far as I know, using SSH_ASKPASS should offer the most universal way of
providing passphrases in all use cases such as calling ssh-ident from a
terminal, from a script or from git.
|
Confirmed that it is working with scripts and git. Have you considered writing log output to stderr instead of stdout? This is common practice with ssh etc. and would allow pipe redirection. |
Hi s1kx, had you tested the changes from kevinr. Regards |
As mentioned in issue #18, if a user sets
SSH_ASKPASS
, it is silently ignored and the user is prompted for the passphrase in the terminal.In order to fix this issue, I have implemented changd that ssh-add will be invoked with a
< /dev/null
redirect in order to force launching theSSH_ASKPASS
prompt.Additionally, ssh-agent needed to be spawned with certain environment variables to be compatible with
ssh-add -c
andSSH_ASKPASS
.