feat(terra): qBittorrent confined to a ProtonVPN WireGuard netns

The qBittorrent GUI runs as a system unit inside a `proton` network
namespace whose only interface is WireGuard to Proton (NL#490, P2P with
NAT-PMP) and whose only route is the tunnel, so a dropped VPN stalls
torrents instead of leaking them. DNS goes to Proton's 10.2.0.1, with
the host's nscd/resolved sockets hidden since they would answer from the
root namespace. A NAT-PMP loop keeps Proton's forwarded port mapped and
sets it through the netns-local WebUI.

qbittorrent itself is not on PATH: the qbittorrent-vpn launcher and
desktop entry (also the magnet/.torrent handler, via a watch folder)
start the unit, which polkit lets darman start and stop without a
password. The namespace comes up with the GUI and goes away with it.

The client is internet-facing, so it is sandboxed too: it sees only its
own state, the watch folder, the download dir and read-only theming;
the rest of $HOME, /mnt, darman's sops secrets, pass-broker/tailscale
sockets and the session bus are gone. The bus would let it run anything
through systemd --user, so no tray icon or notifications.

Covered by checks.qbittorrent-vpn against a fake Proton peer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 11:38:05 +02:00
co-authored by Claude Opus 5.5
parent 71f3dec4b5
commit 2719ed7707
5 changed files with 497 additions and 0 deletions
+11
View File
@@ -10,6 +10,7 @@
../../profiles/workstation.nix
../../services/desktop/luna-voice.nix
../../services/dev/turtle-beach-re.nix
../../services/desktop/qbittorrent-vpn.nix
inputs.turtle-beach-swarm-re.nixosModules.release
inputs.tbctl.nixosModules.tbctl
];
@@ -95,6 +96,16 @@
'';
};
# Peer values from a Proton WireGuard config generated for a P2P server
# with NAT-PMP on; its PrivateKey is protonvpn_wg_private_key in sops.
homelab.qbittorrentVpn = {
enable = true;
downloadDir = "/mnt/hdd_01/data/Downloads/Torrents";
privateKeyFile = config.sops.secrets.protonvpn_wg_private_key.path;
peerPublicKey = "nPCWC0rx9ZXEkzh7dxMUTO5/HUqDaLaD827Yp1sJCQU=";
endpoint = "103.69.224.2:51820"; # NL#490
};
networking.hostName = "terra";
home-manager.users.darman.homelab.desktop = {
+1
View File
@@ -10,6 +10,7 @@
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.secrets.tailscale_authkey = { };
sops.secrets.protonvpn_wg_private_key = { };
sops.secrets.darman_password.neededForUsers = true;
users.users.darman.hashedPasswordFile = config.sops.secrets.darman_password.path;