+1 vote
by (130 points)
edited

I would like to set up a tunnel to a socks5 proxy server, which is similar to the following command.

ssh -N -D 8888 root@remote.server

I already has a socks5 server run at remote.server:22(example). I need to get other web page by C# through that proxy server. How can I do this by Rebex?

It seems like the function of Rebex.Net.ProxySocket class, does it has sample code? And my socks5 server only support public key authentication method, but ProxySocket seems not.

2 Answers

0 votes
by (147k points)
edited

Rebex SshSession class can be used to tunnel connections through an SSH server, but Rebex ProxySocket component only supports Socks5 in client mode. It doesn't have the capability to act as a Socks5 server, which is what you need to reproduce "ssh -N -D"

Please check out the comments section of SSH port forwarding capable application question for additional information on what you would have to implement yourself.

Why don't you use a ready-made application such as Bitvise Tunnelier to achieve this?

by (130 points)
Thanks for your answer. I already read the post of "SSH port forwarding capable application" before asking this question. I was confused about the term of "server" before. After I re-read the post, I found that there are two kinds of server, one is SSH server, another one is Socks5 proxy server. Thus, I need to implement the Socks5 proxy server. Bitvise Tunnelier can act as a Socks5 proxy server for IE and Firefox. However, I want to connect other web sites by C#, not by a web browser. Are there any methods to do that?
by (147k points)
Does this mean you are using .NET WebRequest-HttpWebRequest or WebClient classes? Although these don't make it possible to specify a Socks5 proxy, it looks like it can use it if it's configured in IE - see http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/982bef6c-b9a4-4c0d-b7d5-0c64df9f610a for more information.
0 votes
by (650 points)
edited

Hi, Is it still true that Rebex ProxySocket component doesn't have the capability to act as a Socks5 server ?

Many of our users ask to be able to create SSH Tunnel like Putty.

Thanks

by (147k points)
edited

Unfortunately, it is still true. Rebex ProxySocket only supports the client-side of Socket4/Socket5 protocols at the moment. Although we do plan to add SSH tunnel capabilities with Socket4/5 server support to Rebex SSH Shell, it won't appear in the next release. Sorry! This said, Socks5 is actually a very simple protocol, so enhancing the sample application to support it should be rather straightforward.

...