Files
lux/modules/capabilities/services/openssh.nix
T
2026-09-06 04:03:54 +02:00

29 lines
697 B
Nix

{ config, lib, ... }:
let
account = config.facts.account;
personalPublicKeys = map (machine: machine.sshKeys.personal.publicKey) (
lib.filter (machine: machine.sshKeys ? personal) (builtins.attrValues config.facts.machines)
);
in
{
flake.modules.nixos.sudo-ssh-agent-auth = {
security.pam = {
rssh.enable = true;
services.sudo.rssh = true;
};
};
flake.modules.nixos.openssh = {
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
AllowUsers = [ account.name ];
};
};
users.users.${account.name}.openssh.authorizedKeys.keys = personalPublicKeys;
};
}