]> andersk Git - openssh.git/blob - ssh-keyscan.1
31bae33c339761107f8aeb62c830d0f4dbf776d7
[openssh.git] / ssh-keyscan.1
1 .Dd January 1, 1996
2 .Dt ssh-keyscan 1
3 .Os
4 .Sh NAME
5 .Nm ssh-keyscan
6 .Nd gather ssh public keys
7 .Sh SYNOPSIS
8 .Nm ssh-keyscan
9 .Op Fl t Ar timeout
10 .Op Ar -- | host | addrlist namelist
11 .Op Fl f Ar files ...
12 .Sh DESCRIPTION
13 .Nm
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
16 .Pa ssh_known_hosts
17 files.
18 .Nm
19 provides a minimal interface suitable for use by shell and perl
20 scripts.
21 .Pp
22 .Nm
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
28 any encryption.
29 .Sh SECURITY
30 If you make an ssh_known_hosts file using
31 .Nm
32 without verifying the keys, you will be vulnerable to
33 .I man in the middle
34 attacks.
35 On the other hand, if your security model allows such a risk,
36 .Nm
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.
39 .Sh OPTIONS
40 .Bl -tag -width Ds
41 .It Fl t
42 Set the timeout for connection attempts.  If 
43 .Pa timeout
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
47 seconds.
48 .It Fl f
49 Read hosts or 
50 .Pa addrlist namelist
51 pairs from this file, one per line.
52 If
53 .Pa -
54 is supplied instead of a filename,
55 .Nm
56 will read hosts or 
57 .Pa addrlist namelist
58 pairs from the standard input.
59 .El
60 .Sh EXAMPLES
61 .Pp
62 Print the host key for machine
63 .Pa hostname :
64 .Bd -literal
65 ssh-keyscan hostname
66 .Ed
67 .Pp
68 Find all hosts from the file
69 .Pa ssh_hosts
70 which have new or different keys from those in the sorted file
71 .Pa ssh_known_hosts :
72 .Bd -literal
73 ssh-keyscan -f ssh_hosts | sort -u - ssh_known_hosts | \e\ 
74         diff ssh_known_hosts -
75 .Ed
76 .Pp
77 .Sh FILES
78 .Pp
79 .Pa Input format:
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
81 .Pp
82 .Pa Output format:
83 host-or-namelist bits exponent modulus
84 .Pp
85 .Pa /etc/ssh_known_hosts
86 .Sh BUGS
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.
91 .Sh SEE ALSO
92 .Xr ssh 1
93 .Xr sshd 8
94 .Sh AUTHOR
95 David Mazieres <dm@lcs.mit.edu>
This page took 0.048573 seconds and 3 git commands to generate.