mattev02/qbittorrent-over-openvpn

By mattev02

Updated 2 months ago

A qBittorrent client that routes all traffic through a VPN, ensuring privacy and security.

Image
Networking
Security
Web servers
0

3.2K

mattev02/qbittorrent-over-openvpn repository overview

qBittorrent over VPN

A Dockerized qBittorrent client that routes all traffic through a VPN, ensuring privacy and security. This project provides an out-of-the-box solution for running qBittorrent with OpenVPN, including automatic port forwarding (if supported by your VPN provider) and a kill switch to prevent IP leaks.


✨ Features

  • qBittorrent WebUI: Access and manage your torrents via a web interface.
  • OpenVPN Client: All traffic is routed through a VPN for privacy.
  • Kill Switch: Prevents IP leaks if the VPN connection drops.
  • Automatic Port Forwarding: Uses natpmpc to request and maintain an open port (if supported by your VPN provider).
  • Lightweight: Built on Debian Trixie slim for minimal resource usage.

🚀 How to Test

Prerequisites
  • Docker and Docker Compose installed on your system.
  • A VPN provider that supports OpenVPN and (optionally) port forwarding.
Steps
  1. Download the compose.yml file.
  2. Run the following command to start the container:
    docker compose up
    
  3. The container expects two volumes, edit compose.yml according to your setup:
    • /home/qbittorrent/Downloads: Where downloaded files will be stored.
    • /root/vpn-config: This folder must contain:
      • An .ovpn configuration file for your VPN.
      • A .txt file with your VPN credentials (username on the first line, password on the second).
  4. After starting the container, an automated routine asks the VPN server to forward a port through natpmpc then the received port is shown in the container logs:
    docker logs <container_name>
    
  5. Access the qBittorrent WebUI using the provided address. The default login credentials are:
    • Username: admin
    • Password: adminadmin ⚠️ Important: Change the password after your first login.
  6. The qBittorrent port should be up to date with the output of Docker logs. Check it from the "Settings" panel in the WebUI.

🛠️ Troubleshooting

natpmpc Errors

natpmpc requires the VPN tunnel interface gateway to work. Due to routing table conflicts, the gateway cannot be automatically detected. If the heuristic fails, manually override it by setting the VPN_GATEWAY environment variable in your compose.yml:

environment:
  VPN_GATEWAY: <your_vpn_gateway_ip>

This works only if you VPN provider allows port forwarding through natpmpc requests. If you want to disable this routine just define in your compose.yml this variable DISABLE_NATPMPC.
⚠️ Important: You won't be able to seed your torrents!

Firewall Configuration

The container enforces the following firewall rules by default:

RulePolicy
Traffic through tun0ALLOW
UDP traffic to <VPN_ADDRESS> port 1194ALLOW
Replies from <VPN_ADDRESS> port 1194ALLOW
Incoming TCP traffic to port 8080ALLOW
Replies from port 8080ALLOW
DNS requests to 1.1.1.1 port 53ALLOW
Replies from 1.1.1.1 port 53ALLOW
All other trafficDROP

Note: The qBittorrent WebUI can only be hosted on port 8080.


🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.


📜 License

This project is licensed under the Unlicense License.

Tag summary

Content type

Image

Digest

sha256:7ce0b16f9

Size

99.4 MB

Last updated

2 months ago

docker pull mattev02/qbittorrent-over-openvpn