SSHFP record
What is SSHFP record?
An SSHFP record is a DNS resource record (type 44) that publishes the fingerprint of an SSH server's public host key, so an SSH client can check the key it is offered against DNS instead of asking the user to trust it on first connect. AdminKit's SSHFP generator builds these records in your browser.
By AdminKit team, Netbase JSC · Updated
The first time an SSH client meets a server it has no way to know whether the host key it is shown is the real one, so it asks the user to accept it. An SSHFP record removes that guess by publishing the key’s fingerprint in DNS. RFC 4255 defines the record, assigns it RR type code 44, and gives its data three fields: a key algorithm number, a fingerprint type and the fingerprint itself.
How does an SSHFP record work?
The server’s administrator publishes one record per host key and fingerprint type under the server’s name. The algorithm and fingerprint type numbers come from IANA’s SSHFP parameters registry:
- Algorithm — 1 RSA, 2 DSA, 3 ECDSA, 4 Ed25519, 6 Ed448.
- Fingerprint type — 1 SHA-1, 2 SHA-256. RFC 6594 added SHA-256, and clients that support it are expected to prefer it when both are published.
OpenSSH can print the records for you: the ssh-keygen manual describes -r hostname as printing the SSHFP fingerprint resource record for a public key file. On the client side, the ssh_config manual documents VerifyHostKeyDNS, which defaults to no; set to yes, the client implicitly trusts keys that match a secure fingerprint from DNS, and with ask it shows the match but still asks the user. Publishing the record needs a DNS host that supports the type; Cloudflare’s DNS record types page lists SSHFP among the less common, certificate-related record types it supports.
Why does an SSHFP record depend on DNSSEC?
An SSHFP record is only as trustworthy as the DNS answer that carried it. Without DNSSEC, an attacker who can spoof DNS responses for the host could also hand out a fingerprint for their own key, which is why OpenSSH treats an unsigned match as “ask” rather than trusted. The same rule applies to DANE/TLSA, which pins TLS certificates in DNS the way SSHFP pins SSH host keys. Before relying on SSHFP, confirm the zone validates with AdminKit’s DNSSEC check.
AdminKit’s SSHFP record generator turns pasted OpenSSH public host keys into SHA-256 SSHFP records entirely in your browser, and refuses private keys.
SSHFP records belong to AdminKit’s DNS cluster — browse the AdminKit glossary index for other related terms.
Frequently asked questions
What do the numbers in an SSHFP record mean?
The first is the key algorithm (1 RSA, 2 DSA, 3 ECDSA, 4 Ed25519, 6 Ed448 in IANA's registry), the second is the fingerprint type (1 SHA-1, 2 SHA-256), and the hexadecimal string after them is the fingerprint itself.
Does OpenSSH check SSHFP records by default?
No. The ssh_config option VerifyHostKeyDNS defaults to no. Set to yes, the client trusts keys that match a secure fingerprint from DNS and treats insecure fingerprints as if the option were set to ask.
Why does SSHFP need DNSSEC?
Without DNSSEC an attacker who can spoof DNS answers can also spoof the fingerprint, so the record proves nothing. OpenSSH only treats a matching fingerprint as trusted when the answer is validated as secure.
How do I create SSHFP records for a server?
OpenSSH's ssh-keygen -r hostname prints SSHFP records for a public key file, and AdminKit's SSHFP generator produces the same SHA-256 records from pasted public host keys without sending them anywhere.
Sources
- RFC 4255 -- Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
- RFC 6594 -- Use of the SHA-256 Algorithm with RSA, DSA, and ECDSA in SSHFP Resource Records
- IANA -- DNS SSHFP Resource Record Parameters
- OpenBSD manual pages -- ssh_config(5)
- OpenBSD manual pages -- ssh-keygen(1)
- Cloudflare DNS docs -- DNS record types