feat(qbit): update vpn config
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
5013933f2b
commit
9e14b6aff2
3 changed files with 9 additions and 4 deletions
|
@ -47,6 +47,7 @@ in {
|
||||||
configDir = mkOption {
|
configDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "${cfg.dataDir}/.config";
|
default = "${cfg.dataDir}/.config";
|
||||||
|
defaultText = "/var/lib/qbittorrent/.config";
|
||||||
description = ''
|
description = ''
|
||||||
The directory where qBittorrent will store its configuration.
|
The directory where qBittorrent will store its configuration.
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (config.sops) secrets;
|
inherit (config.sops) secrets;
|
||||||
|
|
||||||
|
wgPort = 51820;
|
||||||
|
clientIP = "10.2.0.2";
|
||||||
|
serverIP = "146.70.198.2";
|
||||||
in {
|
in {
|
||||||
networking.wireguard = {
|
networking.wireguard = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -11,9 +15,9 @@ in {
|
||||||
interfaces = {
|
interfaces = {
|
||||||
wg0 = {
|
wg0 = {
|
||||||
interfaceNamespace = "wg";
|
interfaceNamespace = "wg";
|
||||||
ips = ["10.2.0.2/32"];
|
ips = ["${clientIP}/32"];
|
||||||
|
|
||||||
listenPort = 51820;
|
listenPort = wgPort;
|
||||||
|
|
||||||
generatePrivateKeyFile = false;
|
generatePrivateKeyFile = false;
|
||||||
privateKeyFile = secrets.vpn.path;
|
privateKeyFile = secrets.vpn.path;
|
||||||
|
@ -22,7 +26,7 @@ in {
|
||||||
{
|
{
|
||||||
publicKey = "aQ2NoOYEObG9tDMwdc4VxK6hjW+eA0PLfgbH7ffmagU=";
|
publicKey = "aQ2NoOYEObG9tDMwdc4VxK6hjW+eA0PLfgbH7ffmagU=";
|
||||||
allowedIPs = ["0.0.0.0/0"];
|
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"];
|
wantedBy = ["multi-user.target"];
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.iproute2}/bin/ip netns exec wg ${pkgs.iproute2}/bin/ip link set dev lo up
|
${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 {
|
in {
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
Loading…
Reference in a new issue