OpenVPN client as SOCKS 5 server? [closed]

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.


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 (archive.org mirror) 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 (archive.org mirror) 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 (archive.org mirror).

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.