6447 handful of nvpair cleanups
[unleashed.git] / usr / src / man / man1 / ssh-keyscan.1
blob0b59558624053a574715bace31cebb30f9087e81
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SSH-KEYSCAN 1 "Jul 24, 2004"
7 .SH NAME
8 ssh-keyscan \- gather public ssh host keys of a number of hosts
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBssh-keyscan\fR [\fB-v46\fR] [\fB-p\fR \fIport\fR] [\fB-T\fR \fItimeout\fR] [\fB-t\fR \fItype\fR]
13      [\fB-f\fR \fIfile\fR] [\fB-\fR] [\fIhost\fR... | \fIaddrlist\fR \fInamelist\fR] [...]
14 .fi
16 .SH DESCRIPTION
17 .sp
18 .LP
19 \fBssh-keyscan\fR is a utility for gathering the public ssh host keys of a
20 number of hosts. It was designed to aid in building and verifying
21 \fBssh_known_hosts\fR files. \fBssh-keyscan\fR provides a minimal interface
22 suitable for use by shell and perl scripts. The output of \fBssh-keyscan\fR is
23 directed to standard output.
24 .sp
25 .LP
26 \fBssh-keyscan\fR uses non-blocking socket I/O to contact as many hosts as
27 possible in parallel, so it is very efficient. The keys from a domain of 1,000
28 hosts can be collected in tens of seconds, even when some of those hosts are
29 down or do not run ssh. For scanning, one does not need login access to the
30 machines that are being scanned, nor does the scanning process involve any
31 encryption.
32 .SS "File Format"
33 .sp
34 .LP
35 Input format:
36 .sp
37 .in +2
38 .nf
39 1.2.3.4,1.2.4.4
40 \fIname.my.domain,name,n.my.domain,n,\fR1.2.3.4,1.2.4.4
41 .fi
42 .in -2
43 .sp
45 .sp
46 .LP
47 Output format for \fBrsa1\fR keys:
48 .sp
49 .in +2
50 .nf
51 \fIhost-or-namelist bits exponent modulus\fR
52 .fi
53 .in -2
54 .sp
56 .sp
57 .LP
58 Output format for \fBrsa\fR and \fBdsa\fR keys, where \fIkeytype\fR is either
59 \fBssh-rsa\fR or `\fBssh-dsa\fR:
60 .sp
61 .in +2
62 .nf
63 \fIhost-or-namelist keytype base64-encoded-key\fR
64 .fi
65 .in -2
66 .sp
68 .SH OPTIONS
69 .sp
70 .LP
71 The following options are supported:
72 .sp
73 .ne 2
74 .na
75 \fB\fB-f\fR \fIfilename\fR\fR
76 .ad
77 .RS 28n
78 Read hosts or addrlist namelist pairs from this file, one per line. If you
79 specity - instead of a filename, \fBssh-keyscan\fR reads hosts or addrlist
80 namelist pairs from the standard input.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fB\fB-p\fR \fIport\fR\fR
87 .ad
88 .RS 28n
89 Port to connect to on the remote host.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fB-T\fR \fItimeout\fR\fR
96 .ad
97 .RS 28n
98 Set the timeout for connection attempts. If \fItimeout\fR seconds have elapsed
99 since a connection was initiated to a host or since the last time anything was
100 read from that host, the connection is closed and the host in question is
101 considered unavailable. The default is for \fItimeout\fR is 5 seconds.
105 .ne 2
107 \fB\fB-t\fR \fItype\fR\fR
109 .RS 28n
110 Specify the type of the key to fetch from the scanned hosts. The possible
111 values for \fItype\fR are \fBrsa1\fR for protocol version 1 and \fBrsa\fR or
112 \fBdsa\fR for protocol version 2. Specify multiple values by separating them
113 with commas. The default is \fBrsa1\fR.
117 .ne 2
119 \fB\fB-v\fR\fR
121 .RS 28n
122 Specify verbose mode. Print debugging messages about progress.
126 .ne 2
128 \fB\fB-4\fR\fR
130 .RS 28n
131 Force to use IPv4 addresses only.
135 .ne 2
137 \fB\fB-6\fR\fR
139 .RS 28n
140 Forces to use IPv6 addresses only.
143 .SH SECURITY
146 If a \fBssh_known_hosts\fR file is constructed using \fBssh-keyscan\fR without
147 verifying the keys, users are vulnerable to man-in-the-middle attacks. If the
148 security model allows such a risk, \fBssh-keyscan\fR can help in the detection
149 of tampered keyfiles or man-in-the-middle attacks which have begun after the
150 \fBssh_known_hosts\fR file was created.
151 .SH EXAMPLES
153 \fBExample 1 \fRPrinting the \fBrsa1\fR Host Key
156 The following example prints the \fBrsa1\fR host key for machine
157 \fBhostname\fR:
160 .in +2
162 $ ssh-keyscan hostname
164 .in -2
168 \fBExample 2 \fRFinding All Hosts
171 The following commands finds all hosts from the file \fBssh_hosts\fR which have
172 new or different keys from those in the sorted file \fBssh_known_hosts\fR:
175 .in +2
177 $ ssh-keyscan -t rsa,dsa -f ssh_hosts | \e
178      sort -u - ssh_known_hosts | diff ssh_known_hosts -
180 .in -2
183 .SH FILES
185 .ne 2
187 \fB\fB/etc/ssh_known_hosts\fR \fR
189 .RS 25n
193 .SH EXIT STATUS
196 The following exit values are returned:
198 .ne 2
200 \fB\fB0\fR \fR
202 .RS 6n
203 No usage errors. \fBssh-keyscan\fR might or might not have succeeded or failed
204 to scan one, more or all of the given hosts.
208 .ne 2
210 \fB\fB1\fR\fR
212 .RS 6n
213 Usage error.
216 .SH ATTRIBUTES
219 See \fBattributes\fR(5) for descriptions of the following attributes:
224 box;
225 c | c
226 l | l .
227 ATTRIBUTE TYPE  ATTRIBUTE VALUE
229 Interface Stability     Evolving
232 .SH SEE ALSO
235 \fBssh\fR(1), \fBsshd\fR(1M), \fBattributes\fR(5)
236 .SH AUTHORS
239 David Mazieres wrote the initial version, and Wayne Davison added suppport for
240 protocol version 2.
241 .SH BUGS
244 \fBssh\(emkeyscan\fR generates
246 .in +2
248 Connection closed by remote host
250 .in -2
255 messages on the consoles of all machines it scans if the server is older than
256 version 2.9. This is because \fBssh-keyscan\fR opens a connection to the
257 \fBssh\fR port, reads the public key, and drops the connection as soon as it
258 gets the key.