expand vpnNamespaceOpenPort

This commit is contained in:
Simon Gardling 2025-08-20 12:33:27 -04:00
parent 87a5466411
commit a827438a4c
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
3 changed files with 7 additions and 14 deletions

View File

@ -55,7 +55,7 @@ inputs.nixpkgs.lib.extend (
]; ];
vpnNamespaceOpenPort = vpnNamespaceOpenPort =
port: port: service:
{ ... }: { ... }:
{ {
vpnNamespaces.wg = { vpnNamespaces.wg = {
@ -73,6 +73,10 @@ inputs.nixpkgs.lib.extend (
} }
]; ];
}; };
systemd.services.${service}.vpnConfinement = {
enable = true;
vpnNamespace = "wg";
};
}; };
} }
) )

View File

@ -7,7 +7,7 @@
}: }:
{ {
imports = [ imports = [
(lib.vpnNamespaceOpenPort service_configs.ports.bitmagnet) (lib.vpnNamespaceOpenPort service_configs.ports.bitmagnet "bitmagnet")
]; ];
services.bitmagnet = { services.bitmagnet = {
@ -28,9 +28,4 @@
${builtins.readFile ../secrets/caddy_auth} ${builtins.readFile ../secrets/caddy_auth}
reverse_proxy ${service_configs.https.wg_ip}:${builtins.toString service_configs.ports.bitmagnet} reverse_proxy ${service_configs.https.wg_ip}:${builtins.toString service_configs.ports.bitmagnet}
''; '';
systemd.services.bitmagnet.vpnConfinement = {
enable = true;
vpnNamespace = "wg";
};
} }

View File

@ -13,7 +13,7 @@
config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath
"${config.services.qbittorrent.profileDir}/qBittorrent" "${config.services.qbittorrent.profileDir}/qBittorrent"
]) ])
(lib.vpnNamespaceOpenPort config.services.qbittorrent.webuiPort) (lib.vpnNamespaceOpenPort config.services.qbittorrent.webuiPort "qbittorrent")
]; ];
services.qbittorrent = { services.qbittorrent = {
@ -203,12 +203,6 @@
"d ${config.services.qbittorrent.profileDir} 0700 ${config.services.qbittorrent.user} ${config.services.qbittorrent.group}" "d ${config.services.qbittorrent.profileDir} 0700 ${config.services.qbittorrent.user} ${config.services.qbittorrent.group}"
]; ];
# make qbittorrent use a vpn
systemd.services.qbittorrent.vpnConfinement = {
enable = true;
vpnNamespace = "wg";
};
services.caddy.virtualHosts."torrent.${service_configs.https.domain}".extraConfig = '' services.caddy.virtualHosts."torrent.${service_configs.https.domain}".extraConfig = ''
${builtins.readFile ../secrets/caddy_auth} ${builtins.readFile ../secrets/caddy_auth}
reverse_proxy ${service_configs.https.wg_ip}:${builtins.toString config.services.qbittorrent.webuiPort} reverse_proxy ${service_configs.https.wg_ip}:${builtins.toString config.services.qbittorrent.webuiPort}