qBitTorrent : use sudo/su to install VPN

Hello, I’ve installed qBitTorrent on my Truenas using the Truenas Official App and I’m trying to install a VPN inside the container so that I torrent safely. Problem is, I don’t have access to sudo or su to install my VPN provider client.

image

I don’t think there’s any point editing the running container anyway, it will revert to the original state from it’s image on reboot…you’d likely want to create an alternative docker image with vpn support and then load that in via the custom app option. I have just got something working but it requires docker compose as it uses one image for vpn and then has the qbittorrent image using the vpn image to connect, this is working in a nightly electric eel release I have running on a VM. None of this is straight forward and would require some effort on the learning front.

For now if that seems like too much work then you could look into setting up vpn on your router instead?

Maybe there are more options out there, potentially someone else has a single working docker image with just what you need that you could use? If you can handle installing custom apps then this would work well, if you can find something. A lot depends on the vpn provider you are with too and what they support etc.

For what it’s worth this is what I have working in Electric Eel through docker compose in portainer

services:
  openvpn-client:
    image: dperson/openvpn-client
    container_name: openvpn-client
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun    
    ports:
      - 8080:8080
      - 6881:6881
      - 6881:6881/udp      
    environment:
      - PUID=568
      - PGID=568
      - DEFAULT_GATEWAY="false"
      - DNS="true"
    volumes:
      - /mnt/volume1/containers/openvpn:/vpn
    healthcheck:
      test: curl --fail ifconfig.me || exit 1
      interval: 60s
      retries: 5
      start_period: 20s
      timeout: 10s  
    restart: unless-stopped    
  curl-test:
    image: curlimages/curl:latest
    network_mode: "service:openvpn-client"
    command: curl ifconfig.me
    depends_on:
      openvpn-client:
        condition: service_healthy          
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    network_mode: "service:openvpn-client"
    depends_on:
      openvpn-client:
        condition: service_healthy            
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - WEBUI_PORT=8080
      - TORRENTING_PORT=6881
    volumes:
      - /mnt/volume1/containers/qbittorrent:/config
      - /mnt/volume1/downloads:/downloads
    restart: unless-stopped



It requires a an openvpn config file from the provider along with a credentials and cert files it points to etc etc

I think I’ll do that. I found a docker container with the VPN preinstalled but I lack the knowledge to make my own custom app on Truenas Scale. I’ve tried watching some YT tutorials but I think I lack the basic Docker knowledge.

Also I can’t use Wireguard or OpenVPN as they are not compatible with my VPN.

1 Like

you can’t install additional packages inside the container. Apps are pre-configured programs. If the creator of the app didn’t include it when he created the app, you can’t add it manually. The official apps that are available right now don’t support vpns.

You should be able to run that on Drangonfish using a docker sandbox with Jailmaker

1 Like

Yep, I’ve set it up in the past to try it out, using you’re video :slight_smile: I think I still have it setup on the main dragonfish install I have, but I didn’t want to invest lots of time and energy on it given I’m just establishing what I need for a new truenas based nas. I wanted to try the new docker instead of kubernetes approach for electric eel and it’s been really good so far…I’m happy to wait to get everything in place proper when the next release turns up in production

Just watched your network bridge tutorial too, will be applying that soon…although I still need to get my head around bridges in docker to share network connectivity between stacks I think, thinking maybe some nginx mixed in there too…still playing though :slight_smile:

1 Like

Will Jailmaker become deprecated with the new Docker (replacing kubernetes)? I’ve heard of Jailmaker but never understood what it was. The only jails I know are the ones on Truenas Core when you install plugins.

Depends what you use jails for, if just to run containers through docker instead of kubernetes then yes I think so.

The Electric Eel release has support for either Dockge or Portainer, I am finding now that I just install either of those through the apps page and then everything else I setup through docker compose with bind mounts to storage I manage.

Here is yet a second working qbit config

This one works great with gluetun which works with near everything

services:
  gluetun:
    container_name: qbit-gluetun
    image: qmcgaw/gluetun:v3
    user: 0:568
    ports:
      - 6881:6881 # Torrent
      - 6881:6881/udp # Torrent
      - 8085:8085   # QBIT WEB GUI
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    restart: unless-stopped
    environment:
      - PUID=insertuserid
      - VPN_SERVICE_PROVIDER=${VSP}
      - VPN_TYPE=${VT}
      - WIREGUARD_PRIVATE_KEY=${WPK}
      - WIREGUARD_PRESHARED_KEY=${WPSK}
      - WIREGUARD_ADDRESSES=${WGA}
      - SERVER_COUNTRIES=${SC}
      - TZ=${TZ}
      - FIREWALL_OUTBOUND_SUBNETS=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
    volumes:
      - inserthostpath:/gluetun
  qbittorrent:
    container_name: qbittorrent #temporary passowrd in container logs
    image: ghcr.io/linuxserver/qbittorrent:4.6.6
    restart: unless-stopped
    environment:
      - PUID=insertuserid
      - PGID=instergroupid
      - TZ=${TZ}
      - WEBUI_PORT=8085
      - WebUI\CSRFProtection=false
      - WebUI\ClickjackingProtection=false
      - WebUI\HostHeaderValidation=false
    network_mode: service:gluetun
    depends_on:
      - gluetun
    volumes:
      - inserthostpath:/config
      - inserthostpath:/mnt/insertnameofdlfolder
1 Like