Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey friend!
Currently the only way to do this would be to log in through the web console and check it there before accepting it over SSH. I suppose no matter how you spin it, you’re accepting something remote as truth, so I don’t know the most flawless answer. It is an interesting thought experiment, I fear it will plague my mind for the remainder of the evening.
Jarland
how about as @orric suggests, but instead of your own server display it in the webconsole? e.g.
When creating the droplet, enable “User data” and put in a the following script?
#!/bin/bash
ssh-keygen -lv -f /etc/ssh/ssh_host_ecdsa_key >> /etc/issue
And then clicking the console in the control panel to see the key fingerprint in the pre-login banner? Obviously edit key file to taste.
I found another solution for this: when creating the droplet, enable “User data” and put in a script which installs a web server and publishes the server’s SSH key fingerprint. You can verify the key hasn’t been modified in transit using an HMAC with a shared secret. Here’s an example script:
#!/bin/bash
# install web server
apt-get -y update
apt-get -y install apache2
# put the public ssh key fingerprint in the default webroot
ssh-keygen -lv -f /etc/ssh/ssh_host_ed25519_key > /var/www/html/key
chmod o+r /var/www/html/key
# generate the HMAC of /var/www/html/key
cat /var/www/html/key | openssl dgst -sha256 -hmac "SECRET" > /var/www/html/hmac
chmod o+r /var/www/html/hmac
Replace SECRET.
Then you can access http://your-droplets-ip/key to see the public key and http://your-droplets-ip/hmac to get the HMAC.
To make sure that a MITM hasn’t modified the key file in transit, you can verify the HMAC on your computer:
curl -s http://your-droplets-ip/key | openssl dgst -sha256 -hmac "SECRET"
curl -s http://your-droplets-ip/hmac
The output of these commands must be identical.
Alternatively, you can also have the script email you the key & hmac.
Cheers!