php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57698 Calling ssh2_connect returns with an error in a situation where it should not.
Submitted: 2007-06-11 11:12 UTC Modified: 2012-10-06 09:16 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: cshaulis at bear dot com Assigned:
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 5.2.1 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cshaulis at bear dot com
New email:
PHP Version: OS:

 

 [2007-06-11 11:12 UTC] cshaulis at bear dot com
Description:
------------
Calling ssh2_connect returns with an error after connecting. This is similar to Bug #7814, however this is under Windows XP instead of Red Hat Linux. It may be necessary to use Windows to reproduce the problem. (I am using Apache/2.2.4 (Win32) PHP/5.2.3). I have tried PHP 5.2.1 also.

Reproduce code:
---------------
$con = ssh2_connect('pbptgemapp1', 22);
if (!$con) {
  print "Connection failed !";
}

To reproduce, connect to an SSH server from PHP under Windows. I can connect to the host mentioned above with other SSH clients without issue.

Expected result:
----------------
I expect to see no output and to have a valid handle in $con.


Actual result:
--------------
Warning: ssh2_connect() [function.ssh2-connect]: Error starting up SSH
connection(-5): Unable to exchange encryption keys in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ssh2.php on line 5

Warning: ssh2_connect() [function.ssh2-connect]: Unable to connect to
pbptgemapp1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ssh2.php on line 5 Connection failed !




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-11 16:00 UTC] pollita@php.net
Use ordinary telnet to connect to that server on port 22 and respond back with what's displayed.
 [2007-06-11 16:04 UTC] cshaulis at bear dot com
The server responded:

SSH-1.99-2.0.13 (non-commercial)
 [2009-05-08 01:10 UTC] steven dot crothers at gmail dot com
That test is reproducible with the pecl precompiled binary on the following OS's.

*Windows XP 32bit
*Windows XP 64bit
*Windows 2003 32bit
*Windows 2008 32bit
*Vista 32bit
*Vista 64bit
*Windows 7 Beta 64bit

The binary just tosses a non-descriptive error about not being able to connect. 

However I know that the network layer to and from the host is excellent.
 [2012-06-22 15:09 UTC] langemeijer@php.net
-Status: Open +Status: Feedback
 [2012-06-22 15:09 UTC] langemeijer@php.net
This bugreport is very old. Could you try a recent version (also a recent 
libssh2) and see if te problem is still there?
 [2012-10-06 09:16 UTC] langemeijer@php.net
-Status: Feedback +Status: No Feedback
 [2012-10-06 09:16 UTC] langemeijer@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2015-05-28 08:43 UTC] ricardoanribeiro at gmail dot com
Hi! I'm doing some coding with libssh2 to connect to Huawei routers. On some routers works fine, on others just echo this error: "Warning: ssh2_connect(): Error startingup SSH connection(-8): Unable to exchange encryption keys in (...)". I used putty on same routers and the sessions logs are identical:
2015-05-27 12:02:19	Server version: SSH-2.0-HUAWEI-1.5
2015-05-27 12:02:19	Using SSH protocol version 2
2015-05-27 12:02:19	We claim version: SSH-2.0-PuTTY_Release_0.63
2015-05-27 12:02:19	Doing Diffie-Hellman group exchange
2015-05-27 12:02:19	Doing Diffie-Hellman key exchange with hash SHA-1
2015-05-27 12:02:32	Host key fingerprint is:
2015-05-27 12:02:32	ssh-rsa 512 8a:07:9a:28:1d:4d:22:4c:18:35:4f:18:eb:ba:9e:b3
2015-05-27 12:02:32	Initialised AES-128 CBC client->server encryption
2015-05-27 12:02:32	Initialised HMAC-SHA1 client->server MAC algorithm
2015-05-27 12:02:32	Initialised AES-128 CBC server->client encryption
2015-05-27 12:02:32	Initialised HMAC-SHA1 server->client MAC algorithm

Can you help me?
Thanks!
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 21:01:23 2021 UTC