zsh-quickstart-kit icon indicating copy to clipboard operation
zsh-quickstart-kit copied to clipboard

Add functionality to not use an x ssh-askpass gui when your ssh key has a passphrase

Open dglynn opened this issue 2 years ago • 4 comments

Following on from #141 I have found out why ssh-add prompts for a gui askpass app instead of the cli when you are in a running terminal already.

From a ssh-add manpage I found online, the following info;

If ssh-add does not have a terminal associated with it but
DISPLAY and SSH_ASKPASS are set, it will execute the
program specified by SSH_ASKPASS (by default “ssh-askpass”)
and open an X11 window to read the passphrase.

I have now tested this by setting this var right before the line where the load-our-ssh-keys() is called: export SSH_ASKPASS_REQUIRE=never

image

@unixorn you mentioned you are doing a refactor in #189 and we talked about how this could be enabled/disabled using the .zqs_get/set functions approach you would like to take.

I could have a go at this once you have merged the updates for that, and given some feedback on how it should be handled in the settings. Maybe using this function call.

I noticed there is no option to load the new EdDSA keys like ed25519, I could tag this onto this one or a separate branch if you like.

dglynn avatar May 20 '22 14:05 dglynn

@dglynn, #189 is merged now if you want to work on this.

unixorn avatar Jun 16 '22 15:06 unixorn

@dglynn, #189 is merged now if you want to work on this.

@unixorn, I finally have time to look at this, it's been a while can you link me to some examples of how you have done this in the #189 commit.

dglynn avatar Aug 03 '22 05:08 dglynn

The first argument to _zqs-get-setting is the settings name (only use filename-safe characters), and the second is the default value to return if there's no existing setting.

Here's an example

# We assume foo_enabled is true unless the user has explicitly disabled it with _zqs-set-setting
if [[ $(_zqs-get-setting foo_enabled true) == 'true' ]]; then
  # Do the enabled case
else
  # Do the disabled case
fi

I should really expose _zqs-set-setting and _zqs-get-setting as visible zqs commands users can use for arbitrary settings.

unixorn avatar Aug 03 '22 17:08 unixorn

Created https://github.com/unixorn/zsh-quickstart-kit/issues/207 to expose the commands

unixorn avatar Aug 03 '22 17:08 unixorn

@unixorn I have now got the branch ready locally for this change, I cannot push to your repo? Is it possible to do this to open the change request for review or should I fork first?

dglynn avatar Oct 16 '22 18:10 dglynn

Fork first, please, then do the PR from there.

unixorn avatar Oct 16 '22 20:10 unixorn