Fixed bug with key providers in static configuration

release
Matthew Salerno 1 year ago
parent e3c89e816f
commit f45752f5d7

@ -13,10 +13,8 @@ let
keyProvidersInit = map (x: x inputs intermediateConfig peerName) keyProviders;
getPeerPubKey = otherPeerName: findFirst (x: x != null) (throw "Wirenix: Could not find public key for " + otherPeerName)
(map (provider: provider.getPeerPubKey otherPeerName) keyProvidersInit);
getPrivKeyFile = getPrivKeyFile (x: x != null) (throw "Wirenix: Could not find private key file for " + peerName)
getPrivKeyFile = findFirst (x: x != null) (throw "Wirenix: Could not find private key file for " + peerName)
(map (provider: provider.getPrivKeyFile) keyProvidersInit);
getPubKey = findFirst (x: x != null) (throw "Wirenix: Could not find public key for " + peerName)
(map (provider: provider.getPubKey) keyProvidersInit);
getSubnetPSKFile = subnetName: findFirst (x: x != null) (null)
(map (provider: provider.getSubnetPSKFile subnetName) keyProvidersInit);
in

@ -1,10 +1,10 @@
{lib, ...}: intermediateConfig:
{lib, ...}: intermediateConfig: peerName:
with import ../lib.nix;
with lib.attrsets;
with builtins;
{
config = {};
getPeerPubKey = peerName: attrByPath [peerName "publicKey"] null intermediateConfig.peers;
getPeerPrivKeyFile = peerName: attrByPath [peerName "privateKeyFile"] null intermediateConfig.peers;
getSubnetPSK = subnetName: attrByPath [subnetName "presharedKeyFile"] null intermediateConfig.subnets;
getPeerPubKey = otherPeerName: attrByPath [otherPeerName "publicKey"] null intermediateConfig.peers;
getPrivKeyFile = attrByPath [peerName "privateKeyFile"] null intermediateConfig.peers;
getSubnetPSKFile = subnetName: attrByPath [subnetName "presharedKeyFile"] null intermediateConfig.subnets;
}

@ -28,6 +28,5 @@ let secretsDir = peerName: (nixosConfigForPeer nixosConfigurations peerName).con
};
getPeerPubKey = otherPeerName: lib.removeSuffix ".age" ((secretsDir otherPeerName).config.secrets."wirenix-peer-${peerName}".path) + ".pub";
getPrivKeyFile = config.age.secrets."wirenix-peer-${peerName}".path;
getPubKey = lib.removeSuffix ".age" (config.age.secrets."wirenix-peer-${peerName}".path) + ".pub";
getSubnetPSKFile = subnetName: config.age.secrets."wirenix-subnet-${subnetName}".path;
}
Loading…
Cancel
Save