Hacker News new | past | comments | ask | show | jobs | submit login

The ssh-agent protocol has always had the ability to sign data. It sounds like the new part is being able to verify signatures without needing the private key.

If you give ssh-agent some data and a public key then — if it has the corresponding private key — it will return a signature for your data using that private key.

The protocol command is SSH_AGENTC_SIGN_REQUEST and it’s the bread and butter of how the agent does its job.

Historically, it’s not tractable for public sign/verify but you can use it as a way to do symmetric encrypt/decrypt with ssh-agent.




It hasn't been able to do it in a meaningful way.

I've been patching support for this into ssh-agent for about a decade. I wrote a PKCS#11 module which talks to the SSH agent socket to forward your smartcard [0]. Doing so requires three changes to the protocol:

1. The ability to sign arbitrary data and get back the signed result [1]; normally you get back a hashed result [2].

2. The ability to decrypt data, this is what you said. This is less important since many things only require signatures (and not all algorithms support encryption/decryption).

3. The ability to request your certificates [3] [4] this one is kinda obvious.

The benefits of this are that you can use your smartcard on the remote host to do fully authenticated password-less sudo with pam_pkcs11. You can also do anything else that requires you to use your private key to be used, which can include fetching files (TLS client certificate authentication).

Within the US Government, passwords have been being phased out since 2004, but the requirements for authenticated privilege elevation remain.

Another way to accomplish this is to use SSH forwarding of your PC/SC socket but that's less portable and more fragile (and even less secure).

[0] https://github.com/rkeene/ssh-agent-pkcs11

[1] https://cackey.rkeene.org/fossil/artifact/0d0e90bbfdee672c?l...

[2] https://datatracker.ietf.org/doc/html/draft-miller-ssh-agent...

[3] https://cackey.rkeene.org/fossil/artifact/0d0e90bbfdee672c?l...

[4] https://datatracker.ietf.org/doc/html/rfc6187#section-2.1


Is there a benefit to using ssh-agent in this way instead of using gpg-agent as an ssh provider?


You get X.509 certificates from the smartcard which can be used much more widely than GPG


Have you published your ssh-agent patches?


Yes, though primarily forge.mil as a patched OpenSSH source. It was based on an original PKCS#11 support [0] [1]. An old version of the patch is pretty small and available here [2].

Additionally, I wrote an SSH Agent (in JavaScript, for ChromeOS, but works on any platform) that has these modifications [3]. I use this more frequently these days (via Tcl [4]).

[0] https://marc.info/?l=openssh-bugs&m=119214228626872

[1] https://rkeene.org/viewer/archive/openssh/openssh-4.4p1pkcs1...

[2] https://rkeene.org/viewer/archive/openssh/openssh-4.5p1-pkcs...

[3] https://cackey.rkeene.org/fossil/artifact/0d0e90bbfdee672c

[4] https://cackey.rkeene.org/fossil/artifact/183583332c474aa9


Thanks!


The use of ssh-agent may be forbidden at some places, even on personal machines. I knew a few. And not that it's completely unjustified..


How about gpg-agent? Is that forbidden?


Nobody used or asked about gpg-agent back then ) The point about ssh-agent was that it stored personal keys in memory of machines shared by multiple users (admins, shifters, devs). So everyone had to type in passwords for every "ssh" )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: