Checking ECDSA and Ed25519 host keys before the first SSH login

Summary

In September 2015 Manuel Schmitt reports that new manitu root server customers, and customers after a reinstallation, now also receive the ECDSA and ED25519 host keys by mail for verification. Until then the setup mail did not include these newer key types. Manuel Schmitt calls the addition overdue.

Why the first login is delicate

On the first connection the SSH client does not yet know the server's host key and asks whether to trust the fingerprint shown. Confirming blindly here can leave you exposed to an attacker in the middle. A fingerprint from a second channel, such as the setup mail, makes this decision verifiable.

Modern OpenSSH clients prefer the newer key types. ECDSA host keys arrived with OpenSSH 5.7 in January 2011, Ed25519 with OpenSSH 6.5 in January 2014. If the mail lacks the type the client negotiates, the fingerprint shown cannot be compared.

Other routes to a trusted key

SSHFP records according to RFC 4255 publish fingerprints in DNS; RFC 7479 added Ed25519 in March 2015. With VerifyHostKeyDNS the client checks them automatically, but they only count as trusted with DNSSEC. ssh-keygen -r generates the matching records.

OpenSSH 6.8 of March 2015 switched the fingerprint display from MD5 in hex to SHA256 in base64. A mail with MD5 fingerprints therefore does not match what newer clients show.

Ideas

  • Host keys known in advance make the first SSH connection verifiable.
  • Several modern key types account for different client capabilities.
  • The client only compares the key type it is currently negotiating.
  • A reinstallation changes the server identity and requires new fingerprints.
  • SSHFP in DNS is an automatic alternative with DNSSEC.

Insights

  • Trust on first use becomes more robust when a second trusted channel delivers the key.
  • Automated provisioning should treat server identity like credentials.

Facts

  • From September 2015, new root server customers received ECDSA and ED25519 host keys, also after a reinstallation.
  • OpenSSH has supported ECDSA since version 5.7 and Ed25519 since version 6.5.
  • Since OpenSSH 6.8, ssh shows fingerprints as SHA256 in base64 instead of MD5 in hex.
  • RFC 7479 added Ed25519 to SSHFP records in March 2015.

References

Recommendations

  • Compare the fingerprint before confirming a new SSH host.
  • Provide fingerprints for all key types and in SHA256 format in setup mails.
  • Publish SSHFP records if the zone is signed with DNSSEC.
  • Only remove old known_hosts entries after a verified reinstallation.

Read the original article on Hostblogger

Search the Web Archive

Found a mistake or have something to add? Get in touch.