diff --git a/hosts/physiques/cephiroth/builder.nix b/hosts/physiques/cephiroth/builder.nix new file mode 100644 index 0000000..b6474fa --- /dev/null +++ b/hosts/physiques/cephiroth/builder.nix @@ -0,0 +1,18 @@ +{ lib, hosts, ... }: +let + inherit (lib) + attrValues + concatMap + optional + ; +in +{ + nix.trustedUsers = [ "builder" ]; + users.users.builder = { + isSystemUser = true; + # On autorise les clés publiques des VMs à se connecter. + openssh.authorizedKeys.keys = concatMap (c: optional (c.publicSsh != null) c.publicSsh) ( + attrValues hosts + ); + }; +} diff --git a/hosts/physiques/cephiroth/default.nix b/hosts/physiques/cephiroth/default.nix index b680334..09a80fe 100644 --- a/hosts/physiques/cephiroth/default.nix +++ b/hosts/physiques/cephiroth/default.nix @@ -5,6 +5,7 @@ ./hardware-configuration.nix ./networking.nix ./ceph.nix + ./builder.nix ]; networking.hostId = "bbdd1133"; diff --git a/hosts/vm/livre/info.nix b/hosts/vm/livre/info.nix index 8df46c7..0418b53 100644 --- a/hosts/vm/livre/info.nix +++ b/hosts/vm/livre/info.nix @@ -25,5 +25,7 @@ nginx.enable = true; }; + publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEVfKNokHG6ig32hhQxTep+fKFmKahlDClPrX/dP4/gb root@livre"; + resticClient.when = "03:45"; } diff --git a/hosts/vm/two/info.nix b/hosts/vm/two/info.nix index c345d86..2cb06e2 100644 --- a/hosts/vm/two/info.nix +++ b/hosts/vm/two/info.nix @@ -12,5 +12,7 @@ }; }; + publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPpaGf8A+XWXBdNrs69RiC0qPbjPHdtkl31OjxrktmF6 root@two"; + resticClient.when = "07:29"; } diff --git a/modules/info/meta.nix b/modules/info/meta.nix index ef5cab8..ad18efb 100644 --- a/modules/info/meta.nix +++ b/modules/info/meta.nix @@ -35,8 +35,9 @@ in default = false; }; - public-ssh = mkOption { - type = types.str; + publicSsh = mkOption { + type = types.nullOr types.str; + default = null; description = "Clé ssh publique de la machine."; }; };