4

I have an OpenVPN server and I want to be able to route all requests that are made to that OpenVPN server through a proxy, so that the requests will look like they are made be the internet address of the exit node. For example, a normal request looks like this:

request -> openvpn -> send data back to user with the IP of the machine

When I want it to go through TOR:

request -> openvpn -> tor -> send data back to user with the IP of the proxy

How can I accomplish this?

2
  • Did you solve this?
    – Macindows
    Dec 17, 2020 at 7:34
  • did you find any solution for this? May 26, 2021 at 11:49

2 Answers 2

2

I have found that this works pretty well: (For this, I'm assuming that you have installed tor using "apt-get install tor" and not using the Tor browser bundle.)

  1. Add this line to the "/etc/tor/torrc" file to tunnel vpn traffic:

    SocksPort 9150 PreferSOCKSNoAuth

  2. Then you will need to tell OpenVPN to use a proxy. Add this to your VPN config file:

    socks-proxy localhost 9150 socks-proxy-retry

  3. Restart tor: sudo service tor restart *you may need to reload the config for tor with: "sudo service tor reload"

  4. Now you should be able to run openvpn AFTER tor has established a connection to the tor network. sudo openvpn --config path/to/vpn/config/file

Hope this helps a bit :)

1
  • 1
    I think you don't understand what I want, I'd like to have the server run through tor, not the client.
    – user10065
    Nov 29, 2015 at 12:27
2

To rephrase what you are saying: you'd like to establish a VPN tunnel and then use Tor to connect to external hosts across that tunnel.

You can achieve this by running Tor on the VPN server and configuring it to listen on the VPN IP. i.e. if the VPN IP of the server is 10.0.0.1, you can configure Tor (in torrc) with:

SocksPort 10.0.0.1:9050

Then, your VPN client should establish the tunnel and use 10.0.0.1:9050 as SOCKS5 server in its applications (i.e. the web browser).

The result is that your connections will be established via a Tor exit-node, but the client ISP will only see a VPN tunnel.

Note: this way any VPN client will be able to use the VPN server as Tor entry point. One way to limit this is to assign a static IP to the VPN client and then configure the server firewall to allow connections to tcp/9050 only from that specific IP.

1
  • Can you give any examples of the openvpn configuration? Oct 22, 2021 at 23:32

You must log in to answer this question.