OpenVPN client as SOCKS 5 server?

16

10

Are there any Windows applications that can connect to a remote OpenVPN server then act like a SOCKS 5 server in the local environment?

EDIT: which means

  • a local server
  • speaks VPN/OpenVPN protocol, bind to a port as socks proxy server
  • extract and run, can be installed without administrator/root privilege
  • without the need to setup a TUN/TAP devices or other virtual interfaces
  • leave route table clean.

est

Posted 2011-03-28T04:06:31.717

Reputation: 536

Question was closed 2017-05-03T02:02:15.097

I was able to turn an OpenVPN server that I don't own into a SOCKS proxy by using an SSH tunnel to an LXC container (if you don't use Linux, you can do it with a Linux virtual machine in VirtualBox but LXC has better performance): https://askubuntu.com/questions/703905/unable-to-open-sites-with-https-when-connected-through-openvpn/1206914#1206914 I found this question because I was looking for another question, how to configure the OpenVPN client to use a SOCKS proxy before connecting to the OpenVPN server, to avoid leaking your real IP address to the OpenVPN server.

– baptx – 2020-01-30T21:29:52.343

1I want to do the exact same thing. I don't want to use openVPN for every connection, but only for some application. Which supports SOCKS5. – Apache – 2011-12-10T10:39:00.763

Answers

2

What you want to do is enable shell access on the OpenVPN server (or any computer on the OpenVPN network, really) and create a shell account for your proxy.

Use ssh -D 127.0.0.1:8080 username on the commandline of your client system where username is the name of the proxy shell account you created, and 8080 is the SOCKS5 port you wish to use on the local machine. ssh should be installed by default on Macs/Linux/BSD or easy to install if it's not, and for Windows you can use PuTTY or Cygwin's ssh to set up a tunnel. I know this doesn't answer the question, but it would be the quickest way to achieve what you want, assuming you can get shell access to a computer over the OpenVPN network.

The other way would be to find a SOCKS5 server which allows you to specify the bind address for outgoing connections.

Darth Android

Posted 2011-03-28T04:06:31.717

Reputation: 35 133

Maybe the proper question is: Which openvpn client software could conveniently create a "Host-only Networking just like vmware" so that i can use it as a socks5 proxy? For example: my pc ip is 192.168.0.2 and 192.168.10.1, the connected openvpn client ip in its network is also 192.168.0.2, but i want to use it as 192.168.10.2 – diyism – 2011-12-21T03:42:08.893

...Ah. Just to make sure I'm understanding this correct, your computer is *.0.2, and there's another computer over OpenVPN that is also *.0.2 that you'd like to access? – Darth Android – 2011-12-21T04:52:15.880

no, my pc is 192.168.0.2 and 192.168.10.1 without openvpn client connected, and the openvpn client in this pc may get 192.168.0.2 ip from the remote openvpn server, so i want to make the virtual network of openvpn client is host-only network(eg. don't influence the local network), and it has a NAT ip 192.168.10.2 for host(my pc) to access it. – diyism – 2011-12-21T05:12:28.043

I think you'll find this question to be closer to what you're looking for; while it has no useful answers yet, it'd be better to work on this problem there rather than the comments here.

– Darth Android – 2011-12-21T18:17:03.443

2thanks for the effort, man, but not every OpenVPN server is configurable by the user. Plus SSH effeciency is worse than OpenVPN. – est – 2011-12-26T12:23:42.700

0

I did this. It took me a long time. In short,

  1. Set up OpenVPN client such that only programs that use its network interface use the VPN.
  2. Set up a local SSH server (freesshd) and force it to the VPN network interface.
  3. Connect Putty to said SSH server with a tunnel.

Here's the long version:

  1. Reddit has a good guide to limit OpenVPN to its own network interface. I only did the first 2 steps. Some programs (torrent clients) can natively connect to this network interface and run over the VPN, while every other program uses direct connection.

    But if you still need that SOCKS proxy, go on...

  2. Download freesshd and forcebindip. Here is Raymond.cc's guide on how to force freesshd (or any program) to the VPN interface.

    • It's better do this all as admin. I had problems with freesshd running non admin.
    • You need to configure freesshd correctly:

      1. Under the ssh tab, set "listen address" to "only localhost"

      2. Under the tunnel tab, allow both port forward settings (only first checkmark each, not both).

      3. Add a user under the user tab and give it access to all the stuff.

  3. Now that your SSH server is running, all you need to do is connect Putty to make a SOCKS tunnel. Connect it to 127.0.0.1 (your local SSH server) and choose a port for SOCKS. Here is a tutorial for that.

That's it! Now you have a SOCKS proxy running on 127.0.0.1 at the port you chose in Putty.

I know it still has routes, etc., but in the end you have a "clean" SOCKS proxy.

hoanns

Posted 2011-03-28T04:06:31.717

Reputation: 21

Welcome to Super User! Your answer can be made more complete by including the steps required to implement your solution from the material referenced in your links. This is necessary to keep your answer useful even when the links become broken. – I say Reinstate Monica – 2017-05-02T21:07:07.487

would take years, archive.org is your friend – hoanns – 2017-05-02T22:17:13.987

-1

If you want turn socks into VPN: https://code.google.com/p/badvpn/

if you want turn VPN into socks, maybe: http://lxc.sourceforge.net/

A VPN client is just like a virtual network card, so turning a VPN client into socks server equates to create a socks server over a specific network card.

diyism

Posted 2011-03-28T04:06:31.717

Reputation: 151

are you a bot?? – est – 2013-06-09T14:42:26.930