From ef4a991f05f7c115b3fb865cbbb55a622cee9dec Mon Sep 17 00:00:00 2001 From: Florian Sesser <florian@privatestorage.io> Date: Sun, 16 May 2021 19:17:48 +0000 Subject: [PATCH] vpn: ip (singular) --- morph/lib/make-issuer.nix | 2 +- morph/lib/make-monitoring.nix | 2 +- nixos/modules/monitoring/vpn/client.nix | 9 ++++----- nixos/modules/monitoring/vpn/server.nix | 11 +++++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/morph/lib/make-issuer.nix b/morph/lib/make-issuer.nix index 5d0c32b6..97bee06a 100644 --- a/morph/lib/make-issuer.nix +++ b/morph/lib/make-issuer.nix @@ -64,7 +64,7 @@ services.private-storage.monitoring.vpn.client = { enable = true; privateKeyFile = /var/secrets/monitoringvpn/client.key; - ips = ["172.23.23.11/24"]; + ip = "172.23.23.11"; endpointPublicKeyFile = /home/flo/Repositories/PrivateStorageio/morph/PrivateStorageSecrets/monitoringvpn/server.pub; }; } diff --git a/morph/lib/make-monitoring.nix b/morph/lib/make-monitoring.nix index 892ef5ad..aeb9b8d8 100644 --- a/morph/lib/make-monitoring.nix +++ b/morph/lib/make-monitoring.nix @@ -30,7 +30,7 @@ services.private-storage.monitoring.vpn.server = { enable = true; - ips = [ "172.23.23.1/24" ]; + ip = "172.23.23.1"; }; system.stateVersion = stateVersion; diff --git a/nixos/modules/monitoring/vpn/client.nix b/nixos/modules/monitoring/vpn/client.nix index 4ee5ed4e..19cefd56 100644 --- a/nixos/modules/monitoring/vpn/client.nix +++ b/nixos/modules/monitoring/vpn/client.nix @@ -29,12 +29,11 @@ in { Limits which IPs this client receives data from. ''; }; - ips = lib.mkOption { - type = lib.types.listOf lib.types.str; - example = lib.literalExample [ "172.23.23.11/24" ]; + ip = lib.mkOption { + type = lib.types.str; + example = lib.literalExample "172.23.23.11"; description = '' The IP addresses of the interface. - See https://github.com/NixOS/nixpkgs/blob/nixos-20.09/nixos/modules/services/networking/wireguard.nix . ''; }; endpoint = lib.mkOption { @@ -56,7 +55,7 @@ in { config = lib.mkIf cfg.client.enable { networking.wireguard.interfaces.monitoringvpn = { - ips = cfg.client.ips; + ips = [ "${cfg.client.ip}/24" ]; privateKeyFile = toString cfg.client.privateKeyFile; peers = [ { diff --git a/nixos/modules/monitoring/vpn/server.nix b/nixos/modules/monitoring/vpn/server.nix index 8670dca8..58cb6df2 100644 --- a/nixos/modules/monitoring/vpn/server.nix +++ b/nixos/modules/monitoring/vpn/server.nix @@ -22,12 +22,11 @@ in { File with base64 public key generated by <command>cat private.key | wg pubkey > pubkey.pub</command>. ''; }; - ips = lib.mkOption { - type = lib.types.listOf lib.types.str; - example = lib.literalExample [ "172.23.23.1/24" ]; + ip = lib.mkOption { + type = lib.types.str; + example = lib.literalExample [ "172.23.23.23" ]; description = '' - The IP addresses of the interface. - See https://github.com/NixOS/nixpkgs/blob/nixos-20.09/nixos/modules/services/networking/wireguard.nix . + The IP address of the interface. ''; }; port = lib.mkOption { @@ -44,7 +43,7 @@ in { networking.firewall.allowedUDPPorts = [ cfg.server.port ]; networking.wireguard.interfaces.monitoringvpn = { - ips = cfg.server.ips; + ips = [ "${cfg.server.ip}/24" ]; listenPort = cfg.server.port; privateKeyFile = toString cfg.server.privateKeyFile; peers = [ -- GitLab