1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
cb12fb64cb hosts/web-2: expose know_hosts 2023-05-02 18:01:39 +02:00
d068fea2ce Add ssh public host keys 2023-05-02 10:33:56 +02:00
21 changed files with 42 additions and 0 deletions

8
bin/update-ssh-host-keys.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
cd $(git rev-parse --show-toplevel)
for host in $(nix eval --apply 'attrs: builtins.concatStringsSep "\n" (builtins.filter (name: (builtins.substring 0 1 name) != "_") (builtins.attrNames attrs))' --raw .#clerie.hosts); do
echo $host
ssh-keyscan -t ed25519 ${host}.net.clerie.de 2>/dev/null | sed -E 's/(\S+) (.+)/\2/g' > hosts/${host}/ssh.pub
done

1
hosts/carbon/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGdyTanEqCieqt81Ri8xHnw1dyK3i8srDi1F+xIb3Js3

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINbpzEFngWD8gZpGKvOdo5CVMPlaDCylNKorf/ZN93rT

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHCgFELN24kkb40/Pv2aOwhfqoqbCEdQPBTND7nTw1hd

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGI7h8xpVDM0BsY+XGwp8kX1XKn82Cg0lhd1M4Eldsp5

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIANa33GhY8tK+rGFKjrEbaw289bMqh1Aazyo04B//27t

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKbqGg6BF4MLSgDIe0Q0EsaogXPlYKHCNKWvfIXkNq7L

1
hosts/gatekeeper/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKhHoM0m6PZnCCzWOugKnN/BqhadwYzEE8xbABQxEhgo

1
hosts/hydra-1/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE2xQBCsFBCwL9n4OP/bPngtNO1fy9kPw13Z/NDoba16

1
hosts/hydra-2/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZED9QM+qe7sB6R6atvP6WNaI2sC2nh7TTsD6kgRpnr

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIYGtzxrVeuA7ShtNLmf2iBQDT/4h6aQHQHsuJ2WbSN/

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFLx2HIlnJdOn4JafIdQsUvdjcrAHX9XtP5S//eN5sxW

1
hosts/nonat/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJNYD4kXavTWu8ftw/8pYkyUjIUFS4zxkHjJZSTgkm3Z

1
hosts/osmium/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICt1KsCZpvwltp5UMyamLI5YIBj3imlGwWr24efQM7i

1
hosts/palladium/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBc/YTf80MjyVeApOecOlxORIlwCaWtJNWtfggc0B374

1
hosts/porter/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN2AeM/t66I8+9K+IYGdb/K531ujaqSqNpevIZqs4CdY

1
hosts/schule/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAIuAyY1FtMWoBdLzOkDsCro6vQjGYQduGzU9HLcSvfj

1
hosts/storage-2/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXlKMje2VbEtAuqn7ui9A4A7gqfv4c412iKvKk76D8p

View File

@ -18,6 +18,9 @@
rev = "d3f220899ecb98e87026ee0a7600bb8898ae3c42"; rev = "d3f220899ecb98e87026ee0a7600bb8898ae3c42";
sha256 = "sha256-3o2/+m5OGSfc5RTrS4/j/aVibDasQISL7vY+J3yxbB8="; sha256 = "sha256-3o2/+m5OGSfc5RTrS4/j/aVibDasQISL7vY+J3yxbB8=";
}; };
locations."= /ssh/known_hosts" = {
alias = pkgs.writeText "known_hosts" (import ../../lib/ssh-known-hosts.nix);
};
locations."~ ^/.well-known/openpgpkey/hu/[a-z0-9]+/?$" = { locations."~ ^/.well-known/openpgpkey/hu/[a-z0-9]+/?$" = {
extraConfig = '' extraConfig = ''
default_type application/octet-stream; default_type application/octet-stream;

1
hosts/web-2/ssh.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIHQDwfRlw6L+pkLjXDgW2BUWlY1zNEDtVhNEsClgqaL

13
lib/ssh-known-hosts.nix Normal file
View File

@ -0,0 +1,13 @@
let
stripR = str: if (builtins.substring ((builtins.stringLength str) - 1) (builtins.stringLength str) str) == "\n" then stripR (builtins.substring 0 ((builtins.stringLength str) - 1) str) else str;
hostsWithSshPubkey = builtins.filter (hostname: (builtins.substring 0 1 hostname) != "_" && builtins.pathExists (../hosts + "/${hostname}/ssh.pub")) (builtins.attrNames (builtins.readDir ../hosts));
sshkeyList = map (hostname: {
name = hostname;
sshPubkey = stripR (builtins.readFile (../hosts + "/${hostname}/ssh.pub"));
}) hostsWithSshPubkey;
knownHosts = builtins.concatStringsSep "" (builtins.map ({name, sshPubkey}: ''
${name} ${sshPubkey}
${name}.net.clerie.de ${sshPubkey}
'') sshkeyList);
in
knownHosts