Table of Contents

SSH Certificates

Generating the Master Key

First you need a master key (CA). Make sure you create it somewhere secure (i.e. a machine you can trust) and preferably as a privileged user (i.e. root). Obviously you only need to do this once.

mkdir my_ssh_ca
cd my_ssh_ca
ssh-keygen -t ed25519 -C "My SSH CA 2020-02-28" -f my_ssh_ca_key

ssh-keygen will prompt you for a passphrase, make sure you use something really strong! I recommend ed25519 keys for everything, just because it improves upon the other options and tries to resolve issues that the older standards have, though I cannot vouch for the security of any of them.

Signing a User Key

Generate the user's key in the standard way (i.e. have them run ssh-keygen -t ed25519), then bring the public (not the private!) keyfile to the master key/CA (never the other way around! you need to access the private master key to do the signing and this should never be exposed more than necessary).

ssh-keygen -s my_ssh_ca_key -I <identifier> -n <username> -V <validity> user_public_key.pub

ssh-keygen will prompt for the master key's password, if you input this correctly it will sign the given user's key and give you a file like user_public_key-cert.pub. Now take this back to the user's account and put it next to the user's public key and ssh will automagically pick it up.