Skip to content

Wireguard leaks IP address in client mode if connection fails #139

@master-hax

Description

@master-hax

linuxserver.io


Expected Behavior

the command curl api.ipify.org from within the container should fail if the VPN connection is not up

Current Behavior

the command curl api.ipify.org from within the container succeeds & shows the docker host's external IP address if the VPN connection is not up

Steps to Reproduce

  1. put a valid wg0.conf in ./config
  2. start this docker-compose file to run wireguard in client mode:
version: "3.7"
  services:
    vpn-client:
        image: linuxserver/wireguard
        restart: unless-stopped
        cap_add:
          - NET_ADMIN
          - SYS_MODULE
        environment:
          - TZ=America/Los_Angeles
        volumes:
          - /lib/modules:/lib/modules
          - ./config:/config
        sysctls:
          - net.ipv4.conf.all.src_valid_mark=1
          - net.ipv6.conf.all.disable_ipv6=0
  1. run docker exec -it vpn-client_1 curl api.ipify.org. you will see the IP address of your VPN server exit node as expected.
  2. delete ./config/wg0.conf then run docker restart vpn-client_1. now the connection should fail. we can confirm from the logs:
**** Client mode selected. ****
**** No client conf found. Provide your own client conf as "/config/wg0.conf" and restart the container. ****
  1. run docker exec -it vpn-client_1 curl api.ipify.org again. we expect the request to fail this time, but instead you will see the external IP address of the docker host

Environment

OS: dietpi
CPU architecture: x86_64/arm32/arm64
How docker service was installed: i don't remember

Command used to create docker container (run/create/compose/screenshot)

Docker logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions