Display SSH fingerprint (after first boot)

April 11, 2016 587 views
Deployment Security

Fingerprints are currently displayed in the console only at the first boot.

How am I on a later occasion supposed to know I'm connecting to the intended host without the fingerprint to verify with?

Using public key infrastructure (PKI) doesn't protect against a man-in-the-middle (MITM) attack when someone has my public key and can route me to another server. I'd have to verify the server in another way. It may often be unlikely an adversary manages to construct an environment that fools me to believe it's mine, but that's not an acceptable verification method.


  1. Add SSH key at creation. Using a password without having verified fingerprint lets a MITM relay the traffic and monitor or modify your session. With PKI you can be misrouted to a deceptive environment, but not directly compromise the intended target server.
  2. Login using SSH key.
  3. Set root password to something sufficiently unique and secure.
  4. Open web console.
  5. Login using new root password.
  6. Successful login should confirm you're on that server.


Display the fingerprints in both hex and Base64 of applicable algorithms either in the control panel or configure Droplets to show them in console every boot.


There's another thread asking for fingerprints through the API.

On another note, you can avoid the risk of sending the root login credentials over email if you instead send a link where the person has to login to DigitalOcean in order to receive the password (making sure they're in control of both email and account). But those who care to that degree may use PKI.

1 Answer

Hey Jooize,

This may not answer your question fully, but as far as:

"How am I on a later occasion supposed to know I'm connecting to the intended host without the fingerprint to verify with?"

Your SSH client handles this for you with its 'known_hosts' (or equivalent) file.

For example, if using PuTTY on windows to SSH into your droplet, the first time you SSH in, PuTTY will prompt you that "The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is'. If you select yes to this prompt, after confirming once that the fingerprint is correct, it stores that value in the Windows registry [HKEYCURRENTUSER\SoftWare\SimonTatham\PuTTY\SshHostKeys]. If you were to then SSH into your droplet again with PuTTY, and someone was doing a MITM to a different server, PuTTY would not let you connect, stating that the attackers host that you are being redirected to doesn't have the same fingerprint that is stored in the registry (making it so you don't have to remember the fingerprint and check it yourself every time).

SSH on Linux / MacOS uses a similar technique, but rather saves in the info in ~/.ssh/known_hosts or /etc/ssh/known_hosts.

TL;DR: your SSH client caches the fingerprint on first connection and will warn you if it changes.

  • As a further update, if you really want to see the RSA fingerprint of your host when you log in you can do add the following line to /etc/update-motd.d/00-header (tested on Ubuntu 14.04 anyways):

    SSH_HOSTKEY=$(ssh-keygen -lf /etc/ssh/
    printf "SSH RSA Fingerprint: $SSH_HOSTKEY"

    Which will show the RSA fingerprint in the MOTD Header when you log in.

    The RSA fingerprint of a server is 'public' however, and anyone can obtain it (simply run ssh-keyscan to get the public keys available, the fingerprint is just a hash of those keys), so don't simply just trust it because it shows it to you when you log into a server (anyone could make a server display that). Your SSH client will properly verify that the host public key is correct (based on what is saved in ~/.ssh/known_hosts after the first connection), and that the server has the correct corresponding private key. If the key has changed (MITM, you re-installed openssh on your server and it generated new keys, etc) you will get a warning.

Have another answer? Share your knowledge.