2019-05-09 18:28:40 +02:00
|
|
|
{ config, lib, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
2019-02-26 14:10:58 +01:00
|
|
|
# For reference:
|
|
|
|
# https://infosec.mozilla.org/guidelines/openssh.html
|
|
|
|
# https://stribika.github.io/2015/01/04/secure-secure-shell.html
|
2019-03-20 02:57:59 +01:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
mkIf (elem "openssh" config.machine.services) {
|
2019-02-26 13:44:40 +01:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
2023-09-10 15:25:20 +02:00
|
|
|
settings.KexAlgorithms = [ "curve25519-sha256@libssh.org" ];
|
2019-02-26 14:10:58 +01:00
|
|
|
sftpFlags = [ "-f AUTHPRIV" "-l INFO" ];
|
2023-09-10 15:25:20 +02:00
|
|
|
startWhenNeeded = false;
|
2023-01-29 16:22:24 +01:00
|
|
|
settings = {
|
|
|
|
KbdInteractiveAuthentication = false;
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
};
|
2019-06-26 00:33:04 +02:00
|
|
|
extraConfig = let users = concatMapStrings (user: "${user.name} ") config.machine.administrators
|
2019-09-06 11:38:02 +02:00
|
|
|
+ (optionalString config.services.gitea.enable (config.services.gitea.user + " "));
|
2019-06-26 00:33:04 +02:00
|
|
|
in ''
|
2019-03-24 22:55:17 +01:00
|
|
|
UsePAM no
|
2019-06-26 00:33:04 +02:00
|
|
|
AllowUsers ${users}
|
2019-03-24 22:55:17 +01:00
|
|
|
LogLevel VERBOSE
|
2019-02-26 13:44:40 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|