6 .Nd gather ssh public keys
10 .Op Ar -- | host | addrlist namelist
14 is a utility for gathering the public ssh host keys of a number of
15 hosts. It was designed to aid in building and verifying
19 provides a minimal interface suitable for use by shell and perl
23 uses non-blocking socket I/O to contact as many hosts as possible in
24 parallel, so it is very efficient. The keys from a domain of 1,000
25 hosts can be collected in tens of seconds, even when some of those
26 hosts are down or do not run ssh. You do not need login access to the
27 machines you are scanning, nor does does the scanning process involve
30 If you make an ssh_known_hosts file using
32 without verifying the keys, you will be vulnerable to
35 On the other hand, if your security model allows such a risk,
37 can help you detect tampered keyfiles or man in the middle attacks which
38 have begun after you created your ssh_known_hosts file.
42 Set the timeout for connection attempts. If
44 seconds have elapsed since a connection was initiated to a host or since the
45 last time anything was read from that host, then the connection is
46 closed and the host in question considered unavailable. Default is 5
51 pairs from this file, one per line.
54 is supplied instead of a filename,
58 pairs from the standard input.
62 Print the host key for machine
68 Find all hosts from the file
70 which have new or different keys from those in the sorted file
73 ssh-keyscan -f ssh_hosts | sort -u - ssh_known_hosts | \e\
74 diff ssh_known_hosts -
80 1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
83 host-or-namelist bits exponent modulus
85 .Pa /etc/ssh_known_hosts
87 It generates "Connection closed by remote host" messages on the consoles
88 of all the machines it scans.
89 This is because it opens a connection to the ssh port, reads the public
90 key, and drops the connection as soon as it gets the key.
95 David Mazieres <dm@lcs.mit.edu>