I'm running a VPS with the OpenVPN service. On the same server I also set up a local socks proxy (it's Tor, but I don't think it really matters for this case).
Can I somehow route my VPN connection to that socks proxy, without any changes in my local browser/device settings?
The connection I want to set up looks something like
(my device) -> VPN tunnel -> (VPN server -> Tor SOCKS proxy) -> Tor network
(this connection is inside VPS)
I see two options
1) Routing happens entirely on the server, transparently for a client
2) The VPN pushes socks proxy options (as it can push routes, DNS servers etc)
but I have no clue how to achieve either one.
I frequently use OpenVPN to bypass blocking, and I want to use the same routine to connect to the Tor network both from Windows and Android devices, without bothering to change proxy settings, running local tor/orbot etc. Ideally I plan to run it alongside a regular VPN connection that routes all traffic to the Internet (this is already set up and working fine) but on a different port.
Best Answer
Finally got to it.
First you need to run another OpenVPN instance. Just copy your openvpn/server.conf and change
you may want to generate another keypair.
Then you start TOR in transparent proxy mode (please note that official documentation lists this mode as potentially insecure, refer to https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy for details). It will serve as your gateway and DNS server. Change default
torrc
file appending this configurationand finally route all subnet requests to TOR proxy (special configuration for DNS traffic)
make sure you allow internal 10.8.1.0 subnet traffic in your firewall.
Connecting to different ports will allow you to switch from TOR network to regular internet connection through VPN. No client configuration necessary.