<p dir="ltr">I don't think the kernel keyring would work for ssh-agent or gpg-agent. The point of using an agent is *not* just providing dumb secret storage, but moving the actual crypto functions to the agent, so that the UIs (ssh, scp, gpg as of v2.1) won't *ever* deal with unlocked keys.</p>

<p dir="ltr">(The agents usually set themselves as undumpable and untraceable to avoid key extraction by the same user's other processes.)</p>
<p dir="ltr">If you make `ssh-add` just insert the decrypted key into a kernel keyring and `ssh <a href="http://example.com">example.com</a>` just retrieve it, you lose one of the most important features.</p>
<p dir="ltr">Unless, of course, the kernel learns keyctl_ssh_{rsa,ecdsa,ed25519}_sign() or another similar interface that will always take 2-3 years to catch up every time the user space learns a new cipher or protocol...</p>

<p dir="ltr">(I am reminded of plan9's Factotum, which was kind of like ssh-agent but part of the OS...)</p>
<p dir="ltr">-- <br>
Mantas Mikulėnas <<a href="mailto:grawity@gmail.com">grawity@gmail.com</a>><br>
// sent from phone</p>
<div class="gmail_quote">On Jun 27, 2014 4:19 PM, "Lennart Poettering" <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 25.06.14 14:25, Anatol Pomozov (<a href="mailto:anatol.pomozov@gmail.com">anatol.pomozov@gmail.com</a>) wrote:<br>
<br>
Haya,<br>
<br>
> One of the weirdest decisions made by ssh/gpg developers is using<br>
> environment variables to pass information about agent processes. Why<br>
> don't they use some well-known location for the socket file like any<br>
> other application does? Currently I need to run the *-agent daemon<br>
> from user account, construct environment variables and propagate it to<br>
> other processes such as Gnome and terminals started by sshd.service.<br>
> It would be much nicer if *-agents created<br>
> /run/user/$uid/gpg-agent.socket that any program can use.<br>
<br>
Well, $XDG_RUNTIME_DIR is relatively young, and gpg/ssh are not. Also,<br>
the BSDs don't really have that. env vars are really awful for what they<br>
are doing, but then again, i'd fault UNIX for that, not<br>
them. $XDG_RUNTIME_DIR is simply our way to fix UNIX in this regard.<br>
<br>
> But I would love to see just one system daemon for all users without<br>
> the additional configuration steps. All I expect to start the service<br>
> is:<br>
><br>
> sudo systemctl enable systemd-keyringd.socket<br>
><br>
> After that 'ssh' 'gpg' should work without any configuration hustle.<br>
<br>
So, my strong suggestion would be that everything should just use the<br>
kernel keyring (as in keyctl(1)), and then gnome-keyring-daemon and<br>
suchlike are just frontends for that adding interactive password queries<br>
and things like that. And yeah, ssh/gpg should just use the keyring too,<br>
and nothing else. But of course this is not going to be easy, as the<br>
kernel keyring is a Linuxism, and ssh+gpg tend to be conservative with<br>
non-portable interfaces...<br>
<br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div>