diff --git a/defaults/meta/network-physical.nix b/defaults/meta/network-physical.nix index 69a4057..972476d 100644 --- a/defaults/meta/network-physical.nix +++ b/defaults/meta/network-physical.nix @@ -43,6 +43,7 @@ v4 = { id = "10.1.1.0"; prefixLength = 24; + # Note: DHCP from .2 to .249, see calanda config }; domain = "plessur-lan.net.qo.is"; @@ -50,6 +51,7 @@ calanda = { v4.ip = "10.1.1.1"; }; + cyprianspitz.v4.ip = "10.1.1.250"; }; }; diff --git a/nixos-configurations/cyprianspitz/networking.nix b/nixos-configurations/cyprianspitz/networking.nix index de8132d..3649afb 100644 --- a/nixos-configurations/cyprianspitz/networking.nix +++ b/nixos-configurations/cyprianspitz/networking.nix @@ -78,22 +78,5 @@ in qois.backplane-net.enable = true; # Configure this node to be used as an vpn exit node - qois.backup-client.includePaths = [ "/var/lib/tailscale" ]; - services.tailscale = { - enable = true; - openFirewall = true; - useRoutingFeatures = "server"; - authKeyFile = config.sops.secrets."tailscale/key".path; - extraUpFlags = [ - "--timeout 60s" - "--accept-dns=false" - "--login-server=https://vpn.qo.is" - "--advertise-exit-node" - ( - with meta.network.virtual.backplane.v4; "--advertise-routes=${id}/${builtins.toString prefixLength}" - ) - "--advertise-tags=tag:srv" - ]; - }; - + qois.vpn-exit-node.enable = true; } diff --git a/nixos-configurations/cyprianspitz/secrets.nix b/nixos-configurations/cyprianspitz/secrets.nix index 0e9f62c..d61753f 100644 --- a/nixos-configurations/cyprianspitz/secrets.nix +++ b/nixos-configurations/cyprianspitz/secrets.nix @@ -3,8 +3,5 @@ sops.secrets = { "system/hdd" = { }; "system/initrd-ssh-key" = { }; - "tailscale/key" = { - restartUnits = [ "tailscaled.service" ]; - }; }; } diff --git a/nixos-configurations/lindberg/networking.nix b/nixos-configurations/lindberg/networking.nix index 50c631c..35218f7 100644 --- a/nixos-configurations/lindberg/networking.nix +++ b/nixos-configurations/lindberg/networking.nix @@ -38,7 +38,7 @@ in in { enable = true; - resolveLocalQueries = false; + resolveLocalQueries = true; settings = { interface = "vms-nat"; bind-interfaces = true; @@ -74,20 +74,5 @@ in qois.backplane-net.enable = true; - # Use this node as vpn exit node - qois.backup-client.includePaths = [ "/var/lib/tailscale" ]; - services.tailscale = { - enable = true; - openFirewall = true; - useRoutingFeatures = "server"; - authKeyFile = config.sops.secrets."tailscale/key".path; - extraUpFlags = [ - "--login-server=https://vpn.qo.is" - "--advertise-exit-node" - ( - with meta.network.virtual.backplane.v4; "--advertise-routes=${id}/${builtins.toString prefixLength}" - ) - "--advertise-tags=tag:srv" - ]; - }; + qois.vpn-exit-node.enable = true; } diff --git a/nixos-modules/qois/loadbalancer/default.nix b/nixos-modules/qois/loadbalancer/default.nix index 56c7208..fe5477c 100644 --- a/nixos-modules/qois/loadbalancer/default.nix +++ b/nixos-modules/qois/loadbalancer/default.nix @@ -79,7 +79,7 @@ let in { - options.qois.loadbalancer = with lib; { + options.qois.loadbalancer = { enable = mkEnableOption "Enable services http+s loadbalancing"; domains = mkOption { diff --git a/nixos-modules/qois/vpn-exit-node/default.nix b/nixos-modules/qois/vpn-exit-node/default.nix new file mode 100644 index 0000000..aff1a84 --- /dev/null +++ b/nixos-modules/qois/vpn-exit-node/default.nix @@ -0,0 +1,50 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; +let + cfg = config.qois.vpn-exit-node; +in +{ + + options.qois.vpn-exit-node = { + enable = mkEnableOption "vpn exit node"; + domain = mkOption { + description = "Domain for the VPN admin server"; + type = types.str; + default = "vpn.qo.is"; + }; + }; + + config = mkIf cfg.enable { + + qois.backup-client.includePaths = [ "/var/lib/tailscale" ]; + + sops.secrets."tailscale/key".restartUnits = [ "tailscaled.service" ]; + + services.tailscale = { + enable = true; + openFirewall = true; + useRoutingFeatures = "server"; + authKeyFile = config.sops.secrets."tailscale/key".path; + extraUpFlags = + let + backplaneRoute = + with config.qois.meta.network.virtual.backplane.v4; + "${id}/${builtins.toString prefixLength}"; + in + [ + "--timeout 60s" + "--accept-dns=false" + "--accept-routes=false" + "--login-server=https://${cfg.domain}" + "--advertise-exit-node" + "--advertise-routes=${backplaneRoute}" + "--advertise-tags=tag:srv" + ]; + }; + }; +} diff --git a/nixos-modules/qois/vpn-server/default.nix b/nixos-modules/qois/vpn-server/default.nix index 0b23fdf..25ef0a0 100644 --- a/nixos-modules/qois/vpn-server/default.nix +++ b/nixos-modules/qois/vpn-server/default.nix @@ -56,6 +56,7 @@ in ); networking.firewall.checkReversePath = "loose"; + networking.firewall.allowedTCPPorts = [ config.services.headscale.port ]; networking.firewall.allowedUDPPorts = [ 41641 ];