nebula/sshd: Only allow key auth

This commit is contained in:
SebastianStork 2026-01-07 20:40:09 +01:00
parent 2f4a83a906
commit 72ed799826
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
6 changed files with 57 additions and 10 deletions

View file

@ -39,15 +39,11 @@
};
};
ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks =
config.custom.sops.secrets.ssh-key
|> lib.mapAttrs (name: _: { identityFile = config.sops.secrets."ssh-key/${name}".path; });
};
lazygit.enable = true;
ssh.matchBlocks =
config.custom.sops.secrets.ssh-key
|> lib.mapAttrs (name: _: { identityFile = config.sops.secrets."ssh-key/${name}".path; });
};
};
}

View file

@ -0,0 +1,29 @@
{
config,
self,
lib,
...
}@moduleArgs:
let
cfg = config.custom.programs.ssh;
in
{
options.custom.programs.ssh = {
enable = lib.mkEnableOption "";
hostName = lib.mkOption {
type = lib.types.nonEmptyStr;
default = moduleArgs.osConfig.networking.hostName or "";
};
publicKeyPath = lib.mkOption {
type = lib.types.path;
default = "${self}/users/${config.home.username}/@${cfg.hostName}/keys/ssh.pub";
};
};
config = lib.mkIf config.custom.programs.ssh.enable {
programs.ssh = {
enable = true;
enableDefaultConfig = false;
};
};
}