Live data from Hacker News

SSH Agent Explained

smallstep.com

41–50 of 50 posts

Re: SSH Agent Explained

#41
post #33

Earlier quoted context omitted.

It's not 'simple', but it's definitely doable with Yubikey: https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PK... I've used it on macOS to use a PIV cert on a yubikey to ssh to remote linux servers. I have NOT used it to ssh-agent chain through, jump-box style though.

If you're already bound to Yubikey, though, any advantage to PKCS#11 over OTP? Theoretically it's an open standard, but there seems to be only one real vendor.

There are MANY vendors that supply hardware security modules that make their information available via PKCS#11 modules. From smartcards to TPMs to dedicated large HSM devices.

There are many advantages of something like PKCS#11 over One-Time-Passwords (TOTP/HOTP):

1. Since you have an X.509v3 certificate, you have an identity not just an authenticator -- so when you are using this certificate to login to systems, you don't also have to supply an identification (though most systems let you optionally supply one, e.g., if you can login with multiple usernames and the same credential).

2. PKIX covers a lot more use cases than OTP, things like Kerberos (PKINIT), TLS (TLS Client Certificates), SSH (PKIXSSH et al), digital email signing (S/MIME), code signing, commit signing, and more

3. The device is basically a second computer, so it can run software policies on it to do various things like if you authenticate incorrectly a few times in a row it can zero itself out, with OTP systems that has to be coordinated by the various systems validating the OTP token.

Re: SSH Agent Explained

#42
post #6

Earlier quoted context omitted.

YES. It would be so easy for OpenSSH to fix agent forwarding. Just need to limit authority and/or ask for consent for a particular action.

You can configure ssh-agent to ask for confirmation if you set the `-c` flag in ssh-add or by setting `AddKeysToAgent` to `confirm` in your ssh config [1]. Once set, authentication will require confirmation via a GUI dialog provided by the ssh-askpass command. However, it does not mention the command or process requesting for authentication. It works great on Linux, but I couldn't get it to work on macOS with the sys…

Recent macOS versions don't have `ssh-askpass`, and it's weirdly hard to add one. Since agent confirmation depends on askpass, I don't think there's an easy way to get this work on macOS.

Aside from the missing context you mentioned, the other bigger problem with this approach is that agent confirmation is all-or-nothing: it turns on confirmation for local SSH connections in addition to forwarded connections. If you're using SSH a lot, having to confirm every connection is very annoying.

Re: SSH Agent Explained

#43
post #40

Earlier quoted context omitted.

>Platform Support >Windows In-Box PIV Driver (Read Only) and PIVkey Windows Minidriver (Read/Write): Windows Vista, 7, 8, Server 2003, Server 2008, Server 2012. >Mac OSX, Linux and Android (Read Only - Middleware Required) The only open source middleware I know of for OSX is OpenSC, and it doesn't list C910 as a supported card. https://github.com/OpenSC/OpenSC/wiki/Supported-hardware-(sm...

I forgot to mention that also, of course, CoolKey is open source and the CoolKey PKCS#11 module supports the CoolKey applet (obviously) and makes some attempts to support the US DOD CAC and the US Government PIV -- though I don't know how successful they are. Bugs and feature limitations in CoolKey led me to write CACKey.

Coolkey is trying to link OSX 10.5 libraries and cross-compile for PowerPC. Seems like abandonware. Are you using it successfully in 2020?

Re: SSH Agent Explained

#44
post #7

Something that's skimmed over in the article but not addressed is: if the key pair isn't used for encryption, then how are session keys protected? The answer is: using the server's public key which is transmitted to client when establishing the connection. But then it's trivial to perform a person-in-the-middle attack and both observe and manipulate the plain text data by sending the client the attacker's public key.…

You can use: "monster in the middle", mitm, if you want to keep it gender neutral.

Re: SSH Agent Explained

#45
post #40

Earlier quoted context omitted.

I forgot to mention that also, of course, CoolKey is open source and the CoolKey PKCS#11 module supports the CoolKey applet (obviously) and makes some attempts to support the US DOD CAC and the US Government PIV -- though I don't know how successful they are. Bugs and feature limitations in CoolKey led me to write CACKey.

