|
|
Log in / Subscribe / Register

Using certificates for SSH authentication

Using certificates for SSH authentication

Posted Nov 9, 2022 12:46 UTC (Wed) by cortana (subscriber, #24596)
Parent article: Using certificates for SSH authentication

It'd be interesting to compare a setup using SSH certificates with that other network authentication protocol: Kerberos.

With Kerberos (as configured by FreeIPA, with which I'm most familiar) we have:

* Initial authentication on a user workstation with password, password + OTP or smart card
* Initial authentication can also be linked to an external OpenID Connect identity provider (although you can't yet use this from the GDM login screen, it's more usable when with kinit or SSH with keyboard-interactive authentication, in which case the user can click the URL in their terminal, log in to the IdP in their browser, and then hit enter to receive their TGT & finish logging in
* With a short TGT expiry time & longer renewable lifetime, sssd (running on user workstation) can automatically renew TGTs when they expire - this gives you the ability to lock users out in the middle of the day (say, if the new CEO capriciously decides to fire half the workforce...)
* Kerberos works with lots of other stuff than just SSH so you get SSO for all sorts of protocols (HTTP, NFS, SMB, LDAP, IMAP, SMTP, at home I even use Kerberos to authenticate virsh on my workstation to libvirtd running on servers)
* The amazing pam_sss_gss module can be used in service's auth stacks; for instance, to implement passwordless sudo
* Pretty good integration with Windows which is important for acceptance in enterprises where IdM is likely to be built around Active Directory

Disadvantages:

* Kerberos itself doesn't provide perfect forward security, so if your session keys are stolen they can be used to decrypt network traffic later on
* The GSSAPI path for OpenSSH is not approved by upstream. I don't know all the details of why but I think part of it is that the Kerberos authentication runs as the part of sshd that still runs as root. But it's patched in by Debian and Red Hat & so for most people this isn't a huge concern as long as they install security updates
* It initially seems complex & mysterious to maintain, which is why I rely on FreeIPA to do it for me. Is it harder than running a CA properly, probably not...
* Fragmentation in the Kerberos ecosystem means that you can run into annoying compatibility issues (e.g., on Debian, Samba is built against Heimdal Kerberos, which can't use KEYRING/KCM credentials caches; anything running on the JVM is generally a nightmare to configure, can't use the system-wide credentials cache, can't obtain a TGT using modern authentication so you're stuck with password authentication for obtaining the TGT & imposes obsolete crypto)


to post comments

Using certificates for SSH authentication

Posted Nov 9, 2022 18:31 UTC (Wed) by iabervon (subscriber, #722) [Link]

I think it's easier than running an X.509 CA properly, but harder than running an SSH CA properly. The difficulty of running a trusted third party is based on the complexity of what it has to judge (plus implementation awkwardness), and SSH is at least as simple on that as Kerberos, while X.509 is really complicated. The fixed structure of a SSH certificate makes it pretty much equivalent in semantic complexity to a Kerberos ticket, and far simpler than most things called "certificates".

Using certificates for SSH authentication

Posted Nov 17, 2022 12:58 UTC (Thu) by zwol (guest, #126152) [Link] (1 responses)

* There is no way (AFAICT) to use an SSH key as the credential with which to request a TGT. You're stuck using a passphrase for the initial authentication process. This is a UX friction point for anyone who has to work with remote hosts managed via Kerberos *and* remote hosts managed via .ssh/authorized_keys -- your ssh-agent does you no good for the former and your local Kerberos tickets do you no good for the latter. And since all the big cloud code hosters are in the latter category for "git push", this in turn means *any Kerberized organization* is probably caught in this irritating catch-22.

Using certificates for SSH authentication

Posted Nov 19, 2022 2:23 UTC (Sat) by rra (subscriber, #99804) [Link]

> There is no way (AFAICT) to use an SSH key as the credential with which to request a TGT.

Not out of the box but it's not particularly difficult to write. I did so at my previous job. Conceptually, it's just a simple ssh forced-command wrapper around kinit against the KDC as the backing store and then returning the resulting TGT for storage in a ticket cache. Maybe a week or two of work.

The hard part in all of these systems isn't the protocols, it's your chain of trust for how you get keys to users, manage them, and revoke them when necessary.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds