If I understand correctly, you are trying to make the server call the client and then create an SSH connection on top of the established TCP connection. This may be possible using the MINA SSHD library, but requires some more digging into the code. In any case, modifying the Nio2Acceptor to send rather wait for a connection seems the wrong way to go since it means reversing the logic of the class and anyone using it. A more promising approach might be to set up an Nio2Session where the server is the initiator and the client as the accpeptor and then somehow find a way to hand it off to the SSHD code on both sides (client + server) and tell them "OK I established the connection for you - now go ahead and set up the SSHD on top of this Nio2Session that I am giving you"...
This is how I would approach this issue ________________________________ From: Christian Siegert <[email protected]> Sent: Wednesday, October 19, 2016 7:54 PM To: [email protected] Subject: Re: TCP-Connection Hey, sorry for the late response, but I was away for nearly two weeks. I'm aware of how the SSH connection process is usually done, but I want to alter it to fit to an IETF draft. So basically what I want to do: 1. Server(Mina SSHD Implementation) connects to client via TCP 2. Client builds and initiates on top of the existing TCP connection (which was initiated by the Server) the SSH process with the Server On the client side is everything already implemented, but on the server side I have problems extending the Mina-SSHD library (maybe I don't even have to extend it, but can use already implemented methods) to fit in this scenario. So my first guess is, that I have to alter the Nio2Acceptor.java in a way that it doesn't listen for a connection request, but instead sends one itself. My problem is that the Mina SSHD SSH server implementation listens for the TCP and SSH connection. (Which is of course the right way, because there is the server and client implementation, but I have not found a way to alter them to my needs) For visualization purposes what I want to accomplish (Application layer unrelated): S C | <---- | Application (unrelated) | <---- | SSH (Mina SSHD SSH server implementation on serverside ) | -----> | TCP I hope it's clearer now what I mean. Sorry for the inconvenience and thanks in advance. Best Regards, Chris > On 10 Oct 2016, at 17:06, elijah baley <[email protected]> wrote: > > Please elaborate some more the use-case scenario - I am not sure I understand > what "enable the SSH-server to establish the TCP connection itself." means. > If you mean that the SSH server initiates the connection, then I am not sure > it is according to any RFC nor do I see the use-case for it - after all the > very word "server" means that it accepts connections and not initiates them... > > > ________________________________ > From: Christian Siegert <[email protected]> > Sent: Monday, October 10, 2016 6:37 AM > To: [email protected] > Subject: TCP-Connection > > Dear SSHD contributors and developers, > I hope this is the right mailing list to ask my question. > > My question is regarding the TCP connection process, which is underlying the > SSH-server in the library. I want to enable the SSH-server to establish the > TCP connection itself. > > Scenario: > 1. SSH server connects over TCP to the SSH client > 2. SSH client establishes the SSH connection (as usual) > > As you can see, just the first step of the SSH connection process is reversed. > > Can someone give me any pointers to how or where I can start on this topic? > My guess so far is, that I have to extend the "Nio2Connector.java". Is that > correct or am I completely off track? > > Any information would be really helpful. > Thanks in advance and keep up the great work. > > Best Regards, > Christian
