Remote Port Forwarding is not working with OpenSSH Server (General questions)
Hi,
We had setup a Linux CentOS 6.6 (final) server 64 Bit, with OpenSSH version as "OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013". By using the wodTunnel DLL, it is creating the Remote Port Forwarding channel. But when we try to connect through the channel, the wodTunnel DLL gets the "UserConnecting" event , in this event we are allowing the user by setting the 'allow' parameter as TRUE, but after this it just disconnects the connection. The client which is connecting, gets the message as "Connection closed by foreign host".
The wodTunnel DLL version is 1.7.3.93.
But the above things works properly by using libSSH library, in the Linux environment.
Thanks & Regards,
Kedar B.
Remote Port Forwarding is not working with OpenSSH Server
Hi Kedar.
Can you show me how does your channel.add looks like where you define new remote port forwarding channel?
Regards,
Jasmine.
Remote Port Forwarding is not working with OpenSSH Server
Hi Jasmine,
I had taken the code which is available in the GitHub, following is the link
https://github.com/arcanericky/wodSSHTunnel-remote-listener
The channel add is as follows
private static void wodSSHTunnel1_Connected()
{
//If a new channel is defined as RemoteListen, then SSH server will bind RemoteAddress on RemotePort (Note: RemoteAddress
//as seen from the SSH server's end!!). When a new connection comes to the selected RemotePort, the SSH server will send
//a notification to wodSSHTunnel, which will initiate a new connection towards the LocalAddress interface on LocalPort.
//In this example we will forward port 5900. This is VNC server port. On remote server where your SSH server is you can
//open VNC connection using 127.0.0.1 (localhost) and port 5900. You will be using encrypted connection instead insecure
//Internet connection. To accept connections from a foreign address, use the UserConnecting event (below) and set the
//SSH server option GatewayPorts to yes.
wodSSHTunnel1.Channels.Add(wodSSHTunnelCOMLib.ForwardTypesEnum.RemoteListen, "0.0.0.0", 23, "0.0.0.0", 8000);
wodSSHTunnel1.Channels.StartAll();
Console.WriteLine("Remote listener added");
}
In the above code, I am telling SSH server to open the port 8000 and need to redirect to telnet port 23.
Thanks & Regards,
Kedar B.
Remote Port Forwarding is not working with OpenSSH Server
Hi Kedar.
I don't think this line is correct:
wodSSHTunnel1.Channels.Add(wodSSHTunnelCOMLib.ForwardTypesEnum.RemoteListen, "0.0.0.0", 23, "0.0.0.0", 8000);
Second '0.0.0.0' makes sense, it means "bind all interfaces" on port 8000.
But first '0.0.0.0' would mean 'connect to all interfaces' on port 23, and that is incorrect. Try to change it to
wodSSHTunnel1.Channels.Add(wodSSHTunnelCOMLib.ForwardTypesEnum.RemoteListen, "127.0.0.1", 23, "0.0.0.0", 8000);
or instead of 127.0.0.1 give real IP of local wodSSHTunnel client, or whereever he needs to redirect remote port.
I hope this helps!
Jasmine.
Remote Port Forwarding is not working with OpenSSH Server
Hi Jasmine,
As suggested by you I changed the IP to 127.0.0.1, but it did not work. Following is the code change
wodSSHTunnel1.Channels.Add(wodSSHTunnelCOMLib.ForwardTypesEnum.RemoteListen, "127.0.0.1", 23, "0.0.0.0", 8000);
It is actually a S2C rule (Server to Client rule), where the SSH server will start listening on port 8000. When anybody connects to port 8000, it will redirect the data to the system, where the actual wodTunnel Application is running. The wodTunnel application, will then forward the data, to the local host on port 23.
Following analysis were made.
1> We took the putty session of the OpenSSH server.
2> Once the Channel is created, we had verified that OpenSSH starts listening on port 8000.
3> Now we try to execute the following command in the putty session of the OpenSSH server
telnet 127.0.0.1 8000
4> The above command connects to port 8000, where the data is forwarded, to the wodTunnel application.
5> The wodTunnel application gets the "UserConnecting" event.
6> After the above event it disconnects the connection.
7> The telnet command gets the error message as "Connection Closed by foreign host".
Telnet server is running on the wodTunnel Application system on port 23.
Thanks & Regards,
Kedar B.
Remote Port Forwarding is not working with OpenSSH Server
Hi Kedar.
And you do have telnet service running on wodSSHTunnel's computer?
Jasmine.
Remote Port Forwarding is not working with OpenSSH Server
Hi Jasmine,
In my previous post, the last line indicates, that the Telnet Service is running on port 23, on the system, where the wodTunnel application is also running.
Thanks & Regards,
Kedar B.
Remote Port Forwarding is not working with OpenSSH Server
Kedar,
can you also check UserConnecting event. Do you set Allow = True there to allow the connection?
Jasmine.
Remote Port Forwarding is not working with OpenSSH Server
Hi Jasmine,
Just to update, the wodtunnel component for dynamic port forwarding works properly with OpenSSH 6.6. It does not works properly with OpenSSH 5.3.
We had now upgraded the OpenSSH server and it is working properly.
Thanks for the help.
Thanks & Regards,
Kedar B.