summaryrefslogtreecommitdiff
path: root/sys/auth/oath.nix
blob: 6b006800bdac6716a3a9bcdb078d52535ecf4381 (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
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cfg = config.local.auth.oath;
in {
  options.local.auth.oath = {
    enable = lib.mkEnableOption "pam-oath";
  };

  config = lib.mkIf cfg.enable {
    security.pam = {
      oath = {
        digits = 6;
        window = 30;

        usersFile = "/var/trust/auth/users.oath";
      };

      services.sshd.oathAuth = true;
    };

    users.users.tunnel = {
      uid = 1100;
      group = "nogroup";
      isSystemUser = true;

      # Requiere oath
      password = "tunnel";

      home = "/var/empty";
      shell = "${pkgs.coreutils}/bin/true";
    };
  };
}