| Summary: | ssh-keygen not reading stdin as expected | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Lars Noodén <lars.nooden> |
| Component: | ssh-keygen | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | a, djm, dtucker, ssh-bugzilla, will |
| Priority: | P2 | ||
| Version: | 6.6p1 | ||
| Hardware: | All | ||
| OS: | Mac OS X | ||
| Bug Depends on: | |||
| Bug Blocks: | 2451 | ||
|
Description
Lars Noodén
2008-06-16 04:13:53 AEST
Try: ssh-keyscan -t rsa login.itd.umich.edu | ssh-keygen -l -f /dev/stdin The same behavior can be found on this platform and version: OpenBSD 4.3 GENERIC.MP#0 amd64 OpenSSH_5.0, OpenSSL 0.9.7j 04 May 2006 (Hmm. I can see that replies via e-mail seem not to get piped back into bugzilla here.)
Darren suggested a second way to produce the error:
ssh-keyscan -t rsa login.itd.umich.edu | ssh-keygen -l -f /dev/stdin
which gives the following error
/dev/stdin is not a public key file.
(Hmm. I can see that replies via e-mail seem not to get piped back into bugzilla here.)
Darren suggested a second way to produce the error:
ssh-keyscan -t rsa login.itd.umich.edu | ssh-keygen -l -f /dev/stdin
which gives the following error
/dev/stdin is not a public key file.
It seems to be present in OpenSSH 5.1
Hello. I too would really like to see ssh-keygen be able to properly read from stdin. It would make many of the tasks I have to do much much easier. The current situation where input needs to be written to an intermediate file is quite cumbersome. It actually appears that reading of /dev/stdin may be broken, as opposed to completely unsupported. It appears that ssh-keygen will read from a redirection of file, but not from a pipeline: servo:/tmp/cdtemp.laHoFb 0$ ssh-keygen -l -f id_rsa.pub 1024 23:ff:58:10:19:b6:5d:4f:c9:92:28:00:57:2c:5a:c8 id_rsa.pub (RSA) servo:/tmp/cdtemp.laHoFb 0$ ssh-keygen -l -f /dev/stdin <id_rsa.pub 1024 23:ff:58:10:19:b6:5d:4f:c9:92:28:00:57:2c:5a:c8 /dev/stdin (RSA) servo:/tmp/cdtemp.laHoFb 0$ cat id_rsa.pub | ssh-keygen -l -f /dev/stdin /dev/stdin is not a public key file. servo:/tmp/cdtemp.laHoFb 1$ I don't understand why it would be behaving this way. Thanks so much for such a great program. servo:/tmp/cdtemp.laHoFb 0$ ssh -V OpenSSH_5.1p1 Debian-3, OpenSSL 0.9.8g 19 Oct 2007 servo:/tmp/cdtemp.laHoFb 0$ This is still broken on Mac OS X, preventing me from writing portable scripts. Installed latest 6.6p1 and it's still broken, even though this bug seems very old. Works fine on my Linux systems:
will@x ~$ which ssh
/usr/local/bin/ssh
will@x ~$ ssh -V
OpenSSH_6.6p1, OpenSSL 1.0.1h 5 Jun 2014
will@x ~$ ssh-keyscan -t rsa login.itd.umich.edu | ssh-keygen -l -f /dev/stdin
# login.itd.umich.edu SSH-1.99-OpenSSH_5.2p1-hpn13v6
/dev/stdin is not a public key file.
will@x ~$ ssh-keygen -l -f <(ssh-keyscan -t rsa login.itd.umich.edu)
# login.itd.umich.edu SSH-1.99-OpenSSH_5.2p1-hpn13v6
/dev/fd/63 is not a public key file.
will@x ~$ uname -a
Darwin x.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
will@x ~$ sw_vers -productVersion
10.9.4
will@x ~$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: OS X 10.9.4 (13E28)
Kernel Version: Darwin 13.3.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: x
User Name: Will X (will)
Secure Virtual Memory: Enabled
Time since boot: 8 days 4:23
will@x ~$ which ssh-keygen
/usr/local/bin/ssh-keygen
will@x ~$
Temporary files are the only way on Mac.
fixed in: commit c56a255162c2166884539c0a1f7511575325b477 Author: djm@openbsd.org <djm@openbsd.org> Date: Mon Nov 16 22:53:07 2015 +0000 upstream commit Allow fingerprinting from standard input "ssh-keygen -lf -" Support fingerprinting multiple plain keys in a file and authorized_keys files too (bz#1319) ok markus@ Upstream-ID: 903f8b4502929d6ccf53509e4e07eae084574b77 closing resolved bugs as of 8.6p1 release |