binhex / arch-privoxyvpn

Docker build script for Arch Linux base with Privoxy and OpenVPN
GNU General Public License v3.0
102 stars 24 forks source link

Connect to OpenVPN server through TOR #32

Closed wLxCvcY20V closed 3 months ago

wLxCvcY20V commented 3 months ago

I'm trying to pass command line options to openvpn to connect to the server through the TOR proxy running in my machine, but the connection always timeout. I'm sure it has to do with the iptables configuration. Is there a way to edit the iptables setup?

Command I'm running: docker run --cap-add=NET_ADMIN \ --add-host host.docker.internal:host-gateway \ --dns 192.168.0.1 \ -p 8118:8118 \ -p 9118:9118 \ -v /tmp/config:/config \ -v /etc/localtime:/etc/localtime:ro \ -e VPN_ENABLED=yes \ -e VPN_USER=user \ -e VPN_PASS=pass \ -e VPN_PROV=custom \ -e VPN_CLIENT=openvpn \ -e VPN_OPTIONS="--connect-retry-max 1 --socks-proxy 192.168.0.1 9050 --connect-timeout 60" \ -e LAN_NETWORK=192.168.0.0/24 \ -e NAME_SERVERS=192.168.0.1 \ -e ENABLE_SOCKS=yes \ -e ENABLE_PRIVOXY=yes \ -e ENABLE_STARTUP_SCRIPTS=no \ -e DEBUG=false \ binhex/arch-privoxyvpn

wLxCvcY20V commented 3 months ago

Just found the documentation, the name just says VPN Docker Guide, so I assumed it wasn't for this image. Mistake from my part.

I set the option ENABLE_STARTUP_SCRIPTS to yes, and created a script at /config/scripts with the following iptables commands: iptables -A INPUT -s <source network>/<cidr> -d 172.17.0.0/16 -j ACCEPT iptables -A OUTPUT -s 172.17.0.0/16 -d <source network>/<cidr> -j ACCEPT

For some reason the connection fails for privoxy sometimes. Despite that everything is working fine now.