wrolpi/docker/vpn/Dockerfile
lrnselfreliance 2c3300b8b0
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>
2026-11-28 14:26:24 -07:00

20 lines
970 B
Docker

# The VPN and the torrent client (qBittorrent) that uses it, in one container. The container's network namespace is
# the fail-closed network: the tunnel's kill switch (controller/vpn/tunnel.py) lets nothing out except through the VPN.
# qBittorrent's WebUI (8091) is served to the LAN by Caddy.
FROM debian:trixie-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends iproute2 nftables openvpn wireguard-tools python3 python3-yaml \
ca-certificates qbittorrent-nox \
&& rm -rf /var/lib/apt/lists/*
COPY controller/vpn/tunnel.py /app/tunnel.py
COPY modules/torrents/qbittorrent_prepare.py /app/qbittorrent_prepare.py
COPY docker/vpn/entrypoint.sh /app/entrypoint.sh
# qBittorrent's own state, outside the library (a named volume, which takes this owner when it is first used). A new
# one re-adds every torrent from config/torrents/.
RUN mkdir /profile && chown 1000:1000 /profile
ENV PYTHONUNBUFFERED=1
CMD ["/app/entrypoint.sh"]