Unable to fulfill channel request in Net\SSH2.php

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

Unable to fulfill channel request in Net\SSH2.php

Postby hwidjaja » Wed Nov 20, 2013 2:50 am

Hello all ...

When connecting to HP iLO (SSH), some of them are working perfectly but some of them throwing this error message:

Code: Select all
PHP Notice: Unable to fulfill channel request in C:\inetpub\wwwroot\lib\phpseclib\Net\SSH2.php on line 2635


It seems like the login process is okay but it fails during exec(). Does anyone know why?

Here is the LOG:
Code: Select all
-> NET_SSH2_MSG_SERVICE_REQUEST (since last: 0.0166, network: 0s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ....ssh-userauth

<- NET_SSH2_MSG_SERVICE_ACCEPT (since last: 0.1788, network: 0.1786s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ....ssh-userauth

-> NET_SSH2_MSG_USERAUTH_REQUEST (since last: 0.0004, network: 0.0001s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  2....username...
00000010  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  .ssh-connection.
00000020  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ...password.....
00000030  00:00:00:00:00:00:00:00                          password

<- NET_SSH2_MSG_USERAUTH_SUCCESS (since last: 0.0261, network: 0.0258s)


-> NET_SSH2_MSG_CHANNEL_OPEN (since last: 0.0012, network: 0.0001s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ....session.....
00000010  00:00:00:00:00:00:00                             .....@.

<- NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION (since last: 0.0082, network: 0.008s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ................

-> NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0004, network: 0.0001s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ........exec....
00000010  00:00:00:00:00:00:00:00:00:00:00:00:00:00        .show /system1

<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0083, network: 0.0079s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00  ........show /sy
00000010  00:00:00:00:00:00                                stem1.

-> NET_SSH2_MSG_DISCONNECT (since last: 0.0059, network: 0.0001s)
00000000  00:00:00:00:00:00:00:00:00:00:00:00              ............
hwidjaja
Traveler
 
Posts: 2
Joined: Wed Nov 20, 2013 2:17 am

Re: Unable to fulfill channel request in Net\SSH2.php

Postby TerraFrost » Wed Nov 20, 2013 7:59 pm

The server is supposed to respond with an SSH_MSG_CHANNEL_SUCESS message - not a SSH_MSG_CHANNEL_DATA message. ie.

Code: Select all
-> NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0031, network: 0.0001s)
00000000  00:00:00:00:00:00:00:04:65:78:65:63:01:00:00:00  ........exec....
00000010  03:70:77:64                                      .pwd

<- NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST (since last: 0.0387, network: 0.0351s)
00000000  00:00:00:00:00:20:00:00                          ..... ..

<- NET_SSH2_MSG_CHANNEL_SUCCESS (since last: 0.002, network: 0.0001s)
00000000  00:00:00:00                                      ....

<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0026, network: 0.0008s)
00000000  00:00:00:00:00:00:00:11:2f:68:6f:6d:65:2f:6a:77  ......../home/jw
00000010  69:67:67:69:6e:74:6f:6e:0a                       igginton.


Here's what the spec says:

Code: Select all
   All channel-specific requests use the following format.

      byte      SSH_MSG_CHANNEL_REQUEST
      uint32    recipient channel
      string    request type in US-ASCII characters only
      boolean   want reply
      ....      type-specific data follows

   If 'want reply' is FALSE, no response will be sent to the request.
   Otherwise, the recipient responds with either
   SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, or request-specific
   continuation messages.  If the request is not recognized or is not
   supported for the channel, SSH_MSG_CHANNEL_FAILURE is returned.

I don't know if SSH_MSG_CHANNEL_DATA could be a request-specific continuation message at this point or not.

Certainly I can make it take SSH_MSG_CHANNEL_DATA packets but before I do that could you do me a favor and test it on PuTTY? And by testing in PuTTY I mean typing in a command in the Connection->SSH dialog before you actually connect to the server. eg.

Image
Thanks!
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am

Re: Unable to fulfill channel request in Net\SSH2.php

Postby hwidjaja » Thu Nov 21, 2013 2:39 am

Here is the putty log:
Code: Select all
Outgoing packet type 98 / 0x62 (SSH2_MSG_CHANNEL_REQUEST)
  00000000  00 00 00 00 00 00 00 04 65 78 65 63 01 00 00 00  ........exec....
  00000010  0c 73 68 6f 77 20 73 79 73 74 65 6d 31           .show system1
Incoming packet type 99 / 0x63 (SSH2_MSG_CHANNEL_SUCCESS)
  00000000  00 00 01 00                                      ....
Event Log: Started a shell/command
Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA)
  00000000  00 00 01 00 00 00 00 0d 73 68 6f 77 20 73 79 73  ........show sys
  00000010  74 65 6d 31 0d                                   tem1.
Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA)
  00000000  00 00 01 00 00 00 00 02 0d 0a                    ..........
Incoming packet type 94 / 0x5e (SSH2_MSG_CHANNEL_DATA)
  00000000  00 00 01 00 00 00 00 28 73 74 61 74 75 73 3d 30  .......(status=0
  00000010  0d 0a 73 74 61 74 75 73 5f 74 61 67 3d 43 4f 4d  ..status_tag=COM
  00000020  4d 41 4e 44 20 43 4f 4d 50 4c 45 54 45 44 0d 0a  MAND COMPLETED..


But strangely on one of my iLO hosts, I can exec a command without parameter (eg 'show', 'version') but I can't get the result when it has parameter (eg. 'show /system1'). I can run both commands on some other iLO hosts ('show' and 'show /system1').

When I exec 'show' command:

Code: Select all
-> NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0004, network: 0.0001s)
00000000  00:00:00:00:00:00:00:04:65:78:65:63:01:00:00:00  ........exec....
00000010  04:73:68:6f:77                                   .show

<- NET_SSH2_MSG_CHANNEL_SUCCESS (since last: 0.0105, network: 0.0103s)
00000000  00:00:00:00                                      ....

<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.2065, network: 0.2061s)
00000000  00:00:00:00:00:00:00:05:73:68:6f:77:0d           ........show.

