24

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.
2
  • 1
    I 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
    Dec 10, 2011 at 10:39
  • 1
    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): askubuntu.com/questions/703905/… 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
    Jan 30, 2020 at 21:29

3 Answers 3

3

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.

4
  • 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. May 2, 2017 at 21:07
  • would take years, archive.org is your friend
    – hoanns
    May 2, 2017 at 22:17
  • I am unable to visit reddit, can you copy and paste it here? Jun 12, 2020 at 16:28
  • I added archive.org links, hope those work for you
    – hoanns
    Aug 12, 2020 at 7:48
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.

5
  • 1
    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
    Dec 21, 2011 at 3:42
  • ...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? Dec 21, 2011 at 4:52
  • 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
    Dec 21, 2011 at 5:12
  • 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. Dec 21, 2011 at 18:17
  • 2
    thanks for the effort, man, but not every OpenVPN server is configurable by the user. Plus SSH effeciency is worse than OpenVPN.
    – est
    Dec 26, 2011 at 12:23
0

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.

1
  • 1
    are you a bot??
    – est
    Jun 9, 2013 at 14:42

Not the answer you're looking for? Browse other questions tagged .