After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775981 - gnome-keyring should wrap stock ssh-agent
gnome-keyring should wrap stock ssh-agent
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: ssh-agent
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on: 735873
Blocks: 525574 535373 617527 642008 672145 697464 702529 746816 750986 772366
 
 
Reported: 2016-12-12 12:51 UTC by Stef Walter
Modified: 2018-03-19 15:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ssh-agent: use stock ssh-agent (165.29 KB, patch)
2017-12-13 18:03 UTC, Daiki Ueno
none Details | Review
login: Add non-varargs version of gkd_login_*_password() functions (7.04 KB, patch)
2018-02-17 12:06 UTC, Daiki Ueno
committed Details | Review
login: Add GkdLoginInteraction API (16.83 KB, patch)
2018-02-17 12:06 UTC, Daiki Ueno
none Details | Review
egg: Import mock-interaction.[ch] from gcr (6.00 KB, patch)
2018-02-17 12:07 UTC, Daiki Ueno
committed Details | Review
configure: Require GLib 2.44 (771 bytes, patch)
2018-02-17 12:07 UTC, Daiki Ueno
committed Details | Review
configure: Require gcr 3.27.3 (598 bytes, patch)
2018-02-17 12:07 UTC, Daiki Ueno
none Details | Review
ssh-agent: Use stock ssh-agent (211.96 KB, patch)
2018-02-17 12:07 UTC, Daiki Ueno
none Details | Review
ssh-agent: Use stock ssh-agent (214.12 KB, patch)
2018-02-17 16:13 UTC, Daiki Ueno
none Details | Review
login: Add GkdLoginInteraction API (17.09 KB, patch)
2018-02-19 10:28 UTC, Daiki Ueno
committed Details | Review
ssh-agent: Use stock ssh-agent (217.82 KB, patch)
2018-02-19 10:29 UTC, Daiki Ueno
none Details | Review
ssh-agent: Add GkdSshAgentInteraction API (16.50 KB, patch)
2018-03-04 09:23 UTC, Daiki Ueno
committed Details | Review
ssh-agent: Use stock ssh-agent (221.59 KB, patch)
2018-03-04 09:24 UTC, Daiki Ueno
committed Details | Review

Description Stef Walter 2016-12-12 12:51:35 UTC
The gnome-keyring SSH functionality enables the following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

However we should not need to reimplement the ssh-agent to accomplish this. We can simply wrap the real ssh-agent.
Comment 1 Stef Walter 2016-12-12 12:53:36 UTC
Here are two work in progress branches which try to implement this. However I have not made much progress on them in over a year, and would encourage interested parties to complete the work:

https://git.gnome.org/browse/gcr/log/?h=ssh-askpass

https://git.gnome.org/browse/gnome-keyring/log/?h=ssh-wip

The two work together. In addition the GCR work is reusable by other parts of GCR that interact with SSH commands.
Comment 2 Daiki Ueno 2017-12-13 18:02:22 UTC
Although the fix for bug 641082 was a big step forward (thanks Jakub!), I worry that there would be a disappointment if we shipped it without support for Ed25519.  Currently it's waiting for the EdDSA mechanism being defined in the new PKCS #11 standard, but as far as I know there is no concrete schedule.

So I revisited this approach; the prior work by Stef basically works after a few adjustments on top of it:
https://git.gnome.org/browse/gcr/log/?h=wip/dueno/ssh-askpass
https://git.gnome.org/browse/gnome-keyring/log/?h=wip/dueno/ssh-agent

I am going to attach a squashed version.
Comment 3 Daiki Ueno 2017-12-13 18:03:05 UTC
Created attachment 365505 [details] [review]
ssh-agent: use stock ssh-agent

This patch removes our own implementation of ssh-agent and switches to
using the ssh-agent program provided by OpenSSH.  We can't simply drop
the ssh-agent functionality from gnome-keyring, as it enables the
following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

Instead we wrap the ssh-agent program as a subprocess and augment
the protocol as we need.

Signed-off-by: Stef Walter <stefw@gnome.org>
Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
Comment 4 Daiki Ueno 2018-02-17 12:06:43 UTC
Created attachment 368468 [details] [review]
login: Add non-varargs version of gkd_login_*_password() functions

Those functions could be used in GkdLoginInteraction where the fields
are stored in a table.
Comment 5 Daiki Ueno 2018-02-17 12:06:56 UTC
Created attachment 368469 [details] [review]
login: Add GkdLoginInteraction API

This decorates underlying GTlsInteraction with a capability of
retrieving/storing passwords in the login keyring.
Comment 6 Daiki Ueno 2018-02-17 12:07:05 UTC
Created attachment 368470 [details] [review]
egg: Import mock-interaction.[ch] from gcr
Comment 7 Daiki Ueno 2018-02-17 12:07:14 UTC
Created attachment 368471 [details] [review]
configure: Require GLib 2.44
Comment 8 Daiki Ueno 2018-02-17 12:07:24 UTC
Created attachment 368472 [details] [review]
configure: Require gcr 3.27.3
Comment 9 Daiki Ueno 2018-02-17 12:07:41 UTC
Created attachment 368473 [details] [review]
ssh-agent: Use stock ssh-agent