<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0005, network: 0.0001s)
00000000  00:00:00:00:00:00:00:a1:0d:0a:73:74:61:74:75:73  ..........status
00000010  3d:30:0d:0a:73:74:61:74:75:73:5f:74:61:67:3d:43  =0..status_tag=C
00000020  4f:4d:4d:41:4e:44:20:43:4f:4d:50:4c:45:54:45:44  OMMAND COMPLETED
00000030  0d:0a:54:68:75:20:4e:6f:76:20:32:31:20:30:31:3a  ..Thu Nov 21 01:
00000040  35:32:3a:31:36:20:32:30:31:33:0a:0d:0a:0d:0a:0d  52:16 2013......
00000050  0a:2f:0d:0a:20:20:54:61:72:67:65:74:73:0d:0a:20  ./..  Targets..
00000060  20:20:20:73:79:73:74:65:6d:31:0d:0a:20:20:20:20     system1..
00000070  6d:61:70:31:0d:0a:20:20:50:72:6f:70:65:72:74:69  map1..  Properti
00000080  65:73:0d:0a:20:20:56:65:72:62:73:0d:0a:20:20:20  es..  Verbs..
00000090  20:63:64:20:76:65:72:73:69:6f:6e:20:65:78:69:74   cd version exit
000000a0  20:73:68:6f:77:0d:0a:0d:0a                        show....



When I run 'show /system1':
Code: Select all
-> NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0004, network: 0s)
00000000  00:00:00:00:00:00:00:04:65:78:65:63:01:00:00:00  ........exec....
00000010  0d:73:68:6f:77:20:2f:73:79:73:74:65:6d:31        .show /system1

<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0105, network: 0.0103s)
00000000  00:00:00:00:00:00:00:0e:73:68:6f:77:20:2f:73:79  ........show /sy
00000010  73:74:65:6d:31:0d                                stem1.

-> NET_SSH2_MSG_DISCONNECT (since last: 0.0053, network: 0.0001s)
00000000  00:00:00:0b:00:00:00:00:00:00:00:00              ............


Thanks for looking at this ...
hwidjaja
Traveler
 
Posts: 2
Joined: Wed Nov 20, 2013 2:17 am

Re: Unable to fulfill channel request in Net\SSH2.php

Postby TerraFrost » Thu Nov 21, 2013 9:16 pm

It looks like the logs your posting are truncated. I'm also a bit curious as to the server identification string, for example. And in the case of PuTTY I'm curious how PuTTY closed the connection. Did it error out or close it normally?

Anyway, I think the following commit (on a new branch) might fix the issue for you:

https://github.com/terrafrost/phpseclib ... dc6bf9eafd

If you could test to make sure and if you could answer the other questions too that'd be great.

Thanks!
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am


Return to phpseclib support

Who is online

Users browsing this forum: No registered users and 3 guests

cron