1 .\" $OpenBSD: ssh-keyscan.1,v 1.44 2018/03/05 07:03:18 jmc Exp $
3 .\" Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
5 .\" Modification and redistribution in source and binary forms is
6 .\" permitted provided that due credit is given to the author and the
7 .\" OpenBSD project by leaving this copyright notice intact.
9 .Dd $Mdocdate: March 5 2018 $
14 .Nd gather SSH public keys
22 .Op Ar host | addrlist namelist
25 is a utility for gathering the public SSH host keys of a number of
27 It was designed to aid in building and verifying
30 the format of which is documented in
33 provides a minimal interface suitable for use by shell and perl
37 uses non-blocking socket I/O to contact as many hosts as possible in
38 parallel, so it is very efficient.
39 The keys from a domain of 1,000
40 hosts can be collected in tens of seconds, even when some of those
41 hosts are down or do not run
43 For scanning, one does not need
44 login access to the machines that are being scanned, nor does the
45 scanning process involve any encryption.
47 The options are as follows:
52 to use IPv4 addresses only.
56 to use IPv6 addresses only.
58 Request certificates from target hosts instead of plain keys.
60 Print keys found as SSHFP DNS records.
61 The default is to print keys in a format usable as a
73 is supplied instead of a filename,
75 will read from the standard input.
76 Input is expected in the format:
78 1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
81 Hash all hostnames and addresses in the output.
82 Hashed names may be used normally by
86 but they do not reveal identifying information should the file's contents
93 Set the timeout for connection attempts.
96 seconds have elapsed since a connection was initiated to a host or since the
97 last time anything was read from that host, the connection is
98 closed and the host in question considered unavailable.
99 The default is 5 seconds.
101 Specify the type of the key to fetch from the scanned hosts.
102 The possible values are
108 Multiple values may be specified by separating them with commas.
109 The default is to fetch
117 print debugging messages about progress.
120 If an ssh_known_hosts file is constructed using
122 without verifying the keys, users will be vulnerable to
123 .Em man in the middle
125 On the other hand, if the security model allows such a risk,
127 can help in the detection of tampered keyfiles or man in the middle
128 attacks which have begun after the ssh_known_hosts file was created.
130 .Pa /etc/ssh/ssh_known_hosts
132 Print the RSA host key for machine
135 .Dl $ ssh-keyscan -t rsa hostname
137 Find all hosts from the file
139 which have new or different keys from those in the sorted file
140 .Pa ssh_known_hosts :
141 .Bd -literal -offset indent
142 $ ssh-keyscan -t rsa,dsa,ecdsa,ed25519 -f ssh_hosts | \e
143 sort -u - ssh_known_hosts | diff ssh_known_hosts -
151 .%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
155 .An David Mazieres Aq Mt dm@lcs.mit.edu
156 wrote the initial version, and
157 .An Wayne Davison Aq Mt wayned@users.sourceforge.net
158 added support for protocol version 2.