feat(qbit): update vpn config
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-21 11:34:14 -04:00
parent 5013933f2b
commit 9e14b6aff2
3 changed files with 13 additions and 8 deletions

View file

@ -47,6 +47,7 @@ in {
configDir = mkOption {
type = types.path;
default = "${cfg.dataDir}/.config";
defaultText = "/var/lib/qbittorrent/.config";
description = ''
The directory where qBittorrent will store its configuration.
'';

View file

@ -4,6 +4,10 @@
...
}: let
inherit (config.sops) secrets;
wgPort = 51820;
clientIP = "10.2.0.2";
serverIP = "146.70.198.2";
in {
networking.wireguard = {
enable = true;
@ -11,9 +15,9 @@ in {
interfaces = {
wg0 = {
interfaceNamespace = "wg";
ips = ["10.2.0.2/32"];
ips = ["${clientIP}/32"];
listenPort = 51820;
listenPort = wgPort;
generatePrivateKeyFile = false;
privateKeyFile = secrets.vpn.path;
@ -22,7 +26,7 @@ in {
{
publicKey = "aQ2NoOYEObG9tDMwdc4VxK6hjW+eA0PLfgbH7ffmagU=";
allowedIPs = ["0.0.0.0/0"];
endpoint = "146.70.198.2:51820";
endpoint = "${serverIP}:${toString wgPort}";
}
];
};
@ -50,7 +54,7 @@ in {
wantedBy = ["multi-user.target"];
script = ''
${pkgs.iproute2}/bin/ip netns exec wg ${pkgs.iproute2}/bin/ip link set dev lo up
${pkgs.socat}/bin/socat tcp-listen:${port},fork,reuseaddr exec:'${pkgs.iproute2}/bin/ip netns exec wg ${pkgs.socat}/bin/socat STDIO "tcp-connect:10.2.0.2:${port}"',nofork
${pkgs.socat}/bin/socat tcp-listen:${port},fork,reuseaddr exec:'${pkgs.iproute2}/bin/ip netns exec wg ${pkgs.socat}/bin/socat STDIO "tcp-connect:${clientIP}:${port}"',nofork
'';
};
in {

8
flake.lock generated
View file

@ -1748,11 +1748,11 @@
]
},
"locked": {
"lastModified": 1728156372,
"narHash": "sha256-ZtR+8oRO/dDa656+9uyzUyBHcilLR52BfXy9bJJCblo=",
"lastModified": 1729524463,
"narHash": "sha256-cEz/j9vUjIgM9SNXN7nC68iZ2tJX+AI7eYhAR5A1hP0=",
"ref": "refs/heads/main",
"rev": "e835a0d7ea32f6818b57296f195ee914c26c5c0c",
"revCount": 80,
"rev": "abb53e86148fbe1b07485e104dd90f6a29693702",
"revCount": 81,
"type": "git",
"url": "ssh://git@git.nelim.org/matt1432/nixos-secrets"
},