1 .\" $OpenBSD: ssh-keyscan.1,v 1.12 2001/09/05 06:23:07 deraadt 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.
14 .Nd gather ssh public keys
22 .Op Ar host | addrlist namelist
26 is a utility for gathering the public ssh host keys of a number of
27 hosts. It was designed to aid in building and verifying
31 provides a minimal interface suitable for use by shell and perl
35 uses non-blocking socket I/O to contact as many hosts as possible in
36 parallel, so it is very efficient. The keys from a domain of 1,000
37 hosts can be collected in tens of seconds, even when some of those
38 hosts are down or do not run ssh. For scanning, one does not need
39 login access to the machines that are being scanned, nor does the
40 scanning process involve any encryption.
42 The options are as follows:
45 Port to connect to on the remote host.
47 Set the timeout for connection attempts. If
49 seconds have elapsed since a connection was initiated to a host or since the
50 last time anything was read from that host, then the connection is
51 closed and the host in question considered unavailable. Default is 5
54 Specifies the type of the key to fetch from the scanned hosts.
55 The possible values are
57 for protocol version 1 and
61 for protocol version 2.
62 Multiple values may be specified by separating them with commas.
68 pairs from this file, one per line.
71 is supplied instead of a filename,
75 pairs from the standard input.
80 to print debugging messages about its progress.
84 to use IPv4 addresses only.
88 to use IPv6 addresses only.
91 If a ssh_known_hosts file is constructed using
93 without verifying the keys, users will be vulnerable to
96 On the other hand, if the security model allows such a risk,
98 can help in the detection of tampered keyfiles or man in the middle
99 attacks which have begun after the ssh_known_hosts file was created.
110 Find all hosts from the file
112 which have new or different keys from those in the sorted file
113 .Pa ssh_known_hosts :
115 ssh-keyscan -t rsa,dsa -f ssh_hosts | \e\
116 sort -u - ssh_known_hosts | diff ssh_known_hosts -
121 1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
124 .Pa Output format for rsa1 keys:
126 host-or-namelist bits exponent modulus
129 .Pa Output format for rsa and dsa keys:
131 host-or-namelist keytype base64-encoded-key
141 .Pa /etc/ssh_known_hosts
143 It generates "Connection closed by remote host" messages on the consoles
144 of all the machines it scans if the server is older than version 2.9.
145 This is because it opens a connection to the ssh port, reads the public
146 key, and drops the connection as soon as it gets the key.
151 David Mazieres <dm@lcs.mit.edu>
152 wrote the initial version, and
153 Wayne Davison <wayned@users.sourceforge.net>
154 added support for protocol version 2.