Coolkey is trying to link OSX 10.5 libraries and cross-compile for PowerPC. Seems like abandonware. Are you using it successfully in 2020?

I mostly use CACKey, since I wrote it to replace CoolKey for my needs.

Re: SSH Agent Explained

#46

I skip ssh-agent and use gpg-agent instead, which does both ssh and gpg agenting. Combined with monkeysphere, I store ssh private keys in gpg rather than in the encrypted ssh format.

I haven't heard about monkeysphere in years. Is it still being maintained?

Re: SSH Agent Explained

#47

Earlier quoted context omitted.

If you're already bound to Yubikey, though, any advantage to PKCS#11 over OTP? Theoretically it's an open standard, but there seems to be only one real vendor.

PKCS#11 is extremely versatile, with some configuration you can use Yubikey PIV X.509 keys to authenticate SSH sessions by passing the necessary pkcs11 lib to ssh with the -I flag. PKCS#11 isolates the key signing from the PC by doing any private key computation operations on the secure element, this prevents leakage of the private key by traditional means. Browser TLS client authentication is also possible with some…

I use the gpg-agent option as well, but hate it (GPG makes me feel icky). That is not, as I understand it, using an X.509 key for authentication though. Which is what I'd like (ssh-agent forward an X.509 based auth mechanism - like remote PKCS#11 over that agent connection, so the key stays on my yubi, and I only need CA certs on the remote hosts.

Re: SSH Agent Explained

#48
post #41

Earlier quoted context omitted.

If you're already bound to Yubikey, though, any advantage to PKCS#11 over OTP? Theoretically it's an open standard, but there seems to be only one real vendor.

There are MANY vendors that supply hardware security modules that make their information available via PKCS#11 modules. From smartcards to TPMs to dedicated large HSM devices. There are many advantages of something like PKCS#11 over One-Time-Passwords (TOTP/HOTP): 1. Since you have an X.509v3 certificate, you have an identity not just an authenticator -- so when you are using this certificate to login to systems, you…

It's so awesome, and the documentation and tooling suck so hard. Such a frustrating ecosystem...

Re: SSH Agent Explained

#49
post #47

Earlier quoted context omitted.

PKCS#11 is extremely versatile, with some configuration you can use Yubikey PIV X.509 keys to authenticate SSH sessions by passing the necessary pkcs11 lib to ssh with the -I flag. PKCS#11 isolates the key signing from the PC by doing any private key computation operations on the secure element, this prevents leakage of the private key by traditional means. Browser TLS client authentication is also possible with some…

I use the gpg-agent option as well, but hate it (GPG makes me feel icky). That is not, as I understand it, using an X.509 key for authentication though. Which is what I'd like (ssh-agent forward an X.509 based auth mechanism - like remote PKCS#11 over that agent connection, so the key stays on my yubi, and I only need CA certs on the remote hosts.

This is exactly what I do -- I posted some links to both the SSH Agent (well, the ChromeOS version -- I've got C versions as well) and the PKCS#11 module which talks to the SSH Agent. So on a remote system I can do things like sign files using PKCS#11 and passwordless sudo using pam_pkcs11.

Re: SSH Agent Explained

#50
post #48
post #41

Earlier quoted context omitted.

There are MANY vendors that supply hardware security modules that make their information available via PKCS#11 modules. From smartcards to TPMs to dedicated large HSM devices. There are many advantages of something like PKCS#11 over One-Time-Passwords (TOTP/HOTP): 1. Since you have an X.509v3 certificate, you have an identity not just an authenticator -- so when you are using this certificate to login to systems, you…

It's so awesome, and the documentation and tooling suck so hard. Such a frustrating ecosystem...

The only real low point in the documentation I've found was around MIT Kerberos.

I implemented a PKCS#11 module from the documentation for NIST SP 800-73 and RSA PKCS#11 in about a week.

What things do you think could be better documented ?

Post reply on HN