qdm12 / gluetun-wiki

Home to the Markdown Wiki page for Gluetun
MIT License
269 stars 31 forks source link

Missing instructions for determing what port has been fowarded #75

Open pops64 opened 1 month ago

pops64 commented 1 month ago

I have been looking through the wiki as I was thinking of migrating to proton for my VPN service provider. I plan on using Wiregraud. And I understand the instructions on how to set up the connection. But there seems to be no steps on how to determine what port has been forwarded to gluetun by Proton. As the instructions provided by proton state that you have to request a port and this is when it is determined. Is it printed in the logs? Is there some command I can run to retrieve it short of using grep on the logs? I saw the HTTP control server will print it out for openvpn, but I am using wiregraud would this also work or would it be a differnt get request?

I need this information for my torrent client. Or does enabling UPnP on my torrent client automatically fetch the correct port that is forwarded, I would still prefer to manual configure it?

invertedEcho commented 1 month ago

@pops64 You can find the port from the logs of gluetun, e.g.

docker logs dockers-gluetun-1 | grep "port forwarded is" | awk '{print $NF}'

Will return you the port number assigned for forwarding (assuming you get the same output as me)

If you want to do this automatically, for example because your vpn provider changes the port, you could look into programmatically changing the port in your Torrent Client. As an example, for qbittorrent, you could use their API https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)

cohenchris commented 3 weeks ago

I would love for this to be included in the Wireguard API, like it is here in the OpenVPN section: https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md#openvpn

kainzilla commented 2 weeks ago

I would love for this to be included in the Wireguard API, like it is here in the OpenVPN section: https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md#openvpn

Just as a heads up, this actually already works - even though the URL says openvpn, it populates with the port for the current Wireguard connection

cohenchris commented 2 weeks ago

I would love for this to be included in the Wireguard API, like it is here in the OpenVPN section: https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md#openvpn

Just as a heads up, this actually already works - even though the URL says openvpn, it populates with the port for the current Wireguard connection

This is not the case for my setup

clemfernandez commented 3 days ago

Here is a working configuration for ProtonVPN:

    volumes:
      - /tmp/gluetun:/tmp/gluetun
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - VPN_PORT_FORWARDING=on
      - VPN_PORT_FORWARDING_PROVIDER=protonvpn

Then the forwarded port is available either on your Docker host /tmp/forwarded-port or through the control server via GET /v1/openvpn/portforwarded, as @kainzilla mentionned.

pentago commented 2 days ago

Does this ProtonVPN forwarded port stay up for a user forever or does it change occasionally? If it changes, how often and in which situations?

I wonder if I need to reconfigure my torrent client each time I restart my docker compose project.

pops64 commented 1 day ago

It changes. Not sure on the schedule. I have had some where it changes on a gluetun server restart and other where I have had it going for a long time. Defiantly would suggest automating this into your torrent client. Would be a nice feature request of gluetun not to sure how feasible due to the sheer amount of clients out there