briandfoy / net-ssh-perl

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

Can't call method "ssh_name" on an undefined value at .../Net/SSH/Perl/Kex/DHGEX.pm line 73 #61

Open briandfoy opened 1 year ago

briandfoy commented 1 year ago

This ticket was imported from rt.cpan.org 140090

Trying to SSH via pub/private key combo to one of my servers. The exact same code works for other servers. "Regular" ssh works like a charm.

Here is the debug output including the two debug lines I added to DHGEX.pm here:

my $host_key_blob = $packet->get_str;
my $s_host_key = Net::SSH::Perl::Key->new_from_blob($host_key_blob,
$ssh->{datafellows});
use Data::Dumper;
print STDERR Dumper($host_key_blob, $ssh->{datafellows});
$ssh->debug("Received host key, type '" . $s_host_key->ssh_name . "'.");

Here is the debug output (I edited the hostnames out):

mylocalbox: Reading configuration data /root/.ssh/config
mylocalbox: Reading configuration data /etc/ssh_config
mylocalbox: Allocated local port 1022.
mylocalbox: Connecting to myserver.com, port 19890.
mylocalbox: Remote version string: SSH-2.0-OpenSSH_6.2
mylocalbox: Remote protocol version 2.0, remote software version OpenSSH_6.2
mylocalbox: Net::SSH::Perl Version 2.14, protocol version 2.0.
mylocalbox: No compat match: OpenSSH_6.2.
mylocalbox: Connection established.
mylocalbox: Sent key-exchange init (KEXINIT), waiting for response.
mylocalbox: Using diffie-hellman-group-exchange-sha256 for key exchange
mylocalbox: Host key algorithm: ecdsa-sha2-nistp256
mylocalbox: Algorithms, c->s: aes256-ctr hmac-sha2-512-etm@openssh.com none
mylocalbox: Algorithms, s->c: aes256-ctr hmac-sha2-512-etm@openssh.com none
mylocalbox: Entering Diffie-Hellman Group Exchange.
mylocalbox: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<4096<8192) sent
mylocalbox: Sent DH Group Exchange request, waiting for reply.
mylocalbox: Received 4096 bit DH Group Exchange reply.
mylocalbox: Generating new Diffie-Hellman keys.
mylocalbox: Entering Diffie-Hellman key exchange.
mylocalbox: Sent DH public key, waiting for reply.
$VAR1 = 'ecdsa-sha2-nistp25nistp256A����%��7�8�$�A~������w���Wx�z����3|K@y�v�ā�>Z��j+�a^H����';
$VAR2 = 0;
Can't call method "ssh_name" on an undefined value at /usr/lib64/perl5/vendor_perl/Net/SSH/Perl/Kex/DHGEX.pm line 75.

(it's now line 75 as I added the above two lines)

[root@8 auto_cert_renewal]# rpm -qa | grep ssh -i | grep -i perl
perl-Net-SSH-Perl-2.14-8.fc32.x86_64
perl-Net-SSH-0.09-31.fc32.noarch
[root@8 auto_cert_renewal]#

OpenSSH on the other end is rather old:

[root@myserver ~]# rpm -qa | grep openssh
openssh-server-6.2p2-8.fc19.x86_64
openssh-6.2p2-8.fc19.x86_64
openssh-clients-6.2p2-8.fc19.x86_64
[root@myserver ~]#

Unfortunately at this point I can not upgrade it (long story).

Any/all suggestions would be appreciated. Thanks! PS Reported the same on github account, but there does not seem to be any activity there..

briandfoy commented 1 year ago

From cpan_user@bjovanovic.com

For posterity: It seems Net::SSH::Perl does not support ECDSA at all. It does not even say that, it just dies.

Either way - my solution was simple - since ECDSA is insecure by now, and old ssh does not support ed22519, was to move back to using RSA4096.

briandfoy commented 1 year ago

May be related to #58