Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3656

SSH message channel closed too early

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.3, 2.4.1, 2.3.10, 4.0.0.M2
    • Fix Version/s: 2.4.2, 3.0.4, 2.3.12, 4.0.0.M3
    • Component/s: karaf
    • Labels:
      None

      Description

      Using SSH exec with Karaf 2.3.10 SSH_MSG_CHANNEL_SUCCESS is sent after SSH_MSG_CHANNEL_CLOSE in the response.
      This causes problems when trying to use the Paramiko SSH client library as it will close the channel on receiving SSH_MSG_CHANNEL_CLOSE and considers it a failure if SSH_MSG_CHANNEL_SUCCESS was not received.

      reproduce.py
      #!/usr/bin/python
      import paramiko
      client = paramiko.SSHClient()
      client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
      client.load_system_host_keys()
      client.connect('localhost', port=8101, username="karaf", password="karaf")
      client.exec_command('help')
      # Throws SSHException "Channel closed." for affected versions.
      

      The reason SUCCESS and CLOSE come out of order seems to be that start in the ShellCommand class does not spawn a separate thread but calls the onExit callback from within the same thread, see SSHD-295 and the Apache MINA SSHD API.

        Attachments

          Activity

            People

            • Assignee:
              gnt Guillaume Nodet
              Reporter:
              peppe Jan-Peter Nilsson
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: