wolph / wollen-socks

Simple OpenVPN client Socks proxy server combination which supports both Surfshark and NordVPN currently
GNU General Public License v2.0
6 stars 2 forks source link

Make Proxy availible from network #1

Closed Alfagun74 closed 3 years ago

Alfagun74 commented 3 years ago

Currently the Proxy Server is only available from the host machine of the docker container. Have you got any idea how i can loosen that up so i could use the proxy from my network aswell?

I believe it is a 127.0.0.1 vs. 0.0.0.0 thing, because the ports are open and the firewall is disabled.

Sample output from docker host:

curl -vvv -x 'socks5h://127.0.0.1:1080' ifconfig.me
*   Trying 127.0.0.1:1080...
* TCP_NODELAY set
* SOCKS5 communication to ifconfig.me:80
* SOCKS5 connect to ifconfig.me:80 (remotely resolved)
* SOCKS5 request granted.
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Fri, 22 Jan 2021 09:38:49 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 13
< Access-Control-Allow-Origin: *
< Via: 1.1 google
<
* Connection #0 to host 127.0.0.1 left intact

Sample output from any other machine in my network:

curl -vvv -x 'socks5h://192.168.0.3:1080' ifconfig.me
* Expire in 0 ms for 6 (transfer 0x7fffeae4df50)
*   Trying 192.168.0.3...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x7fffeae4df50)
* connect to 192.168.0.3 port 1080 failed: Connection refused
* Failed to connect to 192.168.0.3 port 1080: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.0.3 port 1080: Connection refused

Thanks in advance

wolph commented 3 years ago

That's a bit strange, by default docker should expose its ports on all interfaces available on the host server. Are you sure you don't have a firewall running?

Assuming you're running linux, you could try this to be explicit:

docker run -p 0.0.0.0:1080:1080 ...
iptables -I INPUT -p tcp --dport 1080 -j ACCEPT
Alfagun74 commented 3 years ago

ufw is already uninstalled and i fired your iptable command on the server as root:

curl -vvv -x 'socks5h://192.168.0.3:1080' ifconfig.me
* Expire in 0 ms for 6 (transfer 0x7fffeb835f50)
*   Trying 192.168.0.3...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x7fffeb835f50)
* connect to 192.168.0.3 port 1080 failed: Connection refused
* Failed to connect to 192.168.0.3 port 1080: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.0.3 port 1080: Connection refused
wolph commented 3 years ago

Your network interface is probably not called eth0, right? :P

Alfagun74 commented 3 years ago

You're right. ill guess i have to change this in my personal fork. I dont use Kubernetes.

wolph commented 3 years ago

It's done. And the healthcheck works now :)

You need to set your PRIVATE_NET variable to the subnet your computers are in. For example, 192.168.0.0/24 is very common, as is 10.0.0.0/24