It always starts out the same way: a few machines, a few users and a few SSH keys to manage. You manually copy their keys (and your own) to the appropriate machines. You might even say, โScrew it,โ and share one key for root access. Admit it. Itโs OK. Well, no, itโs not OK, but we all do it at some point, even though we know better. Like pouring grease down the drain: We know we shouldnโt do it, but sometimes itโs just so much more expedient.
Anyway, youโre lucky enough that your company starts to scale and things start to get more complicated. More users, more servers, tons more keys. Like having too many kids at a birthday party: You start spending all your time making sure they have ice cream, they donโt fall off the trampoline, they donโt get into fights. Youโre spending way too much time managing your users and their keys, so you realize you need some sort of system to keep everything coordinated. Often this starts off as an Excel spreadsheet tracking who has what key on what machine (another thing we all do but donโt like to admit to our friends). Thatโs a start, but thatโs just one of many things that you need for SSH key management, and the less manual the process, the better.
Centralized Store of Identities
First, letโs admit that Excel spreadsheets really arenโt sufficient to track who can access what on your servers. Without centralized key management, youโre likely to have temporary accounts that are forgotten and hang around forever. Youโve also got the problem of rogue users: One of the users you authorized users goes around you to add someone else and you as the administrator have no idea. You want to have one source of identity for these machinesโone place to add, one place to delete, one place to audit.
Provisioning New Users
If Iโm adding a user a month, sure, I can go and add peoplesโ keys to each machine manually. Of course, this presupposes that youโve got the public key from the user and have it to move around. Which presupposes theyโre savvy enough to manage making keys themselves. A key management system should make this process simpler for you, reading from your identity store and putting them onto the appropriate machines.
Deprovision Departing Users
If you have someone leaving on good terms, itโs just good practice to remove their keys from your servers. It keeps things clean and secure. If theyโre leaving on not-so-good terms, though, you better know where the keys are on every machine and be able to remove them quickly. This also reiterates the need for keeping separate keys for all of your users: If they have the private key for root, youโre going to have to not only get that key off the machines but also hand out the new key to everyone that is supposed to have access to the shared account.
SSH Key Rotation
Keeping the same key around makes you more vulnerable to attack if an old key is compromised. The PCI DSS standard says that keys must be rotated at least annually. Making this as easy as possible for the user is important, and you must have someplace to record when each key was last rotated. For a lot of organizations, this is probably that Excel spreadsheet somewhere thatโs dusted off right before an audit. Doing this rightโrotating all your keys across all your machines on a regular scheduleโcalls out for an automated process.
SSH Key Robustness
Letโs say everyone in your organization is using 1024-bit keys and suddenly word comes down that you need 2048-bit keys instead. Having a key management system is going to help coordinate the update. Otherwise, youโre going to be looking at every key on every server (notice a pattern here?) to see which need updating.
Getting Rid of Defunct SSH Keys
This isnโt a one-time thing; keys (and users) have a tendency to be provisioned โtemporarilyโ and then forgotten and left on a machine. A good key management system will find and remove these keysโor at least notify you of their existence.
Allow Users to Self-Service
Although we donโt want to allow users to willy-nilly add accounts for themselves and each other, we also donโt want to have to create and handle their private/public key pairs and go into every machine and make changes whenever they lose a key or want to update their keys. Ideally, our key management system would allow for (secure) user control of their keys, allowing resets and updates.
While most of these things are possible to do by hand, itโs just not easy and it will end up taking way too much time. Maybe you can script itโand in fact, many companies do. But many companies used to write their own string libraries, too, and run their own mail servers and manage their own payroll. Itโs not the best use of your time.
โ Rajat Bhargava




