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.