mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 14:19:08 +01:00
tests: Refactor keys
This commit is contained in:
parent
d59a644c36
commit
7557252b22
36 changed files with 26 additions and 30 deletions
|
|
@ -5,15 +5,20 @@
|
|||
let
|
||||
mkTest = dir: rec {
|
||||
name = "${dir}-test";
|
||||
|
||||
value = pkgs.testers.runNixOSTest {
|
||||
inherit name;
|
||||
|
||||
imports = [ "${self}/tests/${dir}" ];
|
||||
|
||||
node.specialArgs = { inherit inputs self; };
|
||||
|
||||
defaults =
|
||||
{ nodes, ... }:
|
||||
{ config, nodes, ... }:
|
||||
{
|
||||
imports = [ self.nixosModules.default ];
|
||||
_module.args.allHosts = nodes |> lib.mapAttrs (_: node: { config = node; });
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
users.seb = {
|
||||
|
|
@ -21,7 +26,16 @@
|
|||
password = "seb";
|
||||
};
|
||||
};
|
||||
custom.networking.underlay.interface = "eth1";
|
||||
|
||||
networking.extraHosts = lib.mkForce "";
|
||||
custom = {
|
||||
networking.underlay.interface = "eth1";
|
||||
services.nebula = {
|
||||
caCertificateFile = "${self}/tests/${dir}/keys/nebula-ca.crt";
|
||||
certificateFile = "${self}/tests/${dir}/keys/${config.networking.hostName}/nebula.crt";
|
||||
privateKeyFile = "${self}/tests/${dir}/keys/${config.networking.hostName}/nebula.key";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,23 +7,15 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
users.users.seb.openssh.authorizedKeys.keyFiles = lib.mkIf config.custom.services.sshd.enable [
|
||||
./keys/server-ssh.pub
|
||||
./keys/client1-ssh.pub
|
||||
./keys/client2-ssh.pub
|
||||
./keys/server/ssh.pub
|
||||
./keys/client1/ssh.pub
|
||||
./keys/client2/ssh.pub
|
||||
];
|
||||
|
||||
environment.etc."ssh-key" = lib.mkIf (lib.pathExists ./keys/${config.networking.hostName}-ssh) {
|
||||
source = ./keys/${config.networking.hostName}-ssh;
|
||||
environment.etc."ssh-key" = lib.mkIf (lib.pathExists ./keys/${config.networking.hostName}/ssh) {
|
||||
source = ./keys/${config.networking.hostName}/ssh;
|
||||
mode = "0600";
|
||||
};
|
||||
|
||||
custom.services.nebula = {
|
||||
caCertificateFile = ./keys/ca.crt;
|
||||
certificateFile = ./keys/${config.networking.hostName}.crt;
|
||||
privateKeyFile = ./keys/${config.networking.hostName}.key;
|
||||
};
|
||||
|
||||
networking.extraHosts = lib.mkForce "";
|
||||
};
|
||||
|
||||
nodes = {
|
||||
|
|
|
|||
|
|
@ -6,21 +6,11 @@
|
|||
defaults =
|
||||
{ config, ... }:
|
||||
{
|
||||
custom = {
|
||||
services = {
|
||||
nebula = {
|
||||
caCertificateFile = ./keys/nebula/ca.crt;
|
||||
certificateFile = ./keys/nebula/${config.networking.hostName}.crt;
|
||||
privateKeyFile = ./keys/nebula/${config.networking.hostName}.key;
|
||||
};
|
||||
|
||||
syncthing = {
|
||||
custom.services.syncthing = {
|
||||
enable = true;
|
||||
deviceId = ./keys/syncthing/${config.networking.hostName}.id |> lib.readFile |> lib.trim;
|
||||
certFile = ./keys/syncthing/${config.networking.hostName}.cert;
|
||||
keyFile = ./keys/syncthing/${config.networking.hostName}.key;
|
||||
};
|
||||
};
|
||||
deviceId = ./keys/${config.networking.hostName}/syncthing.id |> lib.readFile |> lib.trim;
|
||||
certFile = ./keys/${config.networking.hostName}/syncthing.cert;
|
||||
keyFile = ./keys/${config.networking.hostName}/syncthing.key;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue