EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElSSHRemotePortForwarding example dynamic port assignment

Posted: 12/01/2011 20:13:58
by Fred Stephens (Basic support level)
Joined: 12/01/2011
Posts: 2

In trying out the TElSSHRemotePortForwarding example it appears to work fairly well.

I am having a hard time understanding how you determine the listen port that is dynamically assigned by the server when you use a value of zero for ForwardedPort.

The server is reporting in it's logs that the port has been dynamically assigned and that it is listening. The RFC for SSH specifically documents how you get the dynamically assigned port number back.
Posted: 12/02/2011 03:09:17
by Ken Ivanov (Team)

Thank you for getting in touch with us.

Please use the BoundPort property of the Forwarding component to get the number of the port dynamically assigned on server side.
Posted: 12/02/2011 11:47:24
by Fred Stephens (Basic support level)
Joined: 12/01/2011
Posts: 2

Yes I read the documentation and found that value.

The problem is that there is no event that notifies you when the BoundPort property value is valid. If you check inside of the forwarding_OnOpen event it still has a zero value.

Ok so I threw in a work around of starting a timer.

I then dragged a timer from the standard windows component toolbox on to the form and created a tick event handler with a time period of one second. Which I then enabled inside of the forwarding_OpOpen event, something is very weird as this event never fires! This is a timer type of System.Windows.Forms.Timer.

I then added another timer of System.Timers.Timer to trigger inside of the forwarding_OnOpen event, along with a form button to enable the Forms.Timer object.

When my timers.timer object fires the BoundPort value is the correct port as reported by the SSH server.

In playing around with the example a timer type of Forms.Timer will never fire after an initial SSH connection has been made, even if it is shutdown!

Further Edit:

Dynamically assigned ports do not work! The port is reported correctly and opened by the server how ever it never gets reported as opened in your component or forwards any traffic. Hard assigned ports do work.
Posted: 12/05/2011 06:09:03
by Ken Ivanov (Team)

1) We've conducted some investigations and found out that dynamic-port remote forwarding functionality had been broken in one of the latest builds (I should stress that only applications which use *remote port forwarding* AND *request a dynamically assigned remote port number* are affected). We are working on the fix at the moment. The fix will be available in the future SecureBlackbox build update.

2) OnOpen fires right after SSH transport connection has been negotiated, and only reports that mutual authentication has succeeded and the component is ready to proceed to further steps of the communication (tunnel(s) set up). Please use OnTunnelOpen event to track the moment when the tunnel is ready. The real port number value is assigned to the BoundPort property by that moment.



Topic viewed 926 times

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


Back to top

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

Got it!