Files
homelab/hosts/terra/secrets.nix
T
darmanandClaude Opus 5.5 2719ed7707 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>
2026-10-21 11:38:05 +02:00

30 lines
1.4 KiB
Nix

{ config, ... }:
# sops-nix wiring for terra (desktop). Encrypted values in ../../secrets/terra.yaml,
# decrypted with terra's own SSH host key (recipient in ../../.sops.yaml).
# The host key is pre-generated on the laptop and shipped at install
# (nixos-anywhere --extra-files -> /etc/ssh/ssh_host_ed25519_key).
# samba + pass-broker secrets are declared in profiles/workstation.nix.
{
sops.defaultSopsFile = ../../secrets/terra.yaml;
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;
# luna-voiced (services/desktop/luna-voice.nix) runs as a USER service, so
# these cannot stay root:root 0400 — a user manager cannot read them and
# LoadCredential does not bridge that gap either. Hence owner, not mode.
#
# hermes_api_server_key mirrors secrets/mars.yaml (the serving side);
# elevenlabs_api_key mirrors it too, because client-direct TTS is the
# documented low-latency path — terra calls ElevenLabs itself rather than
# relaying audio through mars. Rotating that key therefore touches BOTH
# files; see CLAUDE.md.
sops.secrets.hermes_api_server_key.owner = "darman";
sops.secrets.elevenlabs_api_key.owner = "darman";
}