Random local port (General questions)
While defining tunnels, is it possible to not choose a local port, and have the wodtunnel randomly pick an unused port to bind to?
While defining tunnels, is it possible to not choose a local port, and have the wodtunnel randomly pick an unused port to bind to?
by Jasmine, (7512 days ago) @ Chad Amberg
Chad,
this already works. Set LocalPort to 0, and then in ChannelStart read it's value to see what port we assigned.
Regards.
by Chad Amberg , (7511 days ago) @ Jasmine
Chad,
this already works. Set LocalPort to 0, and then in ChannelStart read it's value to see what port we assigned.
Regards.
Sweet! This makes things a lot easier on my side!
by Chad Amberg, (6823 days ago) @ Chad Amberg
Chad,
this already works. Set LocalPort to 0, and then in ChannelStart read it's value to see what port we assigned.
Regards.
Sweet! This makes things a lot easier on my side!
by Chad Amberg, (6823 days ago) @ Chad Amberg
I'm starting a RemoteListen tunnel. And I need it to pick a random port on the remote side. Is there any way to tell what that remote port is chosen after the channel is connected? Essentially I'm adding the channel using a 0 for the RemotePort, but afterwards I need to know what port it is.
by woddrazen , (6823 days ago) @ Chad Amberg
Hi Chad,
Here is example which will show you what channel is started after you make RemoteListen Connection:
-------------------------
Dim i As Integer
For i = 0 To SSH_1.Channels.Count - 1
Debug.Print SSH_1.Channels(i).RemotePort & = & SSH_1.Channels(i).Activated
Next i
-------------------------
Hope I helped.
Regards,
Drazen
by Chad Amberg, (6823 days ago) @ woddrazen
Hi Chad,
Here is example which will show you what channel is started after you make RemoteListen Connection:-------------------------
Dim i As IntegerFor i = 0 To SSH_1.Channels.Count - 1
Debug.Print SSH_1.Channels(i).RemotePort & = & SSH_1.Channels(i).Activated
Next i
-------------------------Hope I helped.
Regards,
Drazen
Hi Drazen-
If I open up a connection saying that the remote port is 0, because we can't know what port is available ahead of time, your debug output above always shows port 0.
However, the server does open up a random port correctly.
Looking at http://www.ietf.org/rfc/rfc4254.txt for the SSH_MSG_CHANNEL_OPEN_CONFIRMATION message, it does seem that when the server replies, that it includes both sides of the channel information. Of course, I've never debugged what the actual SSH conversation looks like, but I'm hoping that you can tell me that after a tunnel is opened, that the server does respond with the port information, and that this can be added to wodtunnel hopefully?
Thanks,
Chad
by Chad Amberg, (6823 days ago) @ Chad Amberg
Whups, wrong message. Looking at the right section of the RFC, part 7.1:
If a client passes 0 as port number to bind and has 'want reply' as
TRUE, then the server allocates the next available unprivileged port
number and replies with the following message; otherwise, there is no
response-specific data.
byte SSH_MSG_REQUEST_SUCCESS
uint32 port that was bound on the server
by Jasmine, (6822 days ago) @ Chad Amberg
Chad,
I have double checked - we do accept SSH_MSG_REQUEST_SUCCESS and read it's value, and is stored to RemotePort property.
Kreso
by Chad Amberg, (6822 days ago) @ Jasmine
Chad,
I have double checked - we do accept SSH_MSG_REQUEST_SUCCESS and read it's value, and is stored to RemotePort property.
Kreso
Hi Kreso-
Strange, I read the remote port continuously and only ever see a remote port of 0.
Could this be because the SSH server is reporting back a 0? I can go bug WinSSHD also on this...
by Jasmine, (6822 days ago) @ Chad Amberg
Chad,
it is very possible that server implementations don't work as that specification. Most of them were made on older draft which did not send port value with SSH_MSG_REQUEST_SUCCESS message.
I'll change wodSSHServer and freeSSHd now, can't say for others. wodSSHTunnel *IS* ready for this and should work as is.
Kreso
by Jasmine, (6822 days ago) @ Jasmine
Actually I was wrong. There was a bug in wodSSHTunnel. It's not fixed. Grab newest version and try it out.
Kreso
by Chad Amberg, (6822 days ago) @ Jasmine
Actually I was wrong. There was a bug in wodSSHTunnel. It's not fixed. Grab newest version and try it out.
Kreso
Just tried build 1.52.49 and I still get the same results.
I'm just doing a real simple function to check:
Private Sub ssh1_ChannelStart(ByVal Chan As wodSSHTunnelServLib.Channel) Handles ssh1.ChannelStart
Dim chanInfo As String =
chanInfo = Secure Channel Opened
chanInfo = chanInfo & vbCrLf & Channel: & Chan.Name
chanInfo = chanInfo & vbCrLf & Local Address: & Chan.LocalAddress
chanInfo = chanInfo & vbCrLf & Local Port: & Chan.LocalPort
chanInfo = chanInfo & vbCrLf & Remote Address: & Chan.RemoteAddress
chanInfo = chanInfo & vbCrLf & Remote Port: & Chan.RemotePort
writeToLog(EventLogEntryType.Information, chanInfo, 2)
end sub
So this should show up as soon as the channelstart event, correct?
by Jasmine, (6822 days ago) @ Chad Amberg
Yes, on channel start. What server do you use? I tested with wodSSHServer which I *know* it works (because I just made it by the specs...)
Kreso
by Chad Amberg, (6822 days ago) @ Jasmine
Latest greatest version of WinSSHD. I've sent Bitvise an email to make sure they're up to spec to but haven't heard a response back yet.
Does the current build of freesshd available work?
by Jasmine, (6822 days ago) @ Chad Amberg
Chad,
don't know about freeSSHd, you have to post question there.
Kreso
by Chad Amberg, (6816 days ago) @ Jasmine
Just an FYI to all...
The ssh server from VanDyke software called VShell does support this and it works really well.
May I say how nice it is to work with components so complete and self-explanatory that using them in my application is as instinctive as though I wrote them myself?
Your component works really great. With minor effort I have been able to convert my delphi application...
It is very refreshing to find such helpful, knowledgeable and quick responding technical support.
Fantastic product by the way, it has helped us tremendously on a daily basis. Keep up the good work.
Congratulations on an excellent product and first rate support!
...with a minimum of effort as the DLL interface was written with such simplicity...
I really like these products - they are consistently first rate!
Your component works really great. With minor effort I have been able to convert my delphi application...
You did a great job on wodSSH and wodSSHServer! I got a lot for very little money. Thanks!
You made it so simple for us to integrate SFTP - a technology we had little experience with...