Bug 379852 - ksshaskpass does not store passwords in kwallet, neither use them if they already existed
Summary: ksshaskpass does not store passwords in kwallet, neither use them if they alr...
Status: RESOLVED INTENTIONAL
Alias: None
Product: ksshaskpass
Classification: Applications
Component: general (show other bugs)
Version: 5.9.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jeremy Whiting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-15 14:16 UTC by avlas
Modified: 2021-12-21 13:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description avlas 2017-05-15 14:16:41 UTC
ksshaskpass does not store passwords in kwallet, neither use them if they already existed.

I used to use this feature for my ssh connections, but it stopped working few months ago.

Today I decided to report the issue. Please let me know if I could be of any help to get this issue fixed.

Thanks.
Comment 1 Christoph Feck 2017-06-06 18:13:07 UTC
Could you please check which shell commands are executing ksshaskpass, and run them in Konsole to see the output why it fails? It has only been tested with ssh-add.
Comment 2 avlas 2017-06-08 23:43:13 UTC
Well, I just call it directly so I can use its output in a ssh connection that does not accept any other password input that is not introduced with the keyboard. So let's call the label of the ssh connection that I don't want to write the password everytime just "Label"

So sth like this:

sshpass -p $(ksshaskpass "Label") ssh remote_server

This is the output in konsole:

  ksshaskpass: Unable to extract keyFile from phrase "Label"
  Pass a valid window to KWallet::Wallet::openWallet().

Then a dialog is opened to write the password and I check to save it in kwallet, but nothing is really saved and next time I call it, same thing happens, that is, I always have to introduce the password manually.

This used to work before. I guess sth has been changed in ksshaskpass or kwallet in the course of the last months...
Comment 3 Christoph Feck 2017-06-13 23:02:28 UTC
> ksshaskpass: Unable to extract keyFile from phrase "Label"

Here is the catch. ksshaskpass needs to extract the keyFile (i.e. the name that is used for kwallet) from that Label. It currently checks for patterns such as:

"^Enter passphrase for (.*?)( \\(will confirm each use\\))?: $"
"^Bad passphrase, try again for (.*?)( \\(will confirm each use\\))?: $"
"^(Password|Username) for (.*?)[:] $"

The (.*?) capture is used to extract the keyFile. If your "Label" does not match any of those, then ksshaskpass cannot find the name used for the keyFile.

The first two patterns are used by ssh-add, the third is used by git (see bug 376228). We would like to support other patterns used by other commands, e.g. bug 380085 for mercurial version control system.

But if your "Label" is not generated by a public command, instead by your own private scripts, then I fear the only workaround is to change it to one of the detected patterns, or change the source of the ksshaskpass program.
Comment 4 avlas 2017-06-14 02:07:24 UTC
(In reply to Christoph Feck from comment #3)
> > ksshaskpass: Unable to extract keyFile from phrase "Label"
> 
> Here is the catch. ksshaskpass needs to extract the keyFile (i.e. the name
> that is used for kwallet) from that Label. It currently checks for patterns
> such as:
> 
> "^Enter passphrase for (.*?)( \\(will confirm each use\\))?: $"
> "^Bad passphrase, try again for (.*?)( \\(will confirm each use\\))?: $"
> "^(Password|Username) for (.*?)[:] $"
> 
> The (.*?) capture is used to extract the keyFile. If your "Label" does not
> match any of those, then ksshaskpass cannot find the name used for the
> keyFile.
> 
> The first two patterns are used by ssh-add, the third is used by git (see
> bug 376228). We would like to support other patterns used by other commands,
> e.g. bug 380085 for mercurial version control system.
> 
> But if your "Label" is not generated by a public command, instead by your
> own private scripts, then I fear the only workaround is to change it to one
> of the detected patterns, or change the source of the ksshaskpass program.

Excellent, it worked! I just modified my label so it follows one of the supported patterns.

Thanks!
Comment 5 Christoph Feck 2017-06-19 22:36:24 UTC
Setting status according to comment #3.