This patch removes our own implementation of ssh-agent and switches to
using the ssh-agent program provided by OpenSSH.  We can't simply drop
the ssh-agent functionality from gnome-keyring, as it enables the
following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

Instead we wrap the ssh-agent program as a subprocess and augment
the protocol as we need.

Signed-off-by: Stef Walter <stefw@gnome.org>
Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
Comment 10 Daiki Ueno 2018-02-17 12:29:24 UTC
Though the integration tests are still lacking (in particular, the login keyring integration is not tested at all), I have managed to increase the unit test coverage to ~90% for daemon/ssh-agent/*.

Here are the copr repositories for testing:
https://copr.fedorainfracloud.org/coprs/ueno/gcr-ssh-askpass/
https://copr.fedorainfracloud.org/coprs/ueno/gnome-keyring/
Comment 11 Daiki Ueno 2018-02-17 16:13:44 UTC
Created attachment 368476 [details] [review]
ssh-agent: Use stock ssh-agent

This patch removes our own implementation of ssh-agent and switches to
using the ssh-agent program provided by OpenSSH.  We can't simply drop
the ssh-agent functionality from gnome-keyring, as it enables the
following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

Instead we wrap the ssh-agent program as a subprocess and augment
the protocol as we need.

Signed-off-by: Stef Walter <stefw@gnome.org>
Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
--
And indeed there were issues in interacting with the login keyring.  This should fix those.  The Copr builds have been updated already.
Comment 12 Daiki Ueno 2018-02-19 10:28:30 UTC
Created attachment 368551 [details] [review]
login: Add GkdLoginInteraction API

This decorates underlying GTlsInteraction with a capability of
retrieving/storing passwords in the login keyring.

--
In comment 11, I mistakenly squash the fix to a different commit; it should be squashed to this one instead.
Comment 13 Daiki Ueno 2018-02-19 10:29:28 UTC
Created attachment 368552 [details] [review]
ssh-agent: Use stock ssh-agent

This patch removes our own implementation of ssh-agent and switches to
using the ssh-agent program provided by OpenSSH.  We can't simply drop
the ssh-agent functionality from gnome-keyring, as it enables the
following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

Instead we wrap the ssh-agent program as a subprocess and augment
the protocol as we need.

Signed-off-by: Stef Walter <stefw@gnome.org>
Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
--
Re-squashed and added more tests.
Comment 14 Daiki Ueno 2018-03-04 09:23:15 UTC
Created attachment 369257 [details] [review]
ssh-agent: Add GkdSshAgentInteraction API

This could be used by the new implementation of ssh-agent, through the
GcrSshAskpass and GkdLoginInteraction.
Comment 15 Daiki Ueno 2018-03-04 09:24:16 UTC
Created attachment 369258 [details] [review]
ssh-agent: Use stock ssh-agent

This patch removes our own implementation of ssh-agent and switches to
using the ssh-agent program provided by OpenSSH.  We can't simply drop
the ssh-agent functionality from gnome-keyring, as it enables the
following:

 * Automatic loading and unlocking of keys
 * Prompting in the UI

Instead we wrap the ssh-agent program as a subprocess and augment
the protocol as we need.

Co-authored-by: Daiki Ueno <dueno@src.gnome.org>
Comment 16 Daiki Ueno 2018-03-04 09:31:13 UTC
Attachment 368468 [details] pushed as 5f7ab25 - login: Add non-varargs version of gkd_login_*_password() functions
Attachment 368470 [details] pushed as 9ec7de5 - egg: Import mock-interaction.[ch] from gcr
Attachment 368471 [details] pushed as 162a180 - configure: Require GLib 2.44
Attachment 368551 [details] pushed as 6628894 - login: Add GkdLoginInteraction API
Attachment 369257 [details] pushed as 5cbfcd6 - ssh-agent: Add GkdSshAgentInteraction API
Attachment 369258 [details] pushed as 8db2b97 - ssh-agent: Use stock ssh-agent
Comment 17 Fredrik Mikker 2018-03-05 15:18:53 UTC
Is this fix targeted for any release?
Comment 18 Daiki Ueno 2018-03-05 15:32:00 UTC
I have released 3.27.92 with this change so it will be in 3.28 unless there is any critical problem.  Testing would be highly appreciated:
https://mail.gnome.org/archives/release-team/2018-February/msg00095.html
Comment 19 Daiki Ueno 2018-03-05 16:18:23 UTC
Comment on attachment 368472 [details] [review]
configure: Require gcr 3.27.3

Forgot to attach, but this is obsoleted by:
https://git.gnome.org/browse/gnome-keyring/commit/?id=43f9d81d9a0b3279bb3d7e0a8dc495169b69ddb0
Comment 20 Ondrej Holy 2018-03-15 14:18:15 UTC
The patches here probably cause Bug 794361.