qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.94k stars 337 forks source link

Bug: Port Forward file not cleared on container exit #150

Closed raph521 closed 4 years ago

raph521 commented 4 years ago
  1. What VPN service provider are you using?

    • [x] PIA
    • [ ] Mullvad
    • [ ] Windscribe
  2. What's the version of the program?

Running version latest built on 2020-04-29T01:22:44Z (commit b0ea739)

  1. What are you using to run the container?

    • [ ] Docker run
    • [x] Docker Compose
    • [ ] Kubernetes
    • [ ] Docker stack
    • [ ] Docker swarm
    • [ ] Podman
    • [ ] Other:
  2. What's wrong? (please share some of your logs, and maybe configuration)

I've noticed that the port forward file doesn't get cleared when the container exits. The last two log lines when the container exits are as shown below:

Log

2020-04-29T15:14:43.499-0400    WARN    Caught OS signal terminated, shutting down,
2020-04-29T15:14:43.499-0400    INFO    Waiting for processes to exit...

Here are the relevant bits of my docker-compose yaml where I enable port forwarding.

Configuration file:

            - VPNSP=private internet access
            - PORT_FORWARDING=on
            - PORT_FORWARDING_STATUS_FILE=/some_dir/forwarded_port

I noticed in main.go that the value checked against allSettings.VPNSP is "pia". Should the value checked be "private internet access" instead (or constants.PrivateInternetAccess)?

        if allSettings.VPNSP == "pia" && allSettings.PIA.PortForwarding.Enabled {
            if err := piaConf.ClearPortForward(allSettings.PIA.PortForwarding.Filepath, allSettings.System.UID, allSettings.System.GID); err != nil {
                logger.Error(err)
            }
        }
  1. Is this urgent?

    • [ ] Yes
    • [x] No
qdm12 commented 4 years ago

Yep indeed, thanks for noticing and digging in the code :+1: I'll fix it this evening. It should be, from the top of my head, constants.PrivateInternetAccess instead of "pia" as you pointed out.

qdm12 commented 4 years ago

Fixed with this commit 😉 (actually from yesterday oddly, forgot to push it!)

qdm12 commented 4 years ago

Hello, quick question, is your port forwarding still working for you? I'm wondering if I broke it somehow the previous days as it doesn't work for me (but I'm not a port forwarding user so maybe I'm mistaken). Thanks!

raph521 commented 4 years ago

Hey, sorry for the delay!

I have not had any issues with port forwarding in the last few days. I just tried pulling the most recent image (in case I didn't already have it) and can confirm that port forwarding is still working for me.

qdm12 commented 4 years ago

No problem, thanks for answering! Any way you can easily test if it works? Or are you just seeing your i. e. torrent client working?

raph521 commented 4 years ago

I'm just seeing the forwarded port marked as open by my torrent client (Transmission).