MorphGate keeps your SSH keys in the encrypted vault, and checks every server's host key before it signs in.
Your SSH keys
Choose Keys in the sidebar. The page has three tabs: Keys, Identities and Host CAs. The Keys tab shows each key's type and fingerprint, the hosts and identities that use it, and its certificate: None, how long it's valid, Expires in a few days, or Expired.
Generate a key
- On the Keys page, choose New key.
- Leave Generate selected, give the key a label, and choose Generate key.
MorphGate creates a new Ed25519 key. The private key is stored only in your encrypted vault.
Import a key
- On the Keys page, choose New key, then Import.
- Choose From file and pick the private key file (for example
id_ed25519, a .pem file or PuTTY's .ppk), or Paste the private key. Without a label, the key is named after its file. - If the key is encrypted, enter it under Passphrase (only if the key is encrypted).
- Choose Import key.
The key is copied into the vault. The original file is not changed. An OpenSSH or PEM key is kept as it is, and its passphrase is saved in the vault with it. A PuTTY key is converted to an OpenSSH key and kept without its passphrase, since the vault encrypts it anyway. Ed25519, ECDSA and RSA keys work; DSA keys can't be imported.
Use a key
On the Keys page, choose a key's name to see its type, fingerprint and public key. Choose Copy public key and add it to ~/.ssh/authorized_keys on your servers. Then pick the key in a host's editor under SSH key, or in an identity. A host can only use keys from its own vault.
To delete a key, open it and choose Delete, then Really delete?. A key that a host, an identity or a cloud source still uses can't be deleted: the message names them.
Certificates
Servers that trust a certificate authority (step-ca, HashiCorp Vault, Teleport, or ssh-keygen -s) accept your key with a certificate the CA issued for it.
- Open the key and choose Add certificate.
- Choose From file and pick the certificate (for example
id_ed25519-cert.pub), or Paste it. - Choose Save certificate.
MorphGate takes only a certificate for signing in that was issued for this key. The key then shows the certificate's Validity (with a warning when it expires within a day, and Expired once it has), who it Signs in as, who it was Issued by and its Key ID. When signing in, MorphGate presents the certificate first, then the key alone. Replace certificate and Remove certificate change it.
Renewing a certificate
Short-lived certificates can be renewed by a command that runs on your computer, such as vault write -field=signed_key ssh/sign/deploy public_key=-, step ssh certificate --sign … or ssh-keygen -s ….
- Open the key and choose Renew with a command….
- Enter the command under Renew with a command. It gets the key's public key on its input, and as a file wherever you write
%k, and prints the new certificate. - If it leaves the certificate in a file instead of printing it, enter that file under Certificate file (optional).
- Choose Save renewal.
MorphGate then runs the command before connecting whenever the certificate is missing or runs out within 5 minutes, and when you choose Renew now. It waits up to 3 minutes, long enough to sign in through your browser. The new certificate is saved with the key and syncs. If renewing fails while the current certificate still works, MorphGate connects with it; otherwise the connection stops and says why.
A renewal command that came with the vault, because someone else set it or you set it on another device, runs on this computer only after you read it and choose Allow on this device. A changed command asks again.
SSH agent
Instead of a key from the vault, a host can sign in with SSH agent: keys kept in 1Password, Bitwarden, Secretive, Pageant or your system's SSH agent. See Keys in 1Password, Bitwarden and other SSH agents.
Host keys
A host key proves you reached the server you meant to, and not someone in between. MorphGate trusts a host key on first use and pins it, unless a host CA you trust vouches for the host, or the host's feed lists its keys (see Host keys from a feed).
The first connection
When a host has not been seen before, MorphGate shows Unknown host key with the key type and fingerprint. Compare it with the fingerprint your server's admin gave you. Choose Trust and connect only if it matches. From then on the key is pinned. If you don't answer within two minutes, the connection gives up; connect again to see the question again.
With jump hosts, each hop's key is checked and pinned on its own before the next hop opens.
When a host key changes
If a host answers with a different key than the one pinned, MorphGate does not connect. It shows Host key changed with:
- the pinned fingerprint and where it is (the file and line in
known_hosts), - the fingerprint the host presented now,
- what to do next.
Someone may be intercepting the connection, or the server's key was really replaced. To find out:
- Ask the server's admin whether the host key was rotated, and compare the new fingerprint with theirs.
- Only if it matches, remove the old line from the
known_hostsfile named in the warning, and connect again. MorphGate then asks you to trust the new key.
Copy details copies the fingerprints and file location, to send to the admin.
Host CAs
If your hosts' keys are signed by a certificate authority (step-ca, HashiCorp Vault, Teleport, or ssh-keygen -h -s), you can trust that CA instead of each host's key.
- On the Keys page, open the Host CAs tab and choose New host CA.
- Give it a Name.
- Paste The CA's public key (
ssh-ed25519 AAAA…), or a whole@cert-authorityline from aknown_hostsfile. - Under For hosts, enter the hosts it covers, separated by commas, for example
*.example.com, 10.0.*, !bastion.example.com.*and?match,!excludes. A pattern covers the host on any port; write[host]:portfor one port. A pasted@cert-authorityline brings its own hosts. - Choose Save host CA.
A host it covers that presents a certificate from that CA connects without Unknown host key, and nothing is pinned for it. A certificate that doesn't hold up, because it expired, names another host or comes from another CA, stops the connection with the reason. A covered host that presents no certificate is pinned as usual.
Host CAs are items like keys: they sync, and one in a team's vault covers everyone with access. @cert-authority lines in your known_hosts files count too.
Where host keys are kept
MorphGate keeps the host keys you accept in its own known_hosts file in its data folder (see Install and update). It also trusts the entries in ~/.ssh/known_hosts, read-only. A changed key in either file blocks the connection. Entries must name the host as you wrote it in MorphGate (or be hashed); lines with wildcard patterns don't count, so such a host asks on its first connection.
Host keys are kept per device and don't sync. A new device asks you to trust each host's key the first time it connects.
Where you see the pinned key
Once connected, the route bar above the session shows the pinned key's type and a short fingerprint. Hover it for the full fingerprint. For a host a host CA vouches for, it shows certified by and the CA's name instead. The host editor's Connection path says key pinned.
Keys in a team
Keys in a team's shared vault can be used by everyone with access to that vault. When someone leaves, the app can replace a shared key on every server that uses it. Members can also publish the public keys they use on the team's servers, so they can be found and removed later. See Removing members and rotating keys.