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
7.52k stars 355 forks source link

Bug: Bug #855 has arisen from the dead (aka panic: runtime error: invalid memory address or nil pointer dereference) #2169

Closed captainkev76 closed 6 months ago

captainkev76 commented 6 months ago

Is this urgent?

No

Host OS

Ubuntu 22.04

CPU arch

x86_64

VPN service provider

Surfshark

What are you using to run the container

docker-compose

What is the version of Gluetun

latest built on 2024-03-18T17:49:37.003Z (commit 3d16798)

What's the problem 🤔

Gluetun has panic immediately after starting and crashes

Share your logs (at least 10 lines)

luetunqbit    | 2024-03-19T17:50:38Z INFO Unbound version: 1.19.3
gluetunqbit    | 2024-03-19T17:50:38Z INFO IPtables version: v1.8.9
gluetunqbit    | 2024-03-19T17:50:38Z INFO Settings summary:
gluetunqbit    | ├── VPN settings:
gluetunqbit    | |   ├── VPN provider settings:
gluetunqbit    | |   |   ├── Name: surfshark
gluetunqbit    | |   |   └── Server selection settings:
gluetunqbit    | |   |       ├── VPN type: wireguard
gluetunqbit    | |   |       ├── Countries: switzerland
gluetunqbit    | |   |       └── Wireguard selection settings:
gluetunqbit    | |   └── Wireguard settings:
gluetunqbit    | |       ├── Private key: +Lb...m0=
gluetunqbit    | |       ├── Interface addresses:
gluetunqbit    | |       |   └── 10.14.0.2/16
gluetunqbit    | |       ├── Allowed IPs:
gluetunqbit    | |       |   ├── 0.0.0.0/0
gluetunqbit    | |       |   └── ::/0
gluetunqbit    | |       └── Network interface: tun0
gluetunqbit    | |           └── MTU: 1400
gluetunqbit    | ├── DNS settings:
gluetunqbit    | |   ├── Keep existing nameserver(s): no
gluetunqbit    | |   ├── DNS server address to use: 127.0.0.1
gluetunqbit    | |   └── DNS over TLS settings:
gluetunqbit    | |       ├── Enabled: yes
gluetunqbit    | |       ├── Update period: every 24h0m0s
gluetunqbit    | |       ├── Unbound settings:
gluetunqbit    | |       |   ├── Authoritative servers:
gluetunqbit    | |       |   |   └── cloudflare
gluetunqbit    | |       |   ├── Caching: yes
gluetunqbit    | |       |   ├── IPv6: no
gluetunqbit    | |       |   ├── Verbosity level: 1
gluetunqbit    | |       |   ├── Verbosity details level: 0
gluetunqbit    | |       |   ├── Validation log level: 0
gluetunqbit    | |       |   ├── System user: root
gluetunqbit    | |       |   └── Allowed networks:
gluetunqbit    | |       |       ├── 0.0.0.0/0
gluetunqbit    | |       |       └── ::/0
gluetunqbit    | |       └── DNS filtering settings:
gluetunqbit    | |           ├── Block malicious: yes
gluetunqbit    | |           ├── Block ads: no
gluetunqbit    | |           ├── Block surveillance: no
gluetunqbit    | |           └── Blocked IP networks:
gluetunqbit    | |               ├── 127.0.0.1/8
gluetunqbit    | |               ├── 10.0.0.0/8
gluetunqbit    | |               ├── 172.16.0.0/12
gluetunqbit    | |               ├── 192.168.0.0/16
gluetunqbit    | |               ├── 169.254.0.0/16
gluetunqbit    | |               ├── ::1/128
gluetunqbit    | |               ├── fc00::/7
gluetunqbit    | |               ├── fe80::/10
gluetunqbit    | |               ├── ::ffff:127.0.0.1/104
gluetunqbit    | |               ├── ::ffff:10.0.0.0/104
gluetunqbit    | |               ├── ::ffff:169.254.0.0/112
gluetunqbit    | |               ├── ::ffff:172.16.0.0/108
gluetunqbit    | |               └── ::ffff:192.168.0.0/112
gluetunqbit    | ├── Firewall settings:
gluetunqbit    | |   ├── Enabled: yes
gluetunqbit    | |   └── Outbound subnets:
gluetunqbit    | |       └── 192.168.1.0/24
gluetunqbit    | ├── Log settings:
gluetunqbit    | |   └── Log level: INFO
gluetunqbit    | ├── Health settings:
gluetunqbit    | |   ├── Server listening address: 127.0.0.1:9999
gluetunqbit    | |   ├── Target address: cloudflare.com:443
gluetunqbit    | |   ├── Duration to wait after success: 5s
gluetunqbit    | |   ├── Read header timeout: 100ms
gluetunqbit    | |   ├── Read timeout: 500ms
gluetunqbit    | |   └── VPN wait durations:
gluetunqbit    | |       ├── Initial duration: 6s
gluetunqbit    | |       └── Additional duration: 5s
gluetunqbit    | ├── Shadowsocks server settings:
gluetunqbit    | |   └── Enabled: no
gluetunqbit    | ├── HTTP proxy settings:
gluetunqbit    | |   └── Enabled: no
gluetunqbit    | ├── Control server settings:
gluetunqbit    | |   ├── Listening address: :8000
gluetunqbit    | |   └── Logging: yes
gluetunqbit    | ├── OS Alpine settings:
gluetunqbit    | |   ├── Process UID: 1000
gluetunqbit    | |   └── Process GID: 1000
gluetunqbit    | ├── Public IP settings:
gluetunqbit    | |   ├── Fetching: every 12h0m0s
gluetunqbit    | |   ├── IP file path: /tmp/gluetun/ip
gluetunqbit    | |   └── Public IP data API: ipinfo
gluetunqbit    | └── Version settings:
gluetunqbit    |     └── Enabled: yes
gluetunqbit    | 2024-03-19T17:50:38Z INFO [routing] default route found: interface eth0, gateway 192.168.64.1, assigned IP 192.168.64.2 and family v4
gluetunqbit    | 2024-03-19T17:50:38Z INFO [routing] adding route for 0.0.0.0/0
gluetunqbit    | 2024-03-19T17:50:38Z INFO [firewall] setting allowed subnets...
gluetunqbit    | 2024-03-19T17:50:38Z INFO [routing] default route found: interface eth0, gateway 192.168.64.1, assigned IP 192.168.64.2 and family v4
gluetunqbit    | 2024-03-19T17:50:38Z INFO [routing] adding route for 192.168.1.0/24
gluetunqbit    | 2024-03-19T17:50:38Z INFO TUN device is not available: open /dev/net/tun: no such file or directory; creating it...
gluetunqbit    | 2024-03-19T17:50:38Z INFO [dns] using plaintext DNS at address 1.1.1.1
gluetunqbit    | 2024-03-19T17:50:38Z INFO [http server] http server listening on [::]:8000
gluetunqbit    | 2024-03-19T17:50:38Z INFO [healthcheck] listening on 127.0.0.1:9999
gluetunqbit    | panic: runtime error: invalid memory address or nil pointer dereference
gluetunqbit    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x78e831]
gluetunqbit    |
gluetunqbit    | goroutine 96 [running]:
gluetunqbit    | github.com/qdm12/gluetun/internal/storage.filterServer({{0xc001910830, 0x9}, {0xc001910736, 0x7}, {0xc001910820, 0x6}, {0xc001910730, 0x6}, {0x                                                    0, 0x0}, ...}, ...)
gluetunqbit    |        github.com/qdm12/gluetun/internal/storage/filter.go:77 +0x1b1
gluetunqbit    | github.com/qdm12/gluetun/internal/storage.(*Storage).FilterServers(_, {_, _}, {{0xc00002a021, 0x9}, {{0x0, 0xffff00000000}, 0xc000010018}, {0xc                                                    000b57340, 0x1, ...}, ...})
gluetunqbit    |        github.com/qdm12/gluetun/internal/storage/filter.go:33 +0x2fb
gluetunqbit    | github.com/qdm12/gluetun/internal/provider/utils.GetConnection({_, _}, {_, _}, {{0xc00002a021, 0x9}, {{0x0, 0xffff00000000}, 0xc000010018}, {0x                                                    c000b57340, ...}, ...}, ...)
gluetunqbit    |        github.com/qdm12/gluetun/internal/provider/utils/connection.go:39 +0xad
gluetunqbit    | github.com/qdm12/gluetun/internal/provider/surfshark.(*Provider).GetConnection(_, {{0xc00002a021, 0x9}, {{0x0, 0xffff00000000}, 0xc000010018},                                                     {0xc000b57340, 0x1, 0x1}, {0x0, ...}, ...}, ...)
gluetunqbit    |        github.com/qdm12/gluetun/internal/provider/surfshark/connection.go:12 +0x105
gluetunqbit    | github.com/qdm12/gluetun/internal/vpn.setupWireguard({_, _}, {_, _}, {_, _}, {_, _}, {{0xc00002a021, 0x9}, ...}, ...)
gluetunqbit    |        github.com/qdm12/gluetun/internal/vpn/wireguard.go:20 +0xbe
gluetunqbit    | github.com/qdm12/gluetun/internal/vpn.(*Loop).Run(0xc00017d080, {0x109d840, 0xc00007ed70}, 0xc000314d80?)
gluetunqbit    |        github.com/qdm12/gluetun/internal/vpn/run.go:40 +0x4f5
gluetunqbit    | created by main._main in goroutine 9
gluetunqbit    |        ./main.go:427 +0x385a
gluetunqbit exited with code 2

Share your configuration

version: "3.9"
services:
  gluetun:
    image: qmcgaw/gluetun:3.37.0
    container_name: gluetunqbit
    cap_add:
      - NET_ADMIN
    volumes:
      - /mnt/docker/docker/gluetun:/gluetun
    environment:
      - PGID=1000
      - PUID=1000
      - VPN_SERVICE_PROVIDER=surfshark
      - VPN_TYPE=wireguard
      - WIREGUARD_PRIVATE_KEY=blah
      - WIREGUARD_ADDRESSES=10.14.0.2/16
      - SERVER_COUNTRIES=switzerland
      - FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24
    ports:
      - 8080:8080
      - 6881:6881
      - 6881:6881/udp
      - 9696:9696
captainkev76 commented 6 months ago

I should add - a few others have the same issue, and have been commenting on thread #855 but as that's been closed for some time I thought it best to create a new ticket for this. Also worth saying that the folk on that thread have found a workaround (use v3.37.0 rather than latest)

qdm12 commented 6 months ago

Duplicate of now resolved #2163 (and #855 is not relevant at all to the error you've seen). Simply pull the latest image and it should fix it 😉

github-actions[bot] commented 6 months ago

Closed issues are NOT monitored, so commenting here is likely to be not seen. If you think this is still unresolved and have more information to bring, please create another issue.

This is an automated comment setup because @qdm12 is the sole maintainer of this project which became too popular to monitor issues closed.