mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
nebula/sshd: Only allow key auth
This commit is contained in:
parent
2f4a83a906
commit
72ed799826
6 changed files with 57 additions and 10 deletions
|
|
@ -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; });
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
29
modules/home/programs/ssh.nix
Normal file
29
modules/home/programs/ssh.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue