summaryrefslogtreecommitdiff
path: root/modules/system/access/ssh.nix
blob: 8a2b30d1d804c0ebfcf466123dd79f1ebad9677b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib, config, ... }:
{
  programs.ssh.startAgent = false;

  services = {
    fail2ban.jails.sshd.settings = {
      enabled = true;
      filter = "sshd[mode=aggressive]";
      port = lib.strings.concatStringsSep "," (map toString config.services.openssh.ports);
    };

    openssh = {
      enable = true;
      ports = [ 22 ];
      openFirewall = false;

      settings = {
        KexAlgorithms = [
          "curve25519-sha256"
          "[email protected]"
          "diffie-hellman-group16-sha512"
          "diffie-hellman-group18-sha512"
          "diffie-hellman-group-exchange-sha256"
          "[email protected]"
        ];

        Macs = [
          "[email protected]"
          "[email protected]"
          "[email protected]"
        ];
      };
    };
  };
}