Pavel Piatruk’ tech & personal blog

How to build VPN from PROXY

Recently I built a solution for making VPN from Proxies. Any proxies are supported (HTTP, SOCKS5) and a resulting Openvpn user traffic is routed via the mapped proxy.

Every Openvpn user has its own backend proxy.

Of course only TCP is supported because majority of proxies don’t support UDP. And it is enough for browsing \ scraping.

The main tricky think was routing DNS packets via a proxy. So I used DoH (DNS-over-HTTPS).

How it works:

  • For each vpn client it starts TCP redirector which establishes all TCP connections through a proxy
  • For each vpn client it starts DNS caching server & DNS resolver. DNS is fwd’ed to local DNS caching server, then to local DNS resolver, then (via proxy) to a public DNS DoH resolver like Google

Used tools:

It is briefly described here: https://askubuntu.com/a/1423292/906035