wfg / docker-openvpn-client

OpenVPN client with killswitch and proxy servers; built on Alpine
MIT License
353 stars 107 forks source link

Cannot work with minikube #83

Closed evenlee closed 1 year ago

evenlee commented 1 year ago

I am running it as a proxy in minikube, but when I set proxy ip as minikube ip address(192.168.59.100) in browser, nothing happens, seems browser proxy cannot access the container with minikube ip and exposed port. and I checked logs in container, all message indicate the service is connected and proxy is opened:

  2022-10-02 16:08:11 /sbin/ip route add 39.106.0.0/24 via 172.17.0.1
  2022-10-02 16:08:11 /sbin/ip route add 203.107.0.0/24 via 172.17.0.1
  2022-10-02 16:08:11 /sbin/ip route add 121.40.0.0/24 via 172.17.0.1
  2022-10-02 16:08:11 /sbin/ip route add 79.133.0.0/24 via 172.17.0.1
  2022-10-02 16:08:11 Initialization Sequence Completed
  info: starting socks proxy without credentials
  info: starting http proxy without credentials

I usually use sqlserver same way, azure data studio can access the server by minikube host ip and exposed port. So I am not sure if there are some config issue or it cannot work by design.

Here is the test result:

  ❯ nc -vz -w 2 192.168.59.100 1080
  nc: connectx to 192.168.59.100 port 1080 (tcp) failed: Operation timed out
  ❯ minikube ip
  192.168.59.100
  ❯ nc -vz -w 2 192.168.59.100 1400
  Connection to 192.168.59.100 port 1400 [tcp/cadkey-tablet] succeeded!
evenlee commented 1 year ago

got a solution with another container, but before we start, need to copy ovpn and credential file into minikube vm folde(i use data), and 192.168.59.0 is minikube ip network.

docker run -d \ --cap-add=NET_ADMIN \ -p 9118:9118 --restart=always \ --name=open-vpn \ -v /data/openvpn.ovpn:/config/openvpn/openvpn.ovpn \ -v /etc/localtime:/etc/localtime:ro \ -e VPN_ENABLED=yes \ -e VPN_PROV=custom \ -e VPN_CLIENT=openvpn \ -e LAN_NETWORK=192.168.59.0/24 \ -e NAME_SERVERS=1.1.1.1,8.8.8.8 \ -e ENABLE_SOCKS=yes \ -e ENABLE_PRIVOXY=no \ -e DEBUG=false \ -e UMASK=000 \ -e PUID=0 \ -e PGID=0 \ binhex/arch-privoxyvpn