Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-188

Session timeout doesn't call destroy() from InvertedShell

    XMLWordPrintableJSON

Details

    Description

      When creating the ssh server I have this:

      sshd.setShellFactory(new PseudoTerminalFactory("/system/bin/sh", "-i"));

      The PseudoTerminalFactory has this:

      @Override
      public Command create()

      { return new InvertedShellWrapper(new PseudoTerminal()); }

      And the "PseudoTerminal implements InvertedShell" contains the following
      functions:

      destroy()
      exitValue()
      getErrorStream()
      getInputStream()
      getOutputStream()
      isAlive()
      start(Map<String, String> env)

      Now here is the thing, when a session is created and the user:

      • closes it
      • or the server is stopped
        The destroy and exitValue functions are being called. In the destroy
        function we stop the shell process (which is started in the start function).

      However, if a user has a shell connection and doesn't do anything, default
      after 10 minutes the idletimeout will have passed and the user gets a
      timeout error and gets disconnected. HOWEVER, after that the destroy and
      exitValue are never called, so the isAlive function will continue being
      called (always returns true till the destroy function is called) and we
      will have an endless running thread.
      Next time we start the server we get an error the port is in use, etc. And
      all the time the checking of isAlive of that session will just continue.

      Attachments

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              maarten1 Maarten Smit
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: