Bug: Wireguard preshared key gets picked up only through environment variable and not through wg0.conf
emsknock opened this issue Β· comments
Is this urgent?
No
Host OS
Ubuntu 22.04.4 LTS
CPU arch
x86_64
VPN service provider
Custom
What are you using to run the container
docker-compose
What is the version of Gluetun
Running version v3.38.0 built on 2024-03-25T15:53:33.983Z (commit b3ceece)
What's the problem π€
When I bind /gluetun/wireguard/wg0.conf
to a Wireguard configuration file through docker-compose, the Presharedkey
value seems to get ignored. This does not happen when the Wireguard configuration is passed through environment variables.
I have tested the Wireguard configuration file in question outside of Gluetun and verified that it works, so it doesn't seem like the config file is the problem.
There's also a "Target IP address" value that appears when I pass in the settings through the environment but I don't know what that relates to β I don't know Wireguard internals very well.
Share your logs (at least 10 lines)
When the volumes
key in docker-compose.yaml
has ./wg.conf:/gluetun/wireguard/wg0.conf
:
VPN settings:
βββ VPN provider settings:
| βββ Name: custom
| βββ Server selection settings:
| βββ VPN type: wireguard
| βββ Wireguard selection settings:
| βββ Endpoint IP address: xxx.xxx.xxx.xxx
| βββ Endpoint port: 443
| βββ Server public key: 5...k=
βββ Wireguard settings:
βββ Private key: 8...o=
βββ Interface addresses:
| βββ xxx.xxx.xxx.xxx/xx
βββ Allowed IPs:
| βββ 0.0.0.0/0
| βββ ::/0
βββ Network interface: tun0
βββ MTU: 1400
When the above file is not mounted but instead the configuration is given through docker-compose.yaml
's environment
key (WIREGUARD_PUBLIC_KEY
etc):
VPN settings:
βββ VPN provider settings:
| βββ Name: custom
| βββ Server selection settings:
| βββ VPN type: wireguard
| βββ Target IP address: xxx.xxx.xxx.xxx # β ~~~~~ ! This line is new !
| βββ Wireguard selection settings:
| βββ Endpoint IP address: xxx.xxx.xxx.xxx
| βββ Endpoint port: 443
| βββ Server public key: 5...k=
βββ Wireguard settings:
βββ Private key: 8...o=
βββ Pre-shared key: h...I= # β ~~~~~~~~~~~~~~~~~~~~~ ! This line is new !
βββ Interface addresses:
| βββ xxx.xxx.xxx.xxx/xx
βββ Allowed IPs:
| βββ 0.0.0.0/0
| βββ ::/0
βββ Network interface: tun0
βββ MTU: 1400
Share your configuration
# docker-compose.yaml:
services:
gluetun:
image: qmcgaw/gluetun:v3
container_name: gluetun
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
- 8388:8388/udp # Shadowsocks
volumes:
- /srv/gluetun:/gluetun
#
# 1: This does not work!
# Contents pasted after this block.
#
# - /srv/gluetun/wg.conf:/gluetun/wireguard/wg0.conf
environment:
- VPN_SERVICE_PROVIDER=custom
- VPN_TYPE=wireguard
#
# 2: These settings do work!
# Exact values redacted.
#
# - VPN_ENDPOINT_IP=xxx.xxx.xxx.xxx
# - VPN_ENDPOINT_PORT=443
# - WIREGUARD_PUBLIC_KEY=5...k=
# - WIREGUARD_PRIVATE_KEY=8...o=
# - WIREGUARD_PRESHARED_KEY=h...I=
# - WIREGUARD_ADDRESSES=xxx.xxx.xxx.xxx/xx
# /srv/gluetun/wg.conf:
[Interface]
PrivateKey = 8...o=
Address = xxx.xxx.xxx.xxx/xx
[Peer]
Presharedkey = h...I=
PublicKey = 5...k=
Endpoint = xxx.xxx.xxx.xxx:443
@qdm12 is more or less the only maintainer of this project and works on it in his free time.
Please:
- do not ask for updates, be patient
- π the issue to show your support instead of commenting
@qdm12 usually checks issues at least once a week, if this is a new urgent bug,
revert to an older tagged container image
Hi there, thanks for the detailed issue! Presharedkey
should be PresharedKey
that's why π
Although this is a silly limitation, so I changed it to read fields with case insentivity in fe05521 (latest image). Thanks!
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.