backwards: Add authorized ssh key for pinwheel

This commit is contained in:
Alexander Heldt
2024-08-15 18:17:51 +02:00
parent cfce2cf638
commit 3b0679716d

View File

@@ -1,7 +1,8 @@
{ lib, config, ... }: { pkgs, lib, config, ... }:
let let
enabled = config.mod.ssh.enable; enabled = config.mod.ssh.enable;
authorizedKeysPath = "/home/alex/.ssh/authorized-keys";
rootSSHKeyPath = "/etc/ssh"; rootSSHKeyPath = "/etc/ssh";
in in
{ {
@@ -25,6 +26,16 @@ in
}; };
}; };
environment.etc."ssh/authorized_keys_command" = {
mode = "0755";
text = ''
#!${pkgs.bash}/bin/bash
for file in ${authorizedKeysPath}/*; do
${pkgs.coreutils}/bin/cat "$file"
done
'';
};
services = { services = {
openssh = { openssh = {
enable = true; enable = true;
@@ -34,6 +45,14 @@ in
path = "${rootSSHKeyPath}/root.backwards"; path = "${rootSSHKeyPath}/root.backwards";
type = "ed25519"; type = "ed25519";
}]; }];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
authorizedKeysCommand = "/etc/ssh/authorized_keys_command";
authorizedKeysCommandUser = "root";
}; };
}; };
@@ -53,6 +72,11 @@ in
path = "${rootSSHKeyPath}/root.backwards.pub"; path = "${rootSSHKeyPath}/root.backwards.pub";
}; };
"alex.pinwheel-backwards.pub" = {
file = ../../../../secrets/pinwheel/alex.pinwheel-backwards.pub.age;
path = "${authorizedKeysPath}/alex.pinwheel-backwards.pub";
};
"alex.backwards-codeberg.org" = { "alex.backwards-codeberg.org" = {
file = ../../../../secrets/backwards/alex.backwards-codeberg.org.age; file = ../../../../secrets/backwards/alex.backwards-codeberg.org.age;
path = "/home/alex/.ssh/alex.backwards-codeberg.org"; path = "/home/alex/.ssh/alex.backwards-codeberg.org";