Torrents and the VPN for torrents

Downloading and sharing torrents, the Torrents page, the qBittorrent WebUI,
setting up the VPN, port forwarding by provider, fail-closed, and what the VPN
does not protect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-11-28 12:38:52 -07:00
parent 32d8746222
commit 587467d13d
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
10 changed files with 215 additions and 1 deletions

View file

@ -21,6 +21,8 @@ The Download menu offers a form for each kind of download:
* **RSS Feed** — watch an RSS feed and automatically download new entries with either the Video or Archive
downloader. Options include the frequency and title/URL filters.
* **Files** — download any file from a URL into a directory of your choosing.
* **Torrent** — download torrents (magnet links, `.torrent` URLs or files), only through a VPN. See
[Torrents](../torrents/index.md).
* **Scrape** — crawl a web page (up to a chosen depth and page limit) collecting every linked file that matches your
list of file suffixes (for example `.pdf,.mp4`), then download those files to a destination.

View file

@ -0,0 +1,115 @@
# Torrents
WROLPi can download torrents, and share files from your library as torrents, so that others can download large open
data (maps, Zims, datasets) from you. Torrents only ever use a [VPN](vpn.md): peers see the VPN's address, never your
WROLPi's own. While the VPN is not connected, torrents are stopped.
![Torrents Page](torrents-page.png)
Before adding a torrent, [set up the VPN](vpn.md#setting-up-the-vpn).
## Downloading a Torrent
> To download a torrent, open the Download menu and click **Torrent**.
![Torrent Download Form](torrent-download-form.png)
Enter one or more magnet links or `.torrent` URLs (one per line), or choose a `.torrent` file, or both. The torrent is
saved in the `torrents` directory of your media directory unless you choose another destination. A destination can be
any directory in your library, but not WROLPi's `config` directory.
The form shows whether the VPN is connected. You can add a torrent while it is not; the torrent starts once the VPN
connects.
The Download is complete on the Downloads page once the torrent has been added. Its progress then shows on the
Downloads page and the Torrents page. When a torrent finishes downloading, its files are indexed like any other
download, and it keeps seeding.
## The Torrents Page
> To see your torrents, click **Admin**, then **Torrents**.
The top of the page shows:
* **VPN**: whether it is connected, the address peers see, and the port forwarded to this WROLPi (if any). The **VPN
settings** link opens the [VPN settings](vpn.md#setting-up-the-vpn).
* **Connectability**, while the VPN is connected:
| Shown | Meaning |
|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Peers can connect to this WROLPi | A peer has connected in through the forwarded port. Anyone can download from you. |
| Firewalled | No peer has connected in. You can still download, and upload to peers who accept connections, but peers behind their own firewalls cannot reach you. See [Port Forwarding](vpn.md#port-forwarding). |
* The total upload and download speeds, and the **Speed Limits**.
Each torrent's row shows its size, progress, ratio (uploaded ÷ size), seeds and peers, and state. Its buttons:
| Button | Action |
|------------------------|------------------------------------------------------------------------------------------------|
| Pause / Resume | Stop or start downloading and seeding this torrent. |
| Copy magnet link | Copy the torrent's magnet link, to give to others. |
| Download .torrent file | Download the torrent's `.torrent` file, to give to others. |
| Seeding limits | Stop seeding once a ratio is reached, or after a number of hours seeding. Empty seeds forever. |
| Remove | Stop the torrent. Its files stay in your library unless you choose **Also delete its files**. |
### Speed Limits
**Speed Limits** caps the total upload and download speed of all torrents, in KiB/s (0 is unlimited). Seeding can use
all of your upload bandwidth; limit uploads to keep the rest of your network usable.
## Sharing Files as a Torrent
You can make a torrent of a file or directory that is already in your library, and seed it from where it is.
> To share a file or directory, select it in **Files**, then click **Share**.
![Share as Torrent](share-as-torrent.png)
| Field | Purpose |
|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Trackers | One per line. Trackers help peers find each other; peers also find each other without them (DHT). Two public trackers are offered by default. |
| Use these trackers next time | Offer these trackers the next time you share. |
| Web seeds | Optional, one per line. URLs where the same file can also be downloaded (for example, a copy on a website), so downloads never depend on peers alone. |
Click **Make Torrent**. The torrent client reads every file to make the torrent, which takes a while for large files:
about an hour for hundreds of gigabytes on a Raspberry Pi. The progress is shown, and you can cancel it. When it is
done, copy its magnet link and give it to others, or download its `.torrent` file from the Torrents page.
The torrent is made in both torrent formats (v1 and v2), so every torrent client can download it.
A torrent cannot include:
* WROLPi's `config` directory, or your whole media directory (which holds it).
* Links to folders, or links to files outside your library.
**Warning!** Anything you share can be downloaded by anyone who has its magnet link. Only share files you have the
right to share.
## The qBittorrent WebUI
WROLPi uses [qBittorrent](https://www.qbittorrent.org/) to download and seed torrents. Its own interface (the WebUI)
offers more detail, such as each torrent's peers and files.
> To open the WebUI, click **qBittorrent WebUI** on the Torrents page.
The WebUI is served on port 8091 of your WROLPi (e.g. `https://wrolpi.local:8091`), to anyone on your network, without a
password. WROLPi manages qBittorrent's settings, so the WebUI cannot change them. Torrents added or removed in the
WebUI are added to or removed from WROLPi.
## WROL Mode
WROL Mode stops all torrents, and turns the VPN off, so nothing reaches the Internet and
nothing from it reaches your WROLPi. Torrents start again when WROL Mode is turned off.
## Where Torrents are Kept
Each torrent is kept in WROLPi's config directory, as `config/torrents/<hash>.yaml` (its name, destination, and
limits) with its `<hash>.torrent` file beside it. These configs are the source of truth: if qBittorrent's own state is
lost, WROLPi adds every torrent back from them, and checks the files already downloaded rather than downloading them
again.
A [secondary WROLPi](../../system/sync.md) does not copy the primary's torrents.
## Docker
In Docker, qBittorrent runs in the `vpn` container with the VPN. The host must provide `/dev/net/tun`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -0,0 +1,91 @@
# The VPN for Torrents
[Torrents](index.md) only reach the Internet through a VPN. Torrent peers see each other's addresses, so without a VPN
anyone sharing the same torrent sees your home's address. With the VPN, they see your VPN provider's address instead.
The VPN only carries torrents. The rest of WROLPi (downloads, upgrades, the Controller) uses your normal Internet
connection.
## Setting Up the VPN
You need an account with a VPN provider, and a WireGuard (`.conf`) or OpenVPN (`.ovpn`) config file from it. Most
providers offer these on their website, for use on routers or Linux.
> To set up the VPN, click **Admin**, then **Control**, and find the **VPN** section. The **VPN settings** link on the
> Torrents page opens it.
![VPN Settings](vpn-settings.png)
1. Click **Upload VPN Config**, and choose the file from your VPN provider.
2. If it is an OpenVPN config which needs a login, enter your provider's VPN username and password, and click
**Save Login**. (These are usually not your account's login; providers list them with their OpenVPN configs.)
3. Choose the [Port forwarding](#port-forwarding) your provider offers, and click **Save**.
4. Check **Turn on the VPN**.
The status shows **Connected**, and the address peers see, once the VPN is up. The same settings are on the
[Controller](../../controller/index.md)'s own page.
**Replace VPN Config** uploads a new file in place of the old one (for example, to use another server). **Remove**
deletes the config and the login, and turns the VPN off.
### What Configs Work
* **WireGuard**: any config with an `[Interface]` (PrivateKey and Address) and at least one `[Peer]` (PublicKey and
Endpoint). Commands in the config (`PostUp`, `PreDown`, etc.) are ignored.
* **OpenVPN**: TUN configs whose certificates and keys are inside the file (`<ca>`, `<cert>`, `<key>` blocks), as
providers' downloadable configs usually are. Configs which run scripts, use a proxy, or use TAP are refused, and
WROLPi says why.
## Port Forwarding
Torrent peers connect to each other. Without port forwarding, your WROLPi can only connect *out* to peers: you can
download, and upload to peers who accept connections, but peers behind their own firewalls (many home users) cannot
connect to you. The Torrents page shows this as **Firewalled**.
To seed to everyone, your VPN provider must forward a port to your WROLPi. Choose the mode your provider offers:
| Mode | When to use it |
|----------|----------------------------------------------------------------------------------------------------------------------|
| None | Your provider does not forward ports. Torrents work, but are firewalled. |
| Fixed | Your provider forwards a port you chose on their website. Enter that port. |
| NAT-PMP | Your provider gives a port to whoever asks (NAT-PMP). WROLPi asks for one, keeps it, and shows it in the status. |
Providers change what they offer; check your provider's website. At the time of writing:
| Provider | Port forwarding | How |
|--------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Proton VPN | NAT-PMP | Use a P2P server. For WireGuard, turn on NAT-PMP (port forwarding) when making the config. For OpenVPN, add `+pmp` to your OpenVPN username (e.g. `name+pmp`). |
| AirVPN | Fixed | Choose a port in AirVPN's Client Area, and enter it in WROLPi. |
| Mullvad, IVPN | None | Both stopped offering port forwarding in 2023. |
| Others | Varies | A provider which forwards a port through its own app, or changes the port every session, works with **None** only. |
## Fail-Closed
The VPN is fail-closed: torrents can only reach the Internet through it. If the VPN disconnects, cannot connect, is
turned off, or its config is removed, torrents stop; they never fall back to your WROLPi's own Internet connection.
Through the VPN, nothing from the Internet reaches your WROLPi except the forwarded port, and only the torrent client
listens on it.
When you have torrents and the VPN is not connected, a warning icon appears in the navigation bar. It opens the VPN
settings.
WROL Mode turns the VPN off.
## What the VPN Does Not Protect
The VPN hides your address from torrent peers and trackers. It does not:
* Hide what you share. Anyone with a torrent's magnet link can see what it contains, and download it.
* Make you anonymous to your VPN provider, which can see your traffic's destinations. Choose a provider you trust.
* Protect the rest of your network. Only torrents use the VPN.
* Keep a forwarded port private. Anyone on the Internet can connect to the torrent client through it. The torrent client
runs without privileges and cannot change WROLPi's config, but it can read and write your library. Keep your WROLPi
upgraded so it has the torrent client's latest security fixes.
## Where the VPN is Kept
The VPN config and login are kept in `config/vpn/`, and its settings in the `vpn` section of `controller.yaml`. WROLPi
never serves `config/vpn/` on your network, and a [secondary WROLPi](../../system/sync.md) does not copy it.
On a Raspberry Pi or Debian, the VPN is the `wrolpi-vpn` service and the torrent client is the `wrolpi-torrent`
service; see [Services](../../system/systemd.md). In Docker, both are in the `vpn` container.