mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-11-29 00:01:43 +08:00
d26dcf3371
- (bal) OpenBSD Sync - markus@cvs.openbsd.org 2001/01/06 11:23:27 [ssh-rsa.c] remove unused - itojun@cvs.openbsd.org 2001/01/05 08:23:29 [ssh-keyscan.1] missing .El - markus@cvs.openbsd.org 2001/01/04 22:41:03 [session.c sshconnect.c] consistent use of _PATH_BSHELL; from stevesk@pobox.com - djm@cvs.openbsd.org 2001/01/04 22:35:32 [ssh.1 sshd.8] Mention AES as available SSH2 Cipher; ok markus - markus@cvs.openbsd.org 2001/01/04 22:25:58 [sshd.c] sync usage()/man with defaults; from stevesk@pobox.com - markus@cvs.openbsd.org 2001/01/04 22:21:26 [sshconnect2.c] handle SSH2_MSG_USERAUTH_BANNER; fixes bug when connecting to a server that prints a banner (e.g. /etc/issue.net)
96 lines
2.5 KiB
Groff
96 lines
2.5 KiB
Groff
.Dd January 1, 1996
|
|
.Dt ssh-keyscan 1
|
|
.Os
|
|
.Sh NAME
|
|
.Nm ssh-keyscan
|
|
.Nd gather ssh public keys
|
|
.Sh SYNOPSIS
|
|
.Nm ssh-keyscan
|
|
.Op Fl t Ar timeout
|
|
.Op Ar -- | host | addrlist namelist
|
|
.Op Fl f Ar files ...
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
is a utility for gathering the public ssh host keys of a number of
|
|
hosts. It was designed to aid in building and verifying
|
|
.Pa ssh_known_hosts
|
|
files.
|
|
.Nm
|
|
provides a minimal interface suitable for use by shell and perl
|
|
scripts.
|
|
.Pp
|
|
.Nm
|
|
uses non-blocking socket I/O to contact as many hosts as possible in
|
|
parallel, so it is very efficient. The keys from a domain of 1,000
|
|
hosts can be collected in tens of seconds, even when some of those
|
|
hosts are down or do not run ssh. You do not need login access to the
|
|
machines you are scanning, nor does does the scanning process involve
|
|
any encryption.
|
|
.Sh SECURITY
|
|
If you make an ssh_known_hosts file using
|
|
.Nm
|
|
without verifying the keys, you will be vulnerable to
|
|
.I man in the middle
|
|
attacks.
|
|
On the other hand, if your security model allows such a risk,
|
|
.Nm
|
|
can help you detect tampered keyfiles or man in the middle attacks which
|
|
have begun after you created your ssh_known_hosts file.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width Ds
|
|
.It Fl t
|
|
Set the timeout for connection attempts. If
|
|
.Pa timeout
|
|
seconds have elapsed since a connection was initiated to a host or since the
|
|
last time anything was read from that host, then the connection is
|
|
closed and the host in question considered unavailable. Default is 5
|
|
seconds.
|
|
.It Fl f
|
|
Read hosts or
|
|
.Pa addrlist namelist
|
|
pairs from this file, one per line.
|
|
If
|
|
.Pa -
|
|
is supplied instead of a filename,
|
|
.Nm
|
|
will read hosts or
|
|
.Pa addrlist namelist
|
|
pairs from the standard input.
|
|
.El
|
|
.Sh EXAMPLES
|
|
.Pp
|
|
Print the host key for machine
|
|
.Pa hostname :
|
|
.Bd -literal
|
|
ssh-keyscan hostname
|
|
.Ed
|
|
.Pp
|
|
Find all hosts from the file
|
|
.Pa ssh_hosts
|
|
which have new or different keys from those in the sorted file
|
|
.Pa ssh_known_hosts :
|
|
.Bd -literal
|
|
ssh-keyscan -f ssh_hosts | sort -u - ssh_known_hosts | \e\
|
|
diff ssh_known_hosts -
|
|
.Ed
|
|
.Pp
|
|
.Sh FILES
|
|
.Pp
|
|
.Pa Input format:
|
|
1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
|
|
.Pp
|
|
.Pa Output format:
|
|
host-or-namelist bits exponent modulus
|
|
.Pp
|
|
.Pa /etc/ssh_known_hosts
|
|
.Sh BUGS
|
|
It generates "Connection closed by remote host" messages on the consoles
|
|
of all the machines it scans.
|
|
This is because it opens a connection to the ssh port, reads the public
|
|
key, and drops the connection as soon as it gets the key.
|
|
.Sh SEE ALSO
|
|
.Xr ssh 1
|
|
.Xr sshd 8
|
|
.Sh AUTHOR
|
|
David Mazieres <dm@lcs.mit.edu>
|