guillaumedsde / alpine-qbittorrent-openvpn

qBittorrent docker container with OpenVPN client running as unprivileged user on alpine linux
https://guillaumedsde.gitlab.io/alpine-qbittorrent-openvpn/
GNU General Public License v3.0
216 stars 40 forks source link

NordVPN issue #11

Closed Rubl80 closed 4 years ago

Rubl80 commented 4 years ago

Hi,

I am having difficulties with NordVPN. Anybody have an idea what I am doing wrong?

First I tried: -v /my/path:/downloads \ -v /etc/localtime:/etc/localtime:ro \ -e OPENVPN_PROVIDER=NORDVPN \ -e OPENVPN_USERNAME=“MyUserID” \ -e OPENVPN_PASSWORD=“MyPass” \ -e OPENVPN_CONFIG=DE\ Berlin \ -e PGID=1000 \ -e PUID=1000 \ -e LAN=192.168.0.0/16 \ -p 8080:8080 \ guillaumedsde/alpine-qbittorrent-openvpn:latest

And got this: INFO: Trying to use OpenVPN provider: NORDVPN ERROR: Could not find OpenVPN configuration "" for provider NORDVPN

The same error for these two docker run: -v /my/path:/downloads \ -v /etc/localtime:/etc/localtime:ro \ -e OPENVPN_PROVIDER=NORDVPN \ -e OPENVPN_USERNAME=“MyUserID” \ -e OPENVPN_PASSWORD=“MyPass” \ -e OPENVPN_CONFIG=DE\ -e PGID=1000 \ -e PUID=1000 \ -e LAN=192.168.0.0/16 \ -p 8080:8080 \ guillaumedsde/alpine-qbittorrent-openvpn:latest

and -v /my/path:/downloads \ -v /etc/localtime:/etc/localtime:ro \ -e OPENVPN_PROVIDER=NORDVPN \ -e OPENVPN_USERNAME=“MyUserID” \ -e OPENVPN_PASSWORD=“MyPass” \ -e NORDVPN_COUNTRY=CH \ -e NORDVPN_PROTOCOL=udp \ -e NORDVPN_CATEGORY=P2P \ -e PGID=1000 \ -e PUID=1000 \ -e LAN=192.168.0.0/16 \ -p 8080:8080 \ guillaumedsde/alpine-qbittorrent-openvpn:latest

My final attempt was with a custom openvpn config file: -v /my/path/:/downloads \ -v /my/path/:/config \ -v /etc/localtime:/etc/localtime:ro \ -e OPENVPN_PROVIDER= \ -e OPENVPN_USERNAME=“MyUserID” \ -e OPENVPN_PASSWORD=“MyPass” \ -e PGID=1000 \ -e PUID=1000 \ -e LAN=192.168.0.0/16 \ -p 8080:8080 \ guillaumedsde/alpine-qbittorrent-openvpn:latest

And got this error: OpenVPN provider not set. Using configuration at /config/openvpn/config.ovpn [cont-init.d] 02-setup-openvpn: exited 0. [cont-init.d] 03-setup-iptables: executing... [cont-init.d] 03-setup-iptables: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/config.ovpn Use --help for more information.

Anybody know what I am doing wrong? I can get haugene/docker-transmission-openvpn to work with the docker run no3, but I would prefer to use qBittorrent.

guillaumedsde commented 4 years ago

hum it seems haugene is using a small script when using NordVPN to select the config, I'll port it over to this container

Rubl80 commented 4 years ago

Sounds great. Thx :)

riddertommie commented 4 years ago

Same thing here with SurfShark

After some time I get:

Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/config.ovpn Use --help for more information.

Then the container goes to unhealthy.

using; guillaumedsde/alpine-qbittorrent-openvpn:python

guillaumedsde commented 4 years ago

hum, so Haugene's scripts for NordVPN are a bit more complex than I thought, I'll need more time, @Rubl80 your idea of mounting the OpenVPN config is the correct workaround.

@riddertommie @Rubl80 could one of you check if if the VPN config is present in the container at /config/openvpn/config.ovpn and show its permissions?

you would need to run a shell in the container using docker run -it <name of the container> sh and the run ls -al /config/openvpn/config.ovpn in that shell and post the output here

riddertommie commented 4 years ago

Here you are. I did try to manual change the permissions off the file via the 'mounted' volume but that did not help.

/ # ls -al /config/openvpn/config.ovpn -rw------- 1 openvpn openvpn 2905 Mar 29 13:37 /config/openvpn/config.ovpn / # ls bin dev etc init libexec mnt proc run srv tmp var config downloads home lib media opt root sbin sys usr / # cd /config/openvpn/ /config/openvpn # ls config.ovpn openvpn-credentials.txt /config/openvpn # pwd /config/openvpn /config/openvpn #

Rubl80 commented 4 years ago

Same result from me.. -rw------- 1 openvpn openvpn 2806 Jun 30 16:38 /config/openvpn/config.ovpn

guillaumedsde commented 4 years ago

Here you are. I did try to manual change the permissions off the file via the 'mounted' volume but that did not help.

Yeah, the container sets the permissions and ownership on the config directory on start (to the given PUID and GUID, except for the /config/openvpn directory which is owned by the openvpn user)

I'll take another look when I find some time

guillaumedsde commented 4 years ago

I managed to reproduce the issue, looking for a solution

guillaumedsde commented 4 years ago

hi @riddertommie @Rubl80 should be fixed as of 57dfeab27e7c5b0bb0dc3cacff9ecfcef968b54d try pulling latest or python and let me know if its fixed for you :)

Rubl80 commented 4 years ago

Hi @guillaumedsde good news! its working now with custom .ovpn file. Great work, thx :)

But for some reason I need to type in a username/password in the webui? I looked through your documentation, but found no mentioned of it. I have tried with admin/adminadmin and similar, but it's not accepting it. Is there a standard username & password I need to enter?

Rubl80 commented 4 years ago

Got the WebUI working with admin/adminadmin now.. A reinstallation of the container fixed it somehow.

Thx again @guillaumedsde 👍

guillaumedsde commented 4 years ago

np :) closing this issue

riddertommie commented 4 years ago

did a rebuild yesterday and today still working without error's.

Thanks!

riddertommie commented 4 years ago

Error came back, I will open a new issue related to surfshark only.

Rubl80 commented 4 years ago

Mine with custom NordVPN ovpn config, has been going strong for a couple of days now. I also had a look through the logs an no such errors anymore. I also did a restart of the container and it's working fine.

But I will keep an eye on it, and report back if issue also come back on my end.

jtarvainen commented 2 years ago

@guillaumedsde I actually still have this issue. I'm running DSM 7 on an ARM-based Synology NAS and the latest build of guillaumedsde/alpine-qbittorrent-openvpn as of today (2021-12-29). When I run the container, I get the same error quoted earlier in this thread:

Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/config.ovpn

I'm using ExpressVPN and have retrieved the config.ovpn file directly from their website. I've placed the file in the config/openvpn/ folder.

Here's my full docker-compose.yml file:

version: "3.3"
services:
  alpine-qbittorrent-openvpn:
    image: guillaumedsde/alpine-qbittorrent-openvpn:latest
    container_name: qbittorrent
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - PUID=1000
      - PGID=1000
      - LAN=192.168.0.0/16
      - OPENVPN_USERNAME=<username>
      - OPENVPN_PASSWORD=<password>
    network_mode: host
    ports:
      - "8080:8080"
    privileged: true
    volumes:
      - "/volume1/docker/alpine-qbittorrent-openvpn/config:/config"
      - "/volume1/media/downloads:/downloads"
      - "/etc/localtime:/etc/localtime:ro"

One thing I haven't seen mentioned in the threads I've looked at is the use of network_mode: host. I've been under the impression that at least for ARM-based Synology devices, the only way to run Docker is in "host" network mode. In any case, I've been unable to get any other mode to work. Have I missed something?

Thanks in advance for any help!

riddertommie commented 2 years ago

Just a hunch, You are saying that you are using ExpressVPN but you are not setting it in the environment VPN_ENABLED & VPN_TYPE. So is assumes you are providing a .ovpn file yourself. Is this correct or?

jtarvainen commented 2 years ago

Thanks for your response! I've tried both placing the file in the folder, or retrieving it from the online configs repo by specifying the following in my docker-compose.yml:

environment:
      - OPENVPN_PROVIDER=EXPRESSVPN
      - OPENVPN_CONFIG=my_expressvpn_sweden_udp
      - ...

If I don't provide the file locally, the logs show the following:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-setup-permissions: executing... 
[cont-init.d] 01-setup-permissions: exited 0.
[cont-init.d] 02-setup-openvpn: executing... 
2021-12-30 14:47:14 TUN/TAP device tun0 opened
2021-12-30 14:47:14 Persist state set to: ON
INFO: Trying to use OpenVPN provider: EXPRESSVPN
[... list of contents of configs repo directory ...]
Exported revision 1276.
INFO: Found OpenVPN configuration: "my_expressvpn_sweden_udp" for provider "EXPRESSVPN" using it
[cont-init.d] 02-setup-openvpn: exited 0.
[cont-init.d] 03-setup-iptables: executing... 
iptables v1.8.7 (legacy): host/network `192.168.1.117/16
169.254.178.224/16
172.17.0.1' not found
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.7 (legacy): host/network `192.168.1.117/16
169.254.178.224/16
172.17.0.1' not found
Try `iptables -h' or 'iptables --help' for more information.
[cont-init.d] 03-setup-iptables: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Options error: In [CMD-LINE]:1: Error opening configuration file: /config/openvpn/config.ovpn
Use --help for more information.