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.71k stars 331 forks source link

Bug: Internal auto-healing restarts VPN connection even if it's stopped using control server #2236

Open smolpaw opened 2 months ago

smolpaw commented 2 months ago

Is this urgent?

No

Host OS

Ubuntu 22.04.4 LTS (Jammy Jellyfish)

CPU arch

x86_64

VPN service provider

ProtonVPN

What are you using to run the container

docker-compose

What is the version of Gluetun

Running version latest built on 2024-04-08T07:43:05.096Z (commit 7b4befc)

What's the problem 🤔

When the VPN is stopped using control server the internal auto-healing restarts the connection after few seconds. Since control server allows both stopping and starting the VPN I assumed the VPN will stay shut until I send another request to start again.

Is this the intended behavior ?

Share your logs (at least 10 lines)

gluetun  | 2024-04-24T17:14:44 INFO [openvpn] UID set to nonrootuser
gluetun  | 2024-04-24T17:14:44 INFO [openvpn] Initialization Sequence Completed
gluetun  | 2024-04-24T17:14:44 INFO [healthcheck] healthy!
gluetun  | 2024-04-24T17:14:49 INFO [ip getter] Public IP address is X.X.X.X (Singapore, Singapore, Singapore)
gluetun  | 2024-04-24T17:14:50 INFO [vpn] You are running on the bleeding edge of latest!
gluetun  | 2024-04-24T17:14:56 INFO [vpn] stopping
gluetun  | 2024-04-24T17:14:56 INFO [http server] 200 PUT /status wrote 22B to 172.23.0.1:42252 in 81.840904ms
gluetun  | 2024-04-24T17:15:06 INFO [healthcheck] program has been unhealthy for 6s: restarting VPN
gluetun  | 2024-04-24T17:15:06 INFO [healthcheck] 👉 See https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md
gluetun  | 2024-04-24T17:15:06 INFO [healthcheck] DO NOT OPEN AN ISSUE UNLESS YOU READ AND TRIED EACH POSSIBLE SOLUTION
gluetun  | 2024-04-24T17:15:06 INFO [vpn] starting
gluetun  | 2024-04-24T17:15:06 INFO [firewall] allowing VPN connection...
gluetun  | 2024-04-24T17:15:06 INFO [openvpn] OpenVPN 2.6.8 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]

Share your configuration

No response

github-actions[bot] commented 2 months ago

@qdm12 is more or less the only maintainer of this project and works on it in his free time. Please:

qdm12 commented 2 months ago

No it's indeed a bug, since the healthcheck isn't aware of the VPN "Loop state", and only knows to trigger a restart of the loop when it fails the healthcheck. The ugly workaround for now is to more or less disable the healthcheck trying to reboot the VPN with HEALTH_VPN_DURATION_INITIAL=1000h for example. Not a solution for sure though.