EldoS | Feel safer!

Software components for data protection, secure storage and transfer

remote port forwarding

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#5279
Posted: 03/04/2008 14:24:03
by aljaz (Standard support level)
Joined: 01/10/2008
Posts: 18

Hello.

I am working with remote port forwarding. I would like that client, which connects to the server, forwards its port to server.

I am stuck with writing the server method OnServerForwardingRequest.
In Help says that:
Quote
This event is fired on client's request for server forwarding. If Accept parameter is set to True the server allows this forwarding and undertakes to:
a) open the Port for listening;
b) if some remote host connects to this port, call OpenServerForwarding method and pass this host coordinates (SrcHost, SrcPort) to it.


I set the parameter to true, but the method openServerForwarding is never called.

My Code:
Code
Private Sub OpenServerForwardingRequestHandler(ByVal sender As Object, ByVal address As String, ByVal port As Integer, ByRef accept As Boolean, ByRef realPort As Integer)
    realPort = port
    accept = True
End Sub


I am not sure if I understand how this thing is working - so please correct me if I'm wrong....
The client sends the request that it wants to forward its own port to the servers port. So the client uses TElSSHRemotePortForwarding - sets the parameters like in demo and opens the connection. After that server gets the request and accepted is set to true, the server should listen to the specific port. If somebody gets connected to the port on the server, openServerForwarding should be called.

I am working in .NET enviroment.

Thank you,
Aljaz
#5282
Posted: 03/05/2008 02:02:56
by Ken Ivanov (EldoS Corp.)

Sorry, I do not understand which port (on client or server side) you need to forward. Local forwarding (the listening port is opened on SSH client side) looks like the following:

[client] ---TCP--> [SSH client (listens)] ---Secure-channel--> [SSH server (connects)] ---TCP--> [server]

Remote port forwarding (the listening port is opened on SSH server side) has the following look:

[server] <--TCP--- [SSH client (connects)] <--Secure-channel--- [SSH server (listens)] <--TCP--- [client]

In the above schemas "client" and "server" are peers of some application-layer protocol (e.g., HTTP).
#5283
Posted: 03/05/2008 02:16:15
by aljaz (Standard support level)
Joined: 01/10/2008
Posts: 18

I have to open listening port on server side.

I am developing server and client application. For Client application I still use Blackbox demo (Remote port forwarding).
Server application accepts the client (authorization succeeds). But the port on the server is not opened because although I allow the server forwarding (on event OpenServerForwardingReque­st I set the variable accept to True) the server does not call the OpenServerForwarding method if I for example open the forwarded port 999 with mozilla firefox.
#5284
Posted: 03/05/2008 03:10:45
by Ken Ivanov (EldoS Corp.)

As TElSSHServer does not deal with network, it is *your* task to open the listening port. The whole sequence of actions is the following:
1. SSH session between client and server is established.
2. SSH client sends remote port forwarding request to SSH server. ElSSHServer triggers OnServerForwardingRequest in this case. The corresponding event handler has to do the following:
- set Accept parameter to true,
- open the listening port.
3. When another incoming connection is accepted on the listening port, you should call OpenServerForwarding() method to make ElSSHServer send the corresponding notification to SSH client.
4. When the logical tunnel is set up, ElSSHServer triggers OnOpenServerForwarding event, passing the corresponding tunnel connection object to it.
#5285
Posted: 03/05/2008 03:41:13
by aljaz (Standard support level)
Joined: 01/10/2008
Posts: 18

Exsist any sample code for these two events?
#5286
Posted: 03/05/2008 03:53:14
by Ken Ivanov (EldoS Corp.)

No, sorry. I've added the task of creating a server-side forwarding sample to the to do list.
#5289
Posted: 03/05/2008 13:13:34
by aljaz (Standard support level)
Joined: 01/10/2008
Posts: 18

Thank you.

With your help I was able to bring this thing to work - also thanks to your local port forwarding example.

The whole point is just how the socket is created... By remote port forwarding you have to open the tcp client to listen on the port and when the connection comes just pass the socket to local forwarding sample and woila.
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

Topic viewed 2393 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!