summaryrefslogtreecommitdiff
path: root/sys/auth.nix
blob: e6e156d10618fc5f5b5047a63917456e9a7aac59 (plain)
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
36
37
38
39
40
41
42
43
44
45
{ lib, config, ... }:
with lib; let
  cfg = config.local;
in {
  config = {
    security.pam = {
      oath = {
        usersFile = "/var/trust/auth/users.oath";
        digits = 6;
        window = 30;
      };

      services.sshd.oathAuth = true;
    };

    services.openssh = {
      enable = true;
      openFirewall = false;
      ports = [ 2234 ];

      forwardX11 = true;
      permitRootLogin = "no";
      passwordAuthentication = false;

      hostKeys = [
        {
          bits = 4096;
          path = "/etc/ssh/ssh_host_rsa_key";
          type = "rsa";
        }
        {
          path = "/etc/ssh/ssh_host_ed25519_key";
          type = "ed25519";
        }
        #TODO: Desfasar, inseguro
        {
          path = "/etc/ssh/ssh_host_ecdsa_key";
          type = "ecdsa";
        }
      ];
    };

    networking.firewall.allowedTCPPorts = [ 2234 ];
  };
}