mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +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
|
let
|
||||||
mkTest = dir: rec {
|
mkTest = dir: rec {
|
||||||
name = "${dir}-test";
|
name = "${dir}-test";
|
||||||
|
|
||||||
value = pkgs.testers.runNixOSTest {
|
value = pkgs.testers.runNixOSTest {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|
||||||
imports = [ "${self}/tests/${dir}" ];
|
imports = [ "${self}/tests/${dir}" ];
|
||||||
|
|
||||||
node.specialArgs = { inherit inputs self; };
|
node.specialArgs = { inherit inputs self; };
|
||||||
|
|
||||||
defaults =
|
defaults =
|
||||||
{ nodes, ... }:
|
{ config, nodes, ... }:
|
||||||
{
|
{
|
||||||
imports = [ self.nixosModules.default ];
|
imports = [ self.nixosModules.default ];
|
||||||
_module.args.allHosts = nodes |> lib.mapAttrs (_: node: { config = node; });
|
_module.args.allHosts = nodes |> lib.mapAttrs (_: node: { config = node; });
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
users.seb = {
|
users.seb = {
|
||||||
|
|
@ -21,7 +26,16 @@
|
||||||
password = "seb";
|
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, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
users.users.seb.openssh.authorizedKeys.keyFiles = lib.mkIf config.custom.services.sshd.enable [
|
users.users.seb.openssh.authorizedKeys.keyFiles = lib.mkIf config.custom.services.sshd.enable [
|
||||||
./keys/server-ssh.pub
|
./keys/server/ssh.pub
|
||||||
./keys/client1-ssh.pub
|
./keys/client1/ssh.pub
|
||||||
./keys/client2-ssh.pub
|
./keys/client2/ssh.pub
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc."ssh-key" = lib.mkIf (lib.pathExists ./keys/${config.networking.hostName}-ssh) {
|
environment.etc."ssh-key" = lib.mkIf (lib.pathExists ./keys/${config.networking.hostName}/ssh) {
|
||||||
source = ./keys/${config.networking.hostName}-ssh;
|
source = ./keys/${config.networking.hostName}/ssh;
|
||||||
mode = "0600";
|
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 = {
|
nodes = {
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,11 @@
|
||||||
defaults =
|
defaults =
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
custom = {
|
custom.services.syncthing = {
|
||||||
services = {
|
|
||||||
nebula = {
|
|
||||||
caCertificateFile = ./keys/nebula/ca.crt;
|
|
||||||
certificateFile = ./keys/nebula/${config.networking.hostName}.crt;
|
|
||||||
privateKeyFile = ./keys/nebula/${config.networking.hostName}.key;
|
|
||||||
};
|
|
||||||
|
|
||||||
syncthing = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
deviceId = ./keys/syncthing/${config.networking.hostName}.id |> lib.readFile |> lib.trim;
|
deviceId = ./keys/${config.networking.hostName}/syncthing.id |> lib.readFile |> lib.trim;
|
||||||
certFile = ./keys/syncthing/${config.networking.hostName}.cert;
|
certFile = ./keys/${config.networking.hostName}/syncthing.cert;
|
||||||
keyFile = ./keys/syncthing/${config.networking.hostName}.key;
|
keyFile = ./keys/${config.networking.hostName}/syncthing.key;
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue