Bug 1869 - ssh-add can no longer read from FIFOs as of 5.7p1
Summary: ssh-add can no longer read from FIFOs as of 5.7p1
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-add (show other bugs)
Version: 5.8p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_9
  Show dependency treegraph
 
Reported: 2011-02-24 14:20 AEDT by Daniel Kahn Gillmor
Modified: 2011-09-06 15:33 AEST (History)
3 users (show)

See Also:


Attachments
allow ssh-add to read from FIFOs (836 bytes, patch)
2011-02-24 14:20 AEDT, Daniel Kahn Gillmor
no flags Details | Diff
allow ssh-add to read from FIFOs (834 bytes, patch)
2011-02-24 14:26 AEDT, Daniel Kahn Gillmor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Kahn Gillmor 2011-02-24 14:20:57 AEDT
Created attachment 2001 [details]
allow ssh-add to read from FIFOs

It looks like ssh-add can no longer read from FIFOs as of 5.7p1 (since the switch from PEM_read_PrivateKey() to PEM_read_bio_PrivateKey(), and reading the file into an ssh buffer directly).

Being able to read from a FIFO is nice for tools that don't want to put keys directly on the filesystem.  In fact, we were relying on that behavior for the monkeysphere, and it's currently breaking because of the change:

 https://labs.riseup.net/code/issues/2735

The attached patch fixes things so that ssh-add can read from a FIFO again.
Comment 1 Daniel Kahn Gillmor 2011-02-24 14:26:41 AEDT
Created attachment 2002 [details]
allow ssh-add to read from FIFOs

updated patch to use S_ISFIFO() instead of testing the st_mode bits directly (thanks, Clint Adams)
Comment 2 micah 2011-03-09 11:09:22 AEDT
I got bit by this change, and it took some time to figure out what caused it. Based on the commits, it doesn't appear as if removing the capability to read from a FIFO was deliberate, but rather was an unintended regression. 

I tried the attached patch and it restores the capability for me, I support its inclusion as soon as possible.
Comment 3 Jonatan Walck 2011-03-09 11:16:13 AEDT
I ran into the same bug using openssh-client 1:5.8p1-2 from debian sid repo, also reproduced with a vanilla openssh 5.8p1 from an official openssh mirror.

I found the error by using monkeysphere subkey-to-ssh-client, after which ssh-agent did not add a new identity as expected.

Tried the attached patch and it works as expected again, identity added and working for ssh. Would be great to see this patch included so FIFOs start working again.
Comment 4 Damien Miller 2011-05-06 10:56:16 AEST
This is fixed in -current in a different way and will be in OpenSSH 5.9. As a bonus, you can now "ssh-add - < /path/to/key"
Comment 5 Damien Miller 2011-09-06 15:33:07 AEST
close resolved bugs now that openssh-5.9 has been released