lkinley / net-ssh-perl Goto Github PK
View Code? Open in Web Editor NEWDevelopment on the Net::SSH::Perl module to support latest ciphers, key exchange mechanisms, etc.
License: Other
Development on the Net::SSH::Perl module to support latest ciphers, key exchange mechanisms, etc.
License: Other
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 [email protected] none
mylocalbox: Algorithms, s->c: aes256-ctr [email protected] 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!
Net::SSH::Perl seems to ignore "ConnectTimeout" and proceeds to hang for a while.
This makes it tricky to use with a batch of servers (When one stops responding)
E.g:
my $ssh = Net::SSH::Perl->new($_, options => [
"Compression $UseCompression",
"Port $port",
"IdentityFile $IdentityFile",
"BatchMode yes",
"ConnectTimeout=5"]);
Is this likely to be something that can easily be resolved?
I'm using the simple code from the example connect to network firewall.
$ssh = Net::SSH::Perl->new($hostname);
$ssh->login($username,$password);
And login is Ok.
But ($stdout, $stderr, $exit) = $ssh->cmd('show ver') Hangs in the terminal for a long time while timeout.
At the same time interactive $ssh->shell works great.
And I can see shell prompt: username@MA-3054-SM-LLK>
A think the problem is in a special prompt.
On UNIX system server I have not get a problem.
Can I specify other type of prompt in my perl script to resolve this problem?
Hi ,
I am facing below issue while connecting to nonstop m/c from windows , Please suggest
sm1win10: Reading configuration data C:\Users\Administrator/.ssh/config
sm1win10: Reading configuration data /etc/ssh_config
sm1win10: Remote protocol version 2.0, remote software version 1.37f sshlib:
Digest::MD5 object version 2.36_01 does not match bootstrap parameter 2.33 at C:/Perl/lib/DynaLoader.pm line 252, line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Key.pm line 6, line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Key.pm line 6, line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Kex/DH1.pm line 9, line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Kex/DH1.pm line 9, line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Kex.pm line 6, line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Kex.pm line 6, line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 6, line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 6, line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl.pm line 51, line 1.
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 !!
Is there a method in the module to check for a port under service instead of exiting ?
Regards Rolf
This is a "proxy ticket" for RT-117272 and similar tickets.
Essentially the problem is that
t/05-cipher.t
fails when Crypt::OpenSSH::ChachaPoly
is already installed before with an error like
The key must be 128 or 256 bits long at .../Net/SSH/Perl/Cipher/ChachaPoly.pm line 36.
All participants from
https://rt.cpan.org/Ticket/Display.html?id=117272
https://rt.cpan.org/Ticket/Display.html?id=115382
https://rt.cpan.org/Ticket/Display.html?id=115669
https://rt.cpan.org/Ticket/Display.html?id=114077
are invited to contribute here.
When using the Net::SSH::Perl::Agent class instantiated with the version 2, and try to obtain a key with first_identy (or next_identity), I get this error:
Can't locate object method "new_from_blob" via package "Net::SSH::Perl::Key" (perhaps you forgot to load "Net::SSH::Perl::Key"?) at /home/loic/desarrollo/project_name/local/lib/perl5/x86_64-linux/Net/SSH/Perl/Agent.pm line 117.
If I load the Net::SSH::Perl::Key class prior to invoking the method, this does not occur. Indeed, if one looks at the line 117 of the Agent class, and checks what packages are being loaded, we can see that Net::SSH::Perl::Key isn't one of them.
Perhaps, just a "use Net::SSH::Perl::Key" at the beggining of the file may fix this problem. If it is a problem, and I'm just not using correctly the library as it was intended.
Kind regards, and thank you for your great work on the library :)
Please see the attached file. I am not understanding why I see these warning on a percentage of hosts that I am connecting to. Any feedback would be appreciated.
error:
Can't locate object method "exchange" via package "Net::SSH::Perl::Kex::C25519" at /usr/local/lib64/perl5/Net/SSH/Perl/Kex.pm line 107. when making the ssh object.
was related to : https://stackoverflow.com/a/45838302/11496568
A hack to get job done -
The way I resolved it was the following -
I went to mathcalls-narrow.h
/usr/include/x86_64-linux-gnu/bits$ vi mathcalls-narrow.h
and I commented out the following line -
__MATHCALL_NARROW (__MATHCALL_NAME (mul), __MATHCALL_REDIR_NAME (mul), 2)
It appears that Net::SSH::Perl::Util::SSH2MP was removed around version 2.01 -> 2.02. Which causes the following error in Net::SFTP v0.10:
Undefined subroutine &Net::SFTP::Buffer::bin2mp called at /usr/local/lib/perl5/site_perl/5.18.0/Net/SFTP/Buffer.pm line 19.
The bin2mp function was imported into Net::SFTP::Buffer via:
use Net::SSH::Perl::Util qw( :ssh2mp );
But now it's gone from Net::SSH::Perl::Util.
So the question is why was lib/Net/SSH/Perl/Util/SSH2MP.pm removed?
Could you rebase this to 1.42? It looks like this (awesome) work is based on 1.38
I see this repo has version 2.07, but on CPAN it is still 2.01 now https://metacpan.org/pod/Net::SSH::Perl
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
It's great that it is somewhat standalone SSH to work with a lot of servers and so on,
but does this module supports ProxyCommand in config file? (I suppose no).
Is it too complicated to appear / never will be supported (so switch to another module?)?
I'm taking up the maintenance of Net::SSH::Perl, and I'm collecting all the issues into https://github.com/briandfoy/net-ssh-perl. I'd like to transfer all the issues in this repo to that repo.
For that, whoever does the transfer needs to have write access to both repos. I've invited you (@lkinley) to my repo, which means that you could accept that and transfer the issues yourself. Alternately, you could invite me to your repo and I could save you the work by doing it myself. Whatever works for you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.