Skip Menu |

This queue is for tickets about the Net-SSH-Perl CPAN distribution.

Report information
The Basics
Id: 42329
Status: open
Priority: 0/
Queue: Net-SSH-Perl

People
Owner: Nobody in particular
Requestors: XSAWYERX [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.33
Fixed in: (no value)



Subject: Received disconnect message: Bad packet length 167772160.
I tried to test Net::SSH::Perl connectivity with a oneliner: perl -MNet::SSH::Perl -le'$ssh = Net::SSH::Perl->new("localhost", port => "ssh", debug => 1); $ssh->login("sawyer", "xxxxx");' This was the output: gnubuntu: Reading configuration data /home/sawyer/.ssh/config gnubuntu: Reading configuration data /etc/ssh_config gnubuntu: Connecting to localhost, port 22. gnubuntu: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2 gnubuntu: Net::SSH::Perl Version 1.33, protocol version 2.0. gnubuntu: No compat match: OpenSSH_4.7p1 Debian-8ubuntu1.2. gnubuntu: Connection established. gnubuntu: Sent key-exchange init (KEXINIT), wait response. gnubuntu: Algorithms, c->s: 3des-cbc hmac-sha1 none gnubuntu: Algorithms, s->c: 3des-cbc hmac-sha1 none gnubuntu: Entering Diffie-Hellman Group 1 key exchange. gnubuntu: Sent DH public key, waiting for reply. Received disconnect message: Bad packet length 167772160. at /usr/local/share/perl/5.8.8/Net/SSH/Perl/Kex/DH1.pm line 41 The problem is that I used -l in perl. It took me a few days to notice something so minuscule that shouldn't effect anything, but apparently it does: sawyer@gnubuntu:~/tmp/Net-SSH-Perl-1.33/eg$ perl -MNet::SSH::Perl -e'$ssh = Net::SSH::Perl->new("localhost", port => "ssh", debug => 1); $ssh->login("sawyer", "xxxx");' gnubuntu: Reading configuration data /home/sawyer/.ssh/config gnubuntu: Reading configuration data /etc/ssh_config gnubuntu: Connecting to localhost, port 22. gnubuntu: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2 gnubuntu: Net::SSH::Perl Version 1.33, protocol version 2.0. gnubuntu: No compat match: OpenSSH_4.7p1 Debian-8ubuntu1.2. gnubuntu: Connection established. gnubuntu: Sent key-exchange init (KEXINIT), wait response. gnubuntu: Algorithms, c->s: 3des-cbc hmac-sha1 none gnubuntu: Algorithms, s->c: 3des-cbc hmac-sha1 none gnubuntu: Entering Diffie-Hellman Group 1 key exchange. gnubuntu: Sent DH public key, waiting for reply. gnubuntu: Received host key, type 'ssh-dss'. gnubuntu: Host 'localhost' is known and matches the host key. gnubuntu: Computing shared secret key. gnubuntu: Verifying server signature. gnubuntu: Waiting for NEWKEYS message. gnubuntu: Enabling incoming encryption/MAC/compression. gnubuntu: Send NEWKEYS, enable outgoing encryption/MAC/compression. gnubuntu: Sending request for user-authentication service. gnubuntu: Service accepted: ssh-userauth. gnubuntu: Trying empty user-authentication request. gnubuntu: Authentication methods that can continue: publickey,password. gnubuntu: Next method to try is publickey. gnubuntu: Publickey: testing agent key '/home/sawyer/.ssh/id_dsa' gnubuntu: Authentication methods that can continue: publickey,password. gnubuntu: Next method to try is publickey. gnubuntu: Trying pubkey authentication with key file '/home/sawyer/.ssh/id_dsa' gnubuntu: Will not query passphrase for '/home/sawyer/.ssh/id_dsa' in batch mode. gnubuntu: Loading private key failed. gnubuntu: Next method to try is password. gnubuntu: Trying password authentication. gnubuntu: Login completed, opening dummy shell channel. gnubuntu: channel 0: new [client-session] gnubuntu: Requesting channel_open for channel 0. gnubuntu: channel 0: open confirm rwindow 0 rmax 32768 gnubuntu: Got channel open confirmation, requesting shell. gnubuntu: Requesting service shell on channel 0. The problem is in Net::SSH::Perl::Key::DH1 in line 41 which states: $ssh->debug("Sent DH public key, waiting for reply."); $packet = Net::SSH::Perl::Packet->read_expect($ssh, SSH2_MSG_KEXDH_REPLY); When using perl -l, the expect didn't work as planned. The reason I flagged this as important is since a few other people had similar problems and it might be related. Don't really know what can be done about this, but maybe check the expect better.
The source of the problem is in Net/SSH/Perl.pm, at the end of the _exchange_identification function: the line print $sock $buf; should become syswrite $sock,$buf; so that it's not affected by changes in $\ Details of the problem: setting $\ to "\n", an extraneous 0x0a byte is sent between the identification string and the following packet, so that the length (uint32) of that packet is read as 0x0a000000 instead of 0x000000** (whatever the length is).
On Fri Jan 29 05:36:39 2010, DAKKAR wrote: Show quoted text
> The source of the problem is in Net/SSH/Perl.pm, at the end of the > _exchange_identification function: the line > > print $sock $buf; > > should become > > syswrite $sock,$buf;
Seems to work. Patch applied for upcoming release. https://github.com/renormalist/Net-SSH-Perl/commit/8f2c3a9f9f6dc75f020f5f2a2388ef8629b69b2a Kind regards, Steffen -- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>