Torrents over a fail-closed VPN (#1026)

Torrents reach the Internet only through a fail-closed VPN (WireGuard or
OpenVPN, any provider), so peers never see a WROLPi's own address.

- A network namespace (Pi/Debian) or the vpn container (Docker) with an
  nftables kill switch; NAT-PMP or fixed port forwarding.
- qBittorrent inside it, sandboxed; torrents kept in config/torrents/.
- Torrent download form, Torrents page, Share as torrent, nav warning, and
  VPN settings in both Controller UIs.
- Help docs: Torrents, and The VPN for Torrents.

QA'd on a Raspberry Pi with a real provider over WireGuard and OpenVPN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-28 14:25:24 -07:00 • committed by Roland
parent 633b125dc6
commit 2c3300b8b0
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
80 changed files with 7516 additions and 45 deletions

View file

@ -5,6 +5,8 @@ Controller starts with these defaults and loads overrides from
/media/wrolpi/config/controller.yaml after the drive is mounted.
"""
from controller.vpn.tunnel import VPN_DEFAULTS
DEFAULT_CONFIG = {
"port": 80,
"media_directory": "/media/wrolpi",
@ -89,6 +91,22 @@ DEFAULT_CONFIG = {
"use_https": False,
"description": "Map tiles for ATAK and iTAK",
},
{
"name": "wrolpi-vpn",
"systemd_name": "wrolpi-vpn",
"port": None,
"viewable": False,
"use_https": False,
"description": "VPN for torrents (fail-closed network namespace)",
},
{
"name": "wrolpi-torrent",
"systemd_name": "wrolpi-torrent",
"port": 8091,
"viewable": True,
"use_https": True,
"description": "Torrents (qBittorrent, inside the VPN)",
},
{
"name": "wrolpi-rsyncd",
"systemd_name": "wrolpi-rsyncd",
@ -147,6 +165,9 @@ DEFAULT_CONFIG = {
"on_startup": True,
},
# Torrents reach the Internet only through this VPN; see controller/vpn/tunnel.py.
"vpn": dict(VPN_DEFAULTS),
"throttle": {
"default_governor": "ondemand",
},