lkinley / Net-SSH-Perl

Development on the Net::SSH::Perl module to support latest ciphers, key exchange mechanisms, etc.
Other
14 stars 9 forks source link

problem with default cipher and openssh 7.1p1 #2

Closed asy972 closed 8 years ago

asy972 commented 8 years ago

Hello.

I attempt to use Net-SSH-Perl with openssh server 7.1p1 and have a problem. The test script:

use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new("localhost");
$ssh->login("test", "qqq");
print "--------\n";

The output:

$perl -w sshtest.pl
Use of uninitialized value $authlen in addition (+) at /usr/share/perl5/Net/SSH/Perl/Packet.pm line 198.
Use of uninitialized value $authlen in addition (+) at /usr/share/perl5/Net/SSH/Perl/Packet.pm line 198.
Argument "M-NM-i3[M-oMM-"lqM-^I\n[M+M-2LeEa<Y^^M-^Ux(^S!M-^SM-`M-^N..." isn't numeric in numeric eq (==) at /usr/share/perl5/Net/SSH/Perl/Key/Ed25519.pm line 260, <$fh> line 1.
Argument "M-NM-i3[M-oMM-"lqM-^I\n[M+M-2LeEa<Y^^M-^Ux(^S!M-^SM-`M-^N..." isn't numeric in numeric eq (==) at /usr/share/perl5/Net/SSH/Perl/Key/Ed25519.pm line 260, <$fh> line 1.
Use of uninitialized value $authlen in addition (+) at /usr/share/perl5/Net/SSH/Perl/Packet.pm line 198.
Use of uninitialized value in subroutine entry at /usr/share/perl5/Net/SSH/Perl/Cipher/ChachaPoly.pm line 51.
Use of uninitialized value in subroutine entry at /usr/share/perl5/Net/SSH/Perl/Cipher/ChachaPoly.pm line 58.
Connection closed by remote host. at /usr/share/perl5/Net/SSH/Perl/AuthMgr.pm line 45.

The log of ssh server:

Feb 22 22:51:13 sshd[7284]: Bad packet length 1802109513. [preauth]
Feb 22 22:51:13 sshd[7284]: padding error: need 1802109513 block 8 mod 1 [preauth]
Feb 22 22:51:13 sshd[7284]: fatal: ssh_dispatch_run_fatal: Connection to 127.0.0.1: message authentication code in

It works when I use (for example): my $ssh = Net::SSH::Perl->new("localhost", cipher => 'aes256-ctr');

btw: warning remains in Ed25519.pm

lkinley commented 8 years ago

Can you please add the debug flag: my $ssh = Net::SSH::Perl->new("localhost", debug => 1);

And send me the entire output. Thanks!

asy972 commented 8 years ago
localhost: Reading configuration data /home/test/.ssh/config
localhost: Reading configuration data /etc/ssh_config
localhost: Allocated local port 1023.
localhost: Connecting to localhost, port 22.
localhost: Remote version string: SSH-2.0-OpenSSH_7.1
localhost: Remote protocol version 2.0, remote software version OpenSSH_7.1
localhost: Net::SSH::Perl Version 2.01, protocol version 2.0.
localhost: No compat match: OpenSSH_7.1.
localhost: Connection established.
localhost: Sent key-exchange init (KEXINIT), wait response.
localhost: Using curve25519-sha256@libssh.org for key exchange
localhost: Host key algorithm: ssh-ed25519
localhost: Algorithms, c->s: chacha20-poly1305@openssh.com <implicit> none
localhost: Algorithms, s->c: chacha20-poly1305@openssh.com <implicit> none
localhost: Generating ephemeral key pair.
localhost: Entering Curve 25519 Key Exchange.
localhost: Sent client public key, waiting for reply.
localhost: Received host key, type 'ssh-ed25519'.
localhost: Host 'localhost' is known and matches the host key.
localhost: Verifying server signature.
localhost: Send NEWKEYS.
localhost: Waiting for NEWKEYS message.
localhost: Enabling encryption/MAC/compression.
localhost: Sending request for user-authentication service.
Connection closed by remote host. at /usr/share/perl5/Net/SSH/Perl/AuthMgr.pm line 45.
lkinley commented 8 years ago

I fixed the warnings and a bug in Ed25519, but was not able to duplicate your problem against a 7.1 server even before the fix. Try the latest commit and report back.

asy972 commented 8 years ago

I fixed the warnings

one warning remains (in case with empty known_hosts):

localhost: Permanently added 'localhost' to the list of known hosts.
Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/Net/SSH/Perl/Key/Ed25519.pm line 229.

Try the latest commit and report back.

I tried another architecture. It is i586-only bug again. All works when Net::SSH::Perl is running on x86_64.

lkinley commented 8 years ago

What 32-bit OS and which version is this failing on?

asy972 commented 8 years ago

ALT Linux Sisyphus in both cases (x86_64 ok, i586 fail).

lkinley commented 8 years ago

Ok, I think I've got it fixed. Pull latest and try again.

asy972 commented 8 years ago

Thanks, it works now.