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

No kex algorithm error with Net::SSH::Perl::Kex module #12

Closed krishnachaithanyabr closed 7 years ago

krishnachaithanyabr commented 7 years ago

Hi,

I'm getting the below error while use the kex exchange in the SSH2.pm file.

20170706 15:26:01 Command "/apps/tfs/automation/tfs_exec.sh ./get_dli_tfs_files BMO" on host XXXXX failed execution by the Autosys ssh wrapper. Return code from the command was 255.

STDOUT=msg: Create ssh connection object

msg: login to transfer server - ssh msg: list files from remote server

STDERR=Use of uninitialized value in concatenation (.) or string at ./get_dli_tfs_files line 121.

2017-07-06 15:26:01 Could not get ls of /Out/bmo Exit code=255 STDOUT= STDERR=No kex algorithm at /usr/local/share/perl5/Net/SSH/Perl/SSH2.pm line 92

Below is the SSH2.pm files entry at 92 line.

my $kex = Net::SSH::Perl::Kex->new($ssh); $kex->exchange;

All the jobs using this module are failing from past two weeks with the same error, which we are not able to figure whether its a OS issue or the perl module issue. Could you please help me in resolving this issue.

Many many thanks in advance !!

lkinley commented 7 years ago

"No kex algorithm" means that the Kex methods that the client is offering are not supported by the server. Since they cannot agree on an algorithm, the connection aborts.

This probably means that your server is old and only supports Kex algorithms that are not enabled by default in Net::SSH::Perl v2

Those algorithms are: diffie-hellman-group1-sha1 and diffie-hellman-group-exchange-sha1

Try using those. This can be done by passing the KexAlgorithms option:

my $ssh = Net::SSH::Perl->new($host, options => [ "KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1" ]);

You could also turn debug on and it will tell you what the client is offering and what the server supports when the connection aborts.

my $ssh = Net::SSH::Perl->new($host, debug => 1);

krishnachaithanyabr commented 7 years ago

Thank you for the reply. I will check with app team if they can use these algorithm in the script and if it works fine then will proceed in other machines.