ssh & pipe

John Dunlap dunlap at apl.washington.edu
Sat Jun 16 09:40:32 EST 2001


> 
> On Fri, 15 Jun 2001, Markus Friedl wrote:
> 
> > do you have a ssh -v -v -v output  for your test case?
> 
> Yes; attached is the output from running
> 
>   ./ssh -1 -n -x -v -v -v fields 'yes | head -2000' | ( sleep 3 ; wc -l )
> 
> However, the additions you mentioned from the OpenBSD current CVS do fix
> the problem (without having to remove the set_nonblock lines); thanks!
> 

My experience had been only with protocol 2 which works fine in all
the tests below.  I see errors only using protocol 1 and then only
when using head -20000.

I am able to reliably see the failure using stock 2.9p1 when the
client is slow (RHL6.2, P1/166) and the server is fast (RHL7.1,
P3/933) the number of lines is greater than 2048.  Using publickey auth
with agent will fail when the client is fast and the server is slow
but works using password auth.

# this works with both password and publickey auth with agent
slow $ ssh -1 -n -x fast 'yes | head  -2000' | ( sleep 3 ; wc -l )

# this fails with both password auth and publickey with agent
slow $ ssh -1 -n -x fast 'yes | head -20000' | ( sleep 3 ; wc -l )

# this works if using password auth but not if publickey with agent
fast $ ssh -1 -n -x slow 'yes | head -20000' | ( sleep 3 ; wc -l )

The debugging outputs are below.
henry is fast.
fluke is slow.

-- John

--------------------- cut here -------------------------------------
henry # (ssh -1 -n -x -v -v -v fluke 'yes | head -20000' | ( sleep 3 ; wc -l ) ) 1>h1 2>&1
henry # cat h1
--------------------- cut here -------------------------------------
OpenSSH_2.9p1, SSH protocols 1.5/2.0, OpenSSL 0x0090600f
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Applying options for *
debug1: Seeding random number generator
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 0 geteuid 0 anon 1
debug1: Connecting to fluke [128.95.96.98] port 22.
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: identity file /root/.ssh/identity type 0
debug1: Remote protocol version 1.99, remote software version OpenSSH_2.9p1
debug1: match: OpenSSH_2.9p1 pat ^OpenSSH
debug1: Local version string SSH-1.5-OpenSSH_2.9p1
debug1: Waiting for server public key.
debug1: Received server public key (768 bits) and host key (1024 bits).
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host 'fluke' is known and matches the RSA1 host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: Encryption type: 3des
debug1: Sent encrypted session key.
debug1: Installing crc compensation attack detector.
debug1: Received encrypted confirmation.
debug1: Trying RSA authentication via agent with 'dunlap at henry.apl.washington.edu'
debug1: Server refused our key.
debug1: Trying RSA authentication via agent with 'root at henry.apl.washington.edu'
debug1: Received RSA challenge from server.
debug1: Sending response to RSA challenge.
debug1: Remote: RSA authentication accepted.
debug1: RSA authentication accepted by server.
debug3: clear hostkey 0
debug3: clear hostkey 1
debug3: clear hostkey 2
debug1: Sending command: yes |head -20000
debug1: Entering interactive session.
debug1: fd 1 setting O_NONBLOCK
debug1: fd 2 setting O_NONBLOCK
debug1: Sending eof.
Write failed flushing stdout buffer.
debug1: Transferred: stdin 0, stdout 4096, stderr 0 bytes in 0.2 seconds
debug1: Bytes per second: stdin 0.0, stdout 21395.0, stderr 0.0
debug1: Exit status 0
   2048
--------------------- cut here -------------------------------------
fluke # ( ssh -1 -n -x -v -v -v henry 'yes | head -20000' | ( sleep 3 ; wc -l ) ) > f1 2>&1
fluke # cat f1
OpenSSH_2.9p1, SSH protocols 1.5/2.0, OpenSSL 0x0090581f
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Applying options for henry
debug1: Applying options for *
debug1: Seeding random number generator
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 0 geteuid 0 anon 1
debug1: Connecting to henry [128.95.96.159] port 22.
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: identity file /root/.ssh/identity type 0
debug1: Remote protocol version 1.99, remote software version OpenSSH_2.9p1
debug1: match: OpenSSH_2.9p1 pat ^OpenSSH
debug1: Local version string SSH-1.5-OpenSSH_2.9p1
debug1: Waiting for server public key.
debug1: Received server public key (768 bits) and host key (1024 bits).
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 5
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 5
debug1: Host 'henry' is known and matches the RSA1 host key.
debug1: Found key in /root/.ssh/known_hosts:5
debug1: Encryption type: 3des
debug1: Sent encrypted session key.
debug1: Installing crc compensation attack detector.
debug1: Received encrypted confirmation.
debug1: Trying RSA authentication via agent with 'root at fluke.apl.washington.edu'
debug1: Received RSA challenge from server.
debug1: Sending response to RSA challenge.
debug1: Remote: RSA authentication accepted.
debug1: RSA authentication accepted by server.
debug3: clear hostkey 0
debug3: clear hostkey 1
debug3: clear hostkey 2
debug1: Requesting authentication agent forwarding.
debug1: Sending command: yes | head -20000
debug1: Entering interactive session.
debug1: fd 1 setting O_NONBLOCK
debug1: fd 2 setting O_NONBLOCK
debug1: Sending eof.
Write failed flushing stdout buffer.
debug1: Transferred: stdin 0, stdout 4096, stderr 0 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 46880.0, stderr 0.0
debug1: Exit status 0
   2048
--------------------- cut here -------------------------------------





More information about the openssh-unix-dev mailing list