Joentje / nordvpn-proxy

Use NordVPN in your Docker stack
141 stars 53 forks source link

Creating tun device /dev/net/tun if not specified #30

Closed MurattuW closed 4 years ago

MurattuW commented 4 years ago

Hello,

First thank you for this amazing repo :smiley: I wanted to add my contribution to make the argument --device. In my understanding, this argument creates a device volume between the host and the container. It can be difficult to support that in some environments (like in Kubernetes).

It's just easier to create the device with mknod directly in the container. The capability NET_ADMIN is still necessary ! More information here: https://www.kernel.org/doc/Documentation/networking/tuntap.txt

I have pushed this on DockerHub (Tag: murattuw/nordvpn-proxy:optional_tun_device)

The following works:

docker run --rm -d \
        --cap-add=NET_ADMIN \
        --name=vpn \
        --dns=103.86.96.100 \
        --dns=103.86.99.100 \
        -e "USERNAME=$nordvpn_username" \
        -e "PASSWORD=$nordvpn_password" \
        -p "127.0.0.1:8118":8118 \
        murattuw/nordvpn-proxy:optional_tun_device

Best regards,

Joentje commented 4 years ago

Hi @MurattuW, thank you for you contribution! LGTM! This is indeed a better way of supporting the tun device 👍 . I will merge it, then it will be available on the latest tag.