1 .\" $OpenBSD: ssh-keyscan.1,v 1.5 2001/04/18 16:21:05 ian 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 (for instance by leaving this copyright notice
15 .Nd gather ssh public keys
19 .Op Ar -- | host | addrlist namelist
23 is a utility for gathering the public ssh host keys of a number of
24 hosts. It was designed to aid in building and verifying
28 provides a minimal interface suitable for use by shell and perl
32 uses non-blocking socket I/O to contact as many hosts as possible in
33 parallel, so it is very efficient. The keys from a domain of 1,000
34 hosts can be collected in tens of seconds, even when some of those
35 hosts are down or do not run ssh. You do not need login access to the
36 machines you are scanning, nor does the scanning process involve
39 If you make an ssh_known_hosts file using
41 without verifying the keys, you will be vulnerable to
44 On the other hand, if your security model allows such a risk,
46 can help you detect tampered keyfiles or man in the middle attacks which
47 have begun after you created your ssh_known_hosts file.
51 Set the timeout for connection attempts. If
53 seconds have elapsed since a connection was initiated to a host or since the
54 last time anything was read from that host, then the connection is
55 closed and the host in question considered unavailable. Default is 5
60 pairs from this file, one per line.
63 is supplied instead of a filename,
67 pairs from the standard input.
71 Print the host key for machine
77 Find all hosts from the file
79 which have new or different keys from those in the sorted file
82 $ ssh-keyscan -f ssh_hosts | sort -u - ssh_known_hosts | \e\
83 diff ssh_known_hosts -
89 1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
92 host-or-namelist bits exponent modulus
94 .Pa /etc/ssh_known_hosts
96 It generates "Connection closed by remote host" messages on the consoles
97 of all the machines it scans.
98 This is because it opens a connection to the ssh port, reads the public
99 key, and drops the connection as soon as it gets the key.
104 David Mazieres <dm@lcs.mit.edu>