You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
505 B
Nix
33 lines
505 B
Nix
2 months ago
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
2 months ago
|
}:
|
||
|
let
|
||
3 months ago
|
cfg = config.services.openssh;
|
||
2 months ago
|
in
|
||
|
{
|
||
3 months ago
|
|
||
2 months ago
|
options.services.openssh = {
|
||
3 months ago
|
|
||
2 months ago
|
authorizedKeysOnly = lib.mkEnableOption ''
|
||
3 months ago
|
only logins using ssh keys (improving over default settings)
|
||
|
'';
|
||
|
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
|
||
|
services.openssh = {
|
||
|
settings = {
|
||
|
KbdInteractiveAuthentication = lib.mkIf cfg.authorizedKeysOnly false;
|
||
|
PasswordAuthentication = lib.mkIf cfg.authorizedKeysOnly false;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
# TODO add tests
|
||
|
|
||
|
}
|