wrolpi/etc/raspberrypios/wrolpi-vpn.service
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

22 lines
940 B
Desktop File

[Unit]
Description=WROLPi VPN for torrents (fail-closed network namespace)
PartOf=wrolpi.target
After=network-online.target wrolpi-mounts.service
Wants=network-online.target
[Service]
# Follows the `vpn` section of controller.yaml; idles while the VPN is off. The namespace and its kill switch outlive
# this service, so torrents have no way out while the tunnel is down.
# wrolpi-torrent.service waits for this run's first status (written once the kill switch is in place).
ExecStartPre=/bin/rm -f /run/wrolpi-vpn/status.json
ExecStartPre=/opt/wrolpi/etc/raspberrypios/wrolpi-vpn-netns.sh up
ExecStart=/usr/bin/ip netns exec wrolpi-vpn /opt/wrolpi/controller/venv/bin/python /opt/wrolpi/controller/vpn/tunnel.py run --resolv-conf /etc/netns/wrolpi-vpn/resolv.conf
Environment=MEDIA_DIRECTORY=/media/wrolpi
RuntimeDirectory=wrolpi-vpn
RuntimeDirectoryPreserve=yes
User=root
Restart=always
RestartSec=10
[Install]
WantedBy=default.target