Merge branch 'known-host' into comin

comin
Pyjacpp 2026-11-21 18:58:51 +01:00
commit ac8e5b7d56
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
17 changed files with 81 additions and 6 deletions

View File

@ -3,6 +3,7 @@
description = "Serveur de stockage ceph"; description = "Serveur de stockage ceph";
id = 3; id = 3;
enable = true;
# Sous Nix mais dans une autre branche # Sous Nix mais dans une autre branche
isDebian = true; isDebian = true;
@ -16,6 +17,10 @@
}; };
}; };
resticClient.enable = false;
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOsBGkhiu6l3jeo15cQHMu3dPyL025zXPV2ZH02EDYEt root@cephiroth";
ilo = { ilo = {
id = 53; id = 53;
switch.salameche = 20; switch.salameche = 20;

View File

@ -13,5 +13,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFKNg1b8ft1L55+joXQ/7Dt2QTOdkea8opTEnq4xrhPU root@thot";
resticClient.enable = false; resticClient.enable = false;
} }

View File

@ -13,5 +13,7 @@
homeNounou.enable = false; homeNounou.enable = false;
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDCJV6jqQWEYuwi+OJ9r/4TbBN/cK9NvYWNiJhpFzcc7 root@apprentix";
users.root.passwordFile = ../../../secrets/apprentix/root.age; users.root.passwordFile = ../../../secrets/apprentix/root.age;
} }

View File

@ -21,5 +21,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFa2D9fREtO2r2oIx6q9JAKFUHtxGbgEPMjkx09DQSU8 root@collabora";
resticClient.enable = false; resticClient.enable = false;
} }

View File

@ -27,6 +27,8 @@
resticClient.when = "06:07"; resticClient.when = "06:07";
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoR66An5huQucZlueQCcB/vwd085wrS2mUIz39e8QLt root@coturn";
services = { services = {
acme.enable = true; acme.enable = true;
}; };

View File

@ -19,6 +19,8 @@
resticClient.when = "02:34"; resticClient.when = "02:34";
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB6jVMIZ5y2oXX9HOkw7r5UUjw95MlFaFuu7FnEC0Q8z root@jitsi";
services = { services = {
acme.enable = true; acme.enable = true;
}; };

View File

@ -24,6 +24,8 @@
monitoring = { monitoring = {
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEVfKNokHG6ig32hhQxTep+fKFmKahlDClPrX/dP4/gb root@livre";
resticClient.when = "03:45"; resticClient.when = "03:45";
} }

View File

@ -38,5 +38,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFfcKtim7Aj+strHdg847D7KCCdoOAuasxx/2yi2TY1n root@mediakiwi";
resticClient.when = "06:47"; resticClient.when = "06:47";
} }

View File

@ -18,6 +18,8 @@
resticClient.when = "04:56"; resticClient.when = "04:56";
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMGfSvxqC2PJYRrxJaivVDujwlwCZ6AwH8hOSA9ktZ1V root@neo";
services = { services = {
acme.enable = true; acme.enable = true;
}; };

View File

@ -25,5 +25,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMgSP9UmuJw8Bi2ML07WHsWvxN8akkc9XZxXyOgdjXkq root@nextcloud";
resticClient.enable = false; resticClient.enable = false;
} }

View File

@ -23,5 +23,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTdfSIL3AWIv0mjRDam6E/qsjoqwJ8QSm1Cb0xqs1s1 root@periodique";
resticClient.when = "02:56"; resticClient.when = "02:56";
} }

View File

@ -20,5 +20,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOx/lUQE6naP3EBy81sr93X8ktZmivU09ACx6T43Odhb root@reverseproxy";
resticClient.when = "03:42"; resticClient.when = "03:42";
} }

View File

@ -12,5 +12,7 @@
}; };
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPpaGf8A+XWXBdNrs69RiC0qPbjPHdtkl31OjxrktmF6 root@two";
resticClient.when = "07:29"; resticClient.when = "07:29";
} }

View File

@ -21,5 +21,7 @@
nginx.enable = true; nginx.enable = true;
}; };
publicSsh = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICn6vfDlsZVU6TEWg9vTgq9+Fp3irHjytBTky7A4ErRM root@vaultwarden";
resticClient.when = "04:44"; resticClient.when = "04:44";
} }

View File

@ -1,5 +1,19 @@
{ ... }: {
infra,
lib,
hosts,
...
}:
let
inherit (lib)
attrNames
concatMap
optional
mapAttrs'
mkIf
nameValuePair
;
in
{ {
services.openssh = { services.openssh = {
enable = true; enable = true;
@ -7,5 +21,34 @@
settings = { settings = {
PermitRootLogin = "yes"; PermitRootLogin = "yes";
}; };
# knownHosts :
# {
# "host" = {
# hostNames = ["host.adm.crans.org" 172.16.10.2 …]
# publicKey = "ssh-ed25519…"
# }
# }
knownHosts = mapAttrs' (
n: conf:
nameValuePair n (
mkIf (conf.publicSsh != null) {
publicKey = conf.publicSsh;
hostNames = [
"${n}.adm.crans.org"
]
++ concatMap (
vlan:
let
netv = conf.networking.${vlan};
in
optional (netv.enable && (netv.ipv4.address or null) != null) netv.ipv4.address
++ optional (netv.enable && (netv.ipv6.address or null) != null) netv.ipv6.address
) (attrNames infra.vlans);
}
)
) hosts;
}; };
} }

View File

@ -28,7 +28,7 @@ in
example = true; example = true;
description = "Activer la configuration Crans par défaut"; description = "Activer la configuration Crans par défaut";
# On n’utilise pas mkEnableOption pour forcer la définition de enable à true # On n’utilise pas mkEnableOption pour forcer la définition de enable à true
# ou false (et limiter les oublis) # ou false (et limiter les oublis).
}; };
config = mkIf config.enable { config = mkIf config.enable {
homeNounou.enable = mkDefault true; homeNounou.enable = mkDefault true;

View File

@ -35,8 +35,9 @@ in
default = false; default = false;
}; };
public-ssh = mkOption { publicSsh = mkOption {
type = types.str; type = types.nullOr types.str;
default = null;
description = "Clé ssh publique de la machine."; description = "Clé ssh publique de la machine.";
}; };
}; };