Centos – Using SSH Keys with Kerberos

centoskerberosputtyssh

So there's an issue that we've been having at our company causing me to pull my hair out for the past week:

We have hundreds of server boxes (a mix of CentOS6/7, if it matters) that need to quickly be SSHed into on a daily basis between a team. Everyone is using mRemoteNG or SuperPutty as the ability to save and organize connection info as well as tabbed connections are a must have. Presently everyone is sharing a single SSH key to log into all boxes. Obviously our current practice is a terrible idea, so what we'd like to do is give each user an individual account and key to be used across the boxes.

Looking around, it seemed that Kerberos is a perfect option for managing multiple users and handling authentication across a la
rge amount of servers. Unfortunately we seem to be having some issues in getting it to work the way we want. We were able to set up Kerberos to handle SSH connections for users with passwords, but when it came to disabling passwords and using SSH keys, we couldn't figure it out.

We looked into using Kerberos keytabs as well, howevever we could not get them to work via PuTTY or find a viable solution to save connection info and have tabbed connections with keytabs.

The main question here is: Can Kerberos be used to manage SSH users with SSH keys? If not, is there a build of PuTTY available that works with Kerberos keytabs, or an alternative that can organize and have tabbed connections? Thanks!

Best Answer

First off, a clarification. Kerberos and SSH Keys are two mutually exclusive authentication methods for SSH. You don't use Kerberos with SSH Keys. You use Kerberos instead of SSH Keys. Both allow for "passwordless" SSH logon. A bit of reading on the Kerberos protocol may be in order.

With Kerberos, you need to obtain a TGT that proves you are who you say you are before you try to connect to your endpoint. If you're on Windows joined to an Active Directory domain, you automatically get a Kerberos TGT for the Active Directory realm on login. But a lot of organizations don't bother configuring their Linux hosts to use the Active Directory Kerberos realm. If you do, life is much easier. If you don't, it means that Windows needs to be configured to know about your other Kerberos realm and how to request a ticket. It's also an extra step for your users because they'll need to abandon their AD TGT and request a TGT for your other realm.

You also have the option to use a trust between the Kerberos realms such that (for example) AD users can authenticate to resources in the other Kerberos realm.

A Kerberos keytab file is just a file representation of your Kerberos account password. So when requesting your initial TGT, you wouldn't need to enter your password if you had a valid keytab file. But this is also generally outside the scope of your SSH client.

Once you have a valid TGT, you need to make sure your SSH client is configured to use GSSAPI. PuTTY supports this out of the box and I'm sure most others do as well.

Assuming everything is configured properly, it should "just work". But there are a lot of configuration mishaps that can happen along the way. There are also a lot of third party products that can make things easier, but I will refrain from mentioning anything specific.