mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
nixos/ssh: Make ~/.ssh/authorized_keys
optional in AuthorizedKeysFiles (#279894)
This commit is contained in:
parent
853580ca64
commit
db5f88c41a
2 changed files with 23 additions and 1 deletions
|
@ -296,6 +296,17 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
authorizedKeysInHomedir = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enables the use of the `~/.ssh/authorized_keys` file.
|
||||
|
||||
Otherwise, the only files trusted by default are those in `/etc/ssh/authorized_keys.d`,
|
||||
*i.e.* SSH keys from [](#opt-users.users._name_.openssh.authorizedKeys.keys).
|
||||
'';
|
||||
};
|
||||
|
||||
authorizedKeysCommand = mkOption {
|
||||
type = types.str;
|
||||
default = "none";
|
||||
|
@ -635,7 +646,7 @@ in
|
|||
# https://github.com/NixOS/nixpkgs/pull/10155
|
||||
# https://github.com/NixOS/nixpkgs/pull/41745
|
||||
services.openssh.authorizedKeysFiles =
|
||||
[ "%h/.ssh/authorized_keys" "/etc/ssh/authorized_keys.d/%u" ];
|
||||
lib.optional cfg.authorizedKeysInHomedir "%h/.ssh/authorized_keys" ++ [ "/etc/ssh/authorized_keys.d/%u" ];
|
||||
|
||||
services.openssh.settings.AuthorizedPrincipalsFile = mkIf (authPrincipalsFiles != {}) "/etc/ssh/authorized_principals.d/%u";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue