Networking – How to Use OpenVPN Behind HTTP and HTTPS Proxy

networkingopenvpnPROXY

I have to use a proxy to access the internet. I want create a VPN server that will connect through this proxy. It makes it easier to setup on devices. Here is a grid:

# # # # # #         # # # # # #         # # # # # # # # #
#         #   VPN   # VPN     #    ?    # HTTP/HTTPS    #         # # # # # # #
#  client # ------\ # server  # ------\ # proxy         # -------\#  internet #
#         # ------/ #         # ------/ # both          # -------/#           #
#         #         #         #         # 127.0.0.1:8087#         # # # # # # #
# # # # # #         # # # # # #         # # # # # # # # #

I want to use a Raspberry pi with OpenVPN for the server. The proxy is a python script that
should be ran on the server. It's called Goagent. The proxy is so i can access the whole internet.

My question is: Does adding http-proxy in the openvpn server config file work with HTTPS addresses as well? Or am I getting it all wrong?

Best Answer

The http-proxy directive is used when between your VPN client and your VPN server there is a proxy (either http or https) which is not your case (and to respond to the comment it works on both TCP and SSL, with the catch that the OpenVPN connection has to be of tcp protocol).

In your drawing your Proxy is after the VPN connection.

In this case I'd say you would need to: 1) Setup a normal VPN connection between client and server 2) Push a route on the client so the client can see the Proxy in your image. This can be either a host route (for the specific IP) or a default route. You could need to do masquerading for the client IPs aswell if the proxy doesn't have the VPN network in its accessible routing table. And of course the server needs to have IP forwarding enabled. 3) Now either: 3a) On the client you can set up the proxy configuration of the applications your are using (ie. the browser) to point to the proxy IP/Port where to pass from 3b) You can do on the VPN server some transparent proxying and redirect all the traffic to the proxy machine (for example like in this article)

This way actually the VPN software doesn't know anything about the proxy. It will just make traffic pass between the first two blocks in your drawing. Then the VPN server will forward the packets to the proxy in one of the two ways.

Related Question