2009-05-28 17:10:02 +04:00
|
|
|
|
# This module provides configuration for the PAM (Pluggable
|
|
|
|
|
# Authentication Modules) system.
|
|
|
|
|
|
2014-04-14 18:26:48 +04:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2009-05-28 17:10:02 +04:00
|
|
|
|
|
2014-04-14 18:26:48 +04:00
|
|
|
|
with lib;
|
2009-08-16 18:49:14 +04:00
|
|
|
|
|
2009-05-28 17:10:02 +04:00
|
|
|
|
let
|
2014-05-05 23:18:53 +04:00
|
|
|
|
parentConfig = config;
|
2009-05-28 17:10:02 +04:00
|
|
|
|
|
2014-05-05 23:18:53 +04:00
|
|
|
|
pamOpts = { config, name, ... }: let cfg = config; in let config = parentConfig; in {
|
2013-10-15 16:47:51 +04:00
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
|
example = "sshd";
|
2013-10-30 14:02:04 +04:00
|
|
|
|
type = types.str;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Name of the PAM service.";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 17:05:49 +04:00
|
|
|
|
unixAuth = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 17:05:49 +04:00
|
|
|
|
Whether users can log in with passwords defined in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`/etc/shadow`.
|
2013-10-15 17:05:49 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
rootOK = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
If set, root doesn't need to authenticate (e.g. for the
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{command}`useradd` service).
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-30 12:03:10 +03:00
|
|
|
|
p11Auth = mkOption {
|
|
|
|
|
default = config.security.pam.p11.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.p11.enable";
|
2020-05-30 12:03:10 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2020-05-30 12:03:10 +03:00
|
|
|
|
If set, keys listed in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`~/.ssh/authorized_keys` and
|
|
|
|
|
{file}`~/.eid/authorized_certificates`
|
2020-05-30 12:03:10 +03:00
|
|
|
|
can be used to log in with the associated PKCS#11 tokens.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-05-03 17:29:42 +03:00
|
|
|
|
u2fAuth = mkOption {
|
2019-01-29 19:45:26 +03:00
|
|
|
|
default = config.security.pam.u2f.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.u2f.enable";
|
2015-05-03 17:29:42 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2015-05-03 17:29:42 +03:00
|
|
|
|
If set, users listed in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`$XDG_CONFIG_HOME/Yubico/u2f_keys` (or
|
|
|
|
|
{file}`$HOME/.config/Yubico/u2f_keys` if XDG variable is
|
2019-01-29 19:45:26 +03:00
|
|
|
|
not set) are able to log in with the associated U2F key. Path can be
|
2022-07-29 00:19:15 +03:00
|
|
|
|
changed using {option}`security.pam.u2f.authFile` option.
|
2015-05-03 17:29:42 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-13 20:20:23 +03:00
|
|
|
|
usshAuth = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-03-13 20:20:23 +03:00
|
|
|
|
If set, users with an SSH certificate containing an authorized principal
|
|
|
|
|
in their SSH agent are able to log in. Specific options are controlled
|
2022-07-29 00:19:15 +03:00
|
|
|
|
using the {option}`security.pam.ussh` options.
|
2022-03-13 20:20:23 +03:00
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
Note that the {option}`security.pam.ussh.enable` must also be
|
2022-03-13 20:20:23 +03:00
|
|
|
|
set for this option to take effect.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-31 04:07:16 +03:00
|
|
|
|
yubicoAuth = mkOption {
|
|
|
|
|
default = config.security.pam.yubico.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.yubico.enable";
|
2019-03-31 04:07:16 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-03-31 04:07:16 +03:00
|
|
|
|
If set, users listed in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`~/.yubico/authorized_yubikeys`
|
2020-05-12 22:51:07 +03:00
|
|
|
|
are able to log in with the associated Yubikey tokens.
|
2019-03-31 04:07:16 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2018-02-08 10:18:30 +03:00
|
|
|
|
googleAuthenticator = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2018-02-08 10:18:30 +03:00
|
|
|
|
If set, users with enabled Google Authenticator (created
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`~/.google_authenticator`) will be required
|
2018-02-08 10:18:30 +03:00
|
|
|
|
to provide Google Authenticator token to log in.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
usbAuth = mkOption {
|
|
|
|
|
default = config.security.pam.usb.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.usb.enable";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
If set, users listed in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`/etc/pamusb.conf` are able to log in
|
2013-10-15 16:47:51 +04:00
|
|
|
|
with the associated USB key.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
otpwAuth = mkOption {
|
|
|
|
|
default = config.security.pam.enableOTPW;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.enableOTPW";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
If set, the OTPW system will be used (if
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`~/.otpw` exists).
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2018-12-12 15:53:51 +03:00
|
|
|
|
googleOsLoginAccountVerification = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2018-12-12 15:53:51 +03:00
|
|
|
|
If set, will use the Google OS Login PAM modules
|
2022-07-29 00:19:15 +03:00
|
|
|
|
(`pam_oslogin_login`,
|
|
|
|
|
`pam_oslogin_admin`) to verify possible OS Login
|
2018-12-12 15:53:51 +03:00
|
|
|
|
users and set sudoers configuration accordingly.
|
2022-07-29 00:19:15 +03:00
|
|
|
|
This only makes sense to enable for the `sshd` PAM
|
2018-12-12 15:53:51 +03:00
|
|
|
|
service.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
googleOsLoginAuthentication = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
If set, will use the `pam_oslogin_login`'s user
|
2018-12-12 15:53:51 +03:00
|
|
|
|
authentication methods to authenticate users using 2FA.
|
2022-07-29 00:19:15 +03:00
|
|
|
|
This only makes sense to enable for the `sshd` PAM
|
2018-12-12 15:53:51 +03:00
|
|
|
|
service.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-29 18:23:44 +03:00
|
|
|
|
mysqlAuth = mkOption {
|
|
|
|
|
default = config.users.mysql.enable;
|
|
|
|
|
defaultText = literalExpression "config.users.mysql.enable";
|
|
|
|
|
type = types.bool;
|
2022-08-28 22:18:44 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
If set, the `pam_mysql` module will be used to
|
2022-07-29 18:23:44 +03:00
|
|
|
|
authenticate users against a MySQL/MariaDB database.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-01-03 19:47:38 +03:00
|
|
|
|
fprintAuth = mkOption {
|
|
|
|
|
default = config.services.fprintd.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.services.fprintd.enable";
|
2015-01-03 19:47:38 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2015-01-03 19:47:38 +03:00
|
|
|
|
If set, fingerprint reader will be used (if exists and
|
|
|
|
|
your fingerprints are enrolled).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-02-15 01:52:22 +03:00
|
|
|
|
oathAuth = mkOption {
|
2016-02-25 00:41:02 +03:00
|
|
|
|
default = config.security.pam.oath.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.oath.enable";
|
2015-02-15 01:52:22 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2015-02-15 01:52:22 +03:00
|
|
|
|
If set, the OATH Toolkit will be used.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
sshAgentAuth = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
If set, the calling user's SSH agent is used to authenticate
|
|
|
|
|
against the keys in the calling user's
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`~/.ssh/authorized_keys`. This is useful
|
|
|
|
|
for {command}`sudo` on password-less remote systems.
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-13 04:12:51 +03:00
|
|
|
|
duoSecurity = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-02-13 04:12:51 +03:00
|
|
|
|
If set, use the Duo Security pam module
|
2022-07-29 00:19:15 +03:00
|
|
|
|
`pam_duo` for authentication. Requires
|
|
|
|
|
configuration of {option}`security.duosec` options.
|
2019-02-13 04:12:51 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
startSession = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
If set, the service will register a new session with
|
|
|
|
|
systemd's login manager. For local sessions, this will give
|
|
|
|
|
the user access to audio devices, CD-ROM drives. In the
|
|
|
|
|
default PolicyKit configuration, it also allows the user to
|
|
|
|
|
reboot the system.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-06 18:23:27 +03:00
|
|
|
|
setEnvironment = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2016-09-06 18:23:27 +03:00
|
|
|
|
Whether the service should set the environment variables
|
2022-07-29 00:19:15 +03:00
|
|
|
|
listed in {option}`environment.sessionVariables`
|
|
|
|
|
using `pam_env.so`.
|
2016-09-06 18:23:27 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
setLoginUid = mkOption {
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
Set the login uid of the process
|
2022-07-29 00:19:15 +03:00
|
|
|
|
({file}`/proc/self/loginuid`) for auditing
|
2013-10-15 16:47:51 +04:00
|
|
|
|
purposes. The login uid is only set by ‘entry points’ like
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{command}`login` and {command}`sshd`, not by
|
|
|
|
|
commands like {command}`sudo`.
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-13 15:43:12 +03:00
|
|
|
|
ttyAudit = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2021-09-13 15:43:12 +03:00
|
|
|
|
Enable or disable TTY auditing for specified users
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enablePattern = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2021-09-13 15:43:12 +03:00
|
|
|
|
For each user matching one of comma-separated
|
|
|
|
|
glob patterns, enable TTY auditing
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
disablePattern = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2021-09-13 15:43:12 +03:00
|
|
|
|
For each user matching one of comma-separated
|
|
|
|
|
glob patterns, disable TTY auditing
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
openOnly = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2021-09-13 15:43:12 +03:00
|
|
|
|
Set the TTY audit flag when opening the session,
|
|
|
|
|
but do not restore it when closing the session.
|
|
|
|
|
Using this option is necessary for some services
|
|
|
|
|
that don't fork() to run the authenticated session,
|
|
|
|
|
such as sudo.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
forwardXAuth = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
Whether X authentication keys should be passed from the
|
|
|
|
|
calling user to the target user (e.g. for
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{command}`su`)
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-02 17:46:56 +03:00
|
|
|
|
pamMount = mkOption {
|
|
|
|
|
default = config.security.pam.mount.enable;
|
2021-11-26 03:16:05 +03:00
|
|
|
|
defaultText = literalExpression "config.security.pam.mount.enable";
|
2015-07-02 17:46:56 +03:00
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-12-18 03:31:14 +03:00
|
|
|
|
Enable PAM mount (pam_mount) system to mount filesystems on user login.
|
2015-07-02 17:46:56 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
allowNullPassword = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
Whether to allow logging into accounts that have no password
|
|
|
|
|
set (i.e., have an empty password field in
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{file}`/etc/passwd` or
|
|
|
|
|
{file}`/etc/group`). This does not enable
|
2013-10-15 16:47:51 +04:00
|
|
|
|
logging into disabled accounts (i.e., that have the password
|
2022-07-29 00:19:15 +03:00
|
|
|
|
field set to `!`). Note that regardless of
|
2013-10-15 16:47:51 +04:00
|
|
|
|
what the pam_unix documentation says, accounts with hashed
|
|
|
|
|
empty passwords are always allowed to log in.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2012-09-16 21:14:19 +04:00
|
|
|
|
|
2020-02-23 16:55:47 +03:00
|
|
|
|
nodelay = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-12-18 03:31:14 +03:00
|
|
|
|
Whether the delay after typing a wrong password should be disabled.
|
2020-02-23 16:55:47 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-05-17 00:37:44 +04:00
|
|
|
|
requireWheel = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2014-05-17 00:37:44 +04:00
|
|
|
|
Whether to permit root access only to members of group wheel.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
limits = mkOption {
|
2021-12-07 20:26:25 +03:00
|
|
|
|
default = [];
|
|
|
|
|
type = limitsType;
|
2022-08-15 08:16:25 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2013-10-15 16:47:51 +04:00
|
|
|
|
Attribute set describing resource limits. Defaults to the
|
2022-08-15 08:16:25 +03:00
|
|
|
|
value of {option}`security.pam.loginLimits`.
|
|
|
|
|
The meaning of the values is explained in {manpage}`limits.conf(5)`.
|
2013-10-15 16:47:51 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-05-28 17:10:02 +04:00
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
showMotd = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Whether to show the message of the day.";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
2009-08-16 19:46:24 +04:00
|
|
|
|
|
2014-04-15 18:46:35 +04:00
|
|
|
|
makeHomeDir = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2014-04-15 18:46:35 +04:00
|
|
|
|
Whether to try to create home directories for users
|
2022-07-29 00:19:15 +03:00
|
|
|
|
with `$HOME`s pointing to nonexistent
|
2014-04-15 18:46:35 +04:00
|
|
|
|
locations on session login.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
updateWtmp = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Whether to update {file}`/var/log/wtmp`.";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
2010-01-12 14:02:23 +03:00
|
|
|
|
|
2014-05-14 19:53:58 +04:00
|
|
|
|
logFailures = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Whether to log authentication failures in {file}`/var/log/faillog`.";
|
2014-05-14 19:53:58 +04:00
|
|
|
|
};
|
|
|
|
|
|
2015-04-19 00:15:35 +03:00
|
|
|
|
enableAppArmor = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2015-04-19 00:15:35 +03:00
|
|
|
|
Enable support for attaching AppArmor profiles at the
|
|
|
|
|
user/group level, e.g., as part of a role based access
|
|
|
|
|
control scheme.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2017-02-15 03:38:52 +03:00
|
|
|
|
enableKwallet = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2017-02-15 03:38:52 +03:00
|
|
|
|
If enabled, pam_wallet will attempt to automatically unlock the
|
|
|
|
|
user's default KDE wallet upon login. If the user has no wallet named
|
|
|
|
|
"kdewallet", or the login password does not match their wallet
|
|
|
|
|
password, KDE will prompt separately after login.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2017-11-22 20:07:04 +03:00
|
|
|
|
sssdStrictAccess = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "enforce sssd access control";
|
2017-11-22 20:07:04 +03:00
|
|
|
|
};
|
2017-02-15 03:38:52 +03:00
|
|
|
|
|
2017-10-22 15:42:00 +03:00
|
|
|
|
enableGnomeKeyring = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2017-10-22 15:42:00 +03:00
|
|
|
|
If enabled, pam_gnome_keyring will attempt to automatically unlock the
|
|
|
|
|
user's default Gnome keyring upon login. If the user login password does
|
|
|
|
|
not match their keyring password, Gnome Keyring will prompt separately
|
|
|
|
|
after login.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-07 14:16:35 +03:00
|
|
|
|
failDelay = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
If enabled, this will replace the `FAIL_DELAY` setting from `login.defs`.
|
|
|
|
|
Change the delay on failure per-application.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
delay = mkOption {
|
|
|
|
|
default = 3000000;
|
|
|
|
|
type = types.int;
|
|
|
|
|
example = 1000000;
|
|
|
|
|
description = lib.mdDoc "The delay time (in microseconds) on failure.";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-11 03:13:53 +03:00
|
|
|
|
gnupg = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2020-09-11 03:13:53 +03:00
|
|
|
|
If enabled, pam_gnupg will attempt to automatically unlock the
|
|
|
|
|
user's GPG keys with the login password via
|
2022-07-29 00:19:15 +03:00
|
|
|
|
{command}`gpg-agent`. The keygrips of all keys to be
|
|
|
|
|
unlocked should be written to {file}`~/.pam-gnupg`,
|
|
|
|
|
and can be queried with {command}`gpg -K --with-keygrip`.
|
2020-09-11 03:13:53 +03:00
|
|
|
|
Presetting passphrases must be enabled by adding
|
2022-07-29 00:19:15 +03:00
|
|
|
|
`allow-preset-passphrase` in
|
|
|
|
|
{file}`~/.gnupg/gpg-agent.conf`.
|
2020-09-11 03:13:53 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
noAutostart = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Don't start {command}`gpg-agent` if it is not running.
|
|
|
|
|
Useful in conjunction with starting {command}`gpg-agent` as
|
2020-09-11 03:13:53 +03:00
|
|
|
|
a systemd user service.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
storeOnly = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2020-09-11 03:13:53 +03:00
|
|
|
|
Don't send the password immediately after login, but store for PAM
|
2022-07-29 00:19:15 +03:00
|
|
|
|
`session`.
|
2020-09-11 03:13:53 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
text = mkOption {
|
2013-10-30 20:37:45 +04:00
|
|
|
|
type = types.nullOr types.lines;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Contents of the PAM service file.";
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-27 11:13:53 +03:00
|
|
|
|
# The resulting /etc/pam.d/* file contents are verified in
|
|
|
|
|
# nixos/tests/pam/pam-file-contents.nix. Please update tests there when
|
|
|
|
|
# changing the derivation.
|
2014-05-05 23:18:53 +04:00
|
|
|
|
config = {
|
|
|
|
|
name = mkDefault name;
|
2013-10-15 16:47:51 +04:00
|
|
|
|
setLoginUid = mkDefault cfg.startSession;
|
|
|
|
|
limits = mkDefault config.security.pam.loginLimits;
|
2012-10-23 17:10:48 +04:00
|
|
|
|
|
2013-10-15 16:47:51 +04:00
|
|
|
|
# !!! TODO: move the LDAP stuff to the LDAP module, and the
|
|
|
|
|
# Samba stuff to the Samba module. This requires that the PAM
|
|
|
|
|
# module provides the right hooks.
|
|
|
|
|
text = mkDefault
|
2021-11-12 04:19:54 +03:00
|
|
|
|
(
|
|
|
|
|
''
|
|
|
|
|
# Account management.
|
|
|
|
|
'' +
|
|
|
|
|
optionalString use_ldap ''
|
|
|
|
|
account sufficient ${pam_ldap}/lib/security/pam_ldap.so
|
|
|
|
|
'' +
|
2022-07-29 18:23:44 +03:00
|
|
|
|
optionalString cfg.mysqlAuth ''
|
|
|
|
|
account sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString (config.services.sssd.enable && cfg.sssdStrictAccess==false) ''
|
|
|
|
|
account sufficient ${pkgs.sssd}/lib/security/pam_sss.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (config.services.sssd.enable && cfg.sssdStrictAccess) ''
|
|
|
|
|
account [default=bad success=ok user_unknown=ignore] ${pkgs.sssd}/lib/security/pam_sss.so
|
|
|
|
|
'' +
|
2022-07-16 08:38:42 +03:00
|
|
|
|
optionalString config.security.pam.krb5.enable ''
|
2021-11-12 04:19:54 +03:00
|
|
|
|
account sufficient ${pam_krb5}/lib/security/pam_krb5.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.googleOsLoginAccountVerification ''
|
2021-03-18 20:02:07 +03:00
|
|
|
|
account [success=ok ignore=ignore default=die] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
|
|
|
|
|
account [success=ok default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
2022-12-08 11:49:12 +03:00
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
account sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
|
|
|
|
'' +
|
2022-08-01 00:37:33 +03:00
|
|
|
|
# The required pam_unix.so module has to come after all the sufficient modules
|
|
|
|
|
# because otherwise, the account lookup will fail if the user does not exist
|
|
|
|
|
# locally, for example with MySQL- or LDAP-auth.
|
2021-11-12 04:19:54 +03:00
|
|
|
|
''
|
2022-08-01 00:37:33 +03:00
|
|
|
|
account required pam_unix.so
|
2021-11-12 04:19:54 +03:00
|
|
|
|
|
|
|
|
|
# Authentication management.
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.googleOsLoginAuthentication ''
|
2021-03-18 20:02:07 +03:00
|
|
|
|
auth [success=done perm_denied=die default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.rootOK ''
|
|
|
|
|
auth sufficient pam_rootok.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.requireWheel ''
|
|
|
|
|
auth required pam_wheel.so use_uid
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.logFailures ''
|
|
|
|
|
auth required pam_faillock.so
|
|
|
|
|
'' +
|
2022-07-29 18:23:44 +03:00
|
|
|
|
optionalString cfg.mysqlAuth ''
|
|
|
|
|
auth sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString (config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth) ''
|
|
|
|
|
auth sufficient ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so file=${lib.concatStringsSep ":" config.services.openssh.authorizedKeysFiles}
|
|
|
|
|
'' +
|
|
|
|
|
(let p11 = config.security.pam.p11; in optionalString cfg.p11Auth ''
|
|
|
|
|
auth ${p11.control} ${pkgs.pam_p11}/lib/security/pam_p11.so ${pkgs.opensc}/lib/opensc-pkcs11.so
|
|
|
|
|
'') +
|
2022-07-22 00:05:12 +03:00
|
|
|
|
(let u2f = config.security.pam.u2f; in optionalString cfg.u2fAuth (''
|
2022-04-06 13:23:17 +03:00
|
|
|
|
auth ${u2f.control} ${pkgs.pam_u2f}/lib/security/pam_u2f.so ${optionalString u2f.debug "debug"} ${optionalString (u2f.authFile != null) "authfile=${u2f.authFile}"} ''
|
|
|
|
|
+ ''${optionalString u2f.interactive "interactive"} ${optionalString u2f.cue "cue"} ${optionalString (u2f.appId != null) "appid=${u2f.appId}"} ${optionalString (u2f.origin != null) "origin=${u2f.origin}"}
|
2022-07-22 00:05:12 +03:00
|
|
|
|
'')) +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.usbAuth ''
|
|
|
|
|
auth sufficient ${pkgs.pam_usb}/lib/security/pam_usb.so
|
|
|
|
|
'' +
|
2022-03-13 20:20:23 +03:00
|
|
|
|
(let ussh = config.security.pam.ussh; in optionalString (config.security.pam.ussh.enable && cfg.usshAuth) ''
|
|
|
|
|
auth ${ussh.control} ${pkgs.pam_ussh}/lib/security/pam_ussh.so ${optionalString (ussh.caFile != null) "ca_file=${ussh.caFile}"} ${optionalString (ussh.authorizedPrincipals != null) "authorized_principals=${ussh.authorizedPrincipals}"} ${optionalString (ussh.authorizedPrincipalsFile != null) "authorized_principals_file=${ussh.authorizedPrincipalsFile}"} ${optionalString (ussh.group != null) "group=${ussh.group}"}
|
|
|
|
|
'') +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
(let oath = config.security.pam.oath; in optionalString cfg.oathAuth ''
|
2022-04-04 04:08:24 +03:00
|
|
|
|
auth requisite ${pkgs.oath-toolkit}/lib/security/pam_oath.so window=${toString oath.window} usersfile=${toString oath.usersFile} digits=${toString oath.digits}
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'') +
|
|
|
|
|
(let yubi = config.security.pam.yubico; in optionalString cfg.yubicoAuth ''
|
|
|
|
|
auth ${yubi.control} ${pkgs.yubico-pam}/lib/security/pam_yubico.so mode=${toString yubi.mode} ${optionalString (yubi.challengeResponsePath != null) "chalresp_path=${yubi.challengeResponsePath}"} ${optionalString (yubi.mode == "client") "id=${toString yubi.id}"} ${optionalString yubi.debug "debug"}
|
|
|
|
|
'') +
|
|
|
|
|
optionalString cfg.fprintAuth ''
|
|
|
|
|
auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
|
|
|
|
|
'' +
|
2015-11-22 00:04:11 +03:00
|
|
|
|
# Modules in this block require having the password set in PAM_AUTHTOK.
|
|
|
|
|
# pam_unix is marked as 'sufficient' on NixOS which means nothing will run
|
|
|
|
|
# after it succeeds. Certain modules need to run after pam_unix
|
2022-05-18 16:22:46 +03:00
|
|
|
|
# prompts the user for password so we run it once with 'optional' at an
|
2015-11-22 00:04:11 +03:00
|
|
|
|
# earlier point and it will run again with 'sufficient' further down.
|
2022-12-08 11:49:12 +03:00
|
|
|
|
# We use try_first_pass the second time to avoid prompting password twice.
|
|
|
|
|
#
|
|
|
|
|
# The same principle applies to systemd-homed
|
|
|
|
|
(optionalString ((cfg.unixAuth || config.services.homed.enable) &&
|
2021-11-12 04:19:54 +03:00
|
|
|
|
(config.security.pam.enableEcryptfs
|
2022-05-17 21:16:22 +03:00
|
|
|
|
|| config.security.pam.enableFscrypt
|
2021-11-12 04:19:54 +03:00
|
|
|
|
|| cfg.pamMount
|
|
|
|
|
|| cfg.enableKwallet
|
|
|
|
|
|| cfg.enableGnomeKeyring
|
|
|
|
|
|| cfg.googleAuthenticator.enable
|
|
|
|
|
|| cfg.gnupg.enable
|
2022-11-07 14:16:35 +03:00
|
|
|
|
|| cfg.failDelay.enable
|
2021-11-12 04:19:54 +03:00
|
|
|
|
|| cfg.duoSecurity.enable))
|
|
|
|
|
(
|
2022-12-08 11:49:12 +03:00
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
auth optional ${config.systemd.package}/lib/security/pam_systemd_home.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.unixAuth ''
|
2022-05-18 16:22:46 +03:00
|
|
|
|
auth optional pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString config.security.pam.enableEcryptfs ''
|
|
|
|
|
auth optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so unwrap
|
|
|
|
|
'' +
|
2022-05-17 21:16:22 +03:00
|
|
|
|
optionalString config.security.pam.enableFscrypt ''
|
|
|
|
|
auth optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.pamMount ''
|
|
|
|
|
auth optional ${pkgs.pam_mount}/lib/security/pam_mount.so disable_interactive
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.enableKwallet ''
|
|
|
|
|
auth optional ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so kwalletd=${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.enableGnomeKeyring ''
|
|
|
|
|
auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.gnupg.enable ''
|
|
|
|
|
auth optional ${pkgs.pam_gnupg}/lib/security/pam_gnupg.so ${optionalString cfg.gnupg.storeOnly " store-only"}
|
|
|
|
|
'' +
|
2022-11-07 14:16:35 +03:00
|
|
|
|
optionalString cfg.failDelay.enable ''
|
|
|
|
|
auth optional ${pkgs.pam}/lib/security/pam_faildelay.so delay=${toString cfg.failDelay.delay}
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.googleAuthenticator.enable ''
|
2022-03-02 18:18:58 +03:00
|
|
|
|
auth required ${pkgs.google-authenticator}/lib/security/pam_google_authenticator.so no_increment_hotp
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.duoSecurity.enable ''
|
|
|
|
|
auth required ${pkgs.duo-unix}/lib/security/pam_duo.so
|
|
|
|
|
''
|
|
|
|
|
)) +
|
2022-12-08 11:49:12 +03:00
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
auth sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.unixAuth ''
|
|
|
|
|
auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth try_first_pass
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.otpwAuth ''
|
|
|
|
|
auth sufficient ${pkgs.otpw}/lib/security/pam_otpw.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString use_ldap ''
|
|
|
|
|
auth sufficient ${pam_ldap}/lib/security/pam_ldap.so use_first_pass
|
|
|
|
|
'' +
|
|
|
|
|
optionalString config.services.sssd.enable ''
|
|
|
|
|
auth sufficient ${pkgs.sssd}/lib/security/pam_sss.so use_first_pass
|
|
|
|
|
'' +
|
2022-07-16 08:38:42 +03:00
|
|
|
|
optionalString config.security.pam.krb5.enable ''
|
2012-06-12 02:41:07 +04:00
|
|
|
|
auth [default=ignore success=1 service_err=reset] ${pam_krb5}/lib/security/pam_krb5.so use_first_pass
|
|
|
|
|
auth [default=die success=done] ${pam_ccreds}/lib/security/pam_ccreds.so action=validate use_first_pass
|
|
|
|
|
auth sufficient ${pam_ccreds}/lib/security/pam_ccreds.so action=store use_first_pass
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
''
|
|
|
|
|
auth required pam_deny.so
|
|
|
|
|
|
|
|
|
|
# Password management.
|
2022-12-08 11:49:12 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
password sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
|
|
|
|
'' + ''
|
2021-11-12 04:19:54 +03:00
|
|
|
|
password sufficient pam_unix.so nullok sha512
|
|
|
|
|
'' +
|
|
|
|
|
optionalString config.security.pam.enableEcryptfs ''
|
|
|
|
|
password optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so
|
|
|
|
|
'' +
|
2022-05-17 21:16:22 +03:00
|
|
|
|
optionalString config.security.pam.enableFscrypt ''
|
|
|
|
|
password optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.pamMount ''
|
|
|
|
|
password optional ${pkgs.pam_mount}/lib/security/pam_mount.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString use_ldap ''
|
|
|
|
|
password sufficient ${pam_ldap}/lib/security/pam_ldap.so
|
|
|
|
|
'' +
|
2022-07-29 18:23:44 +03:00
|
|
|
|
optionalString cfg.mysqlAuth ''
|
|
|
|
|
password sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString config.services.sssd.enable ''
|
|
|
|
|
password sufficient ${pkgs.sssd}/lib/security/pam_sss.so use_authtok
|
|
|
|
|
'' +
|
2022-07-16 08:38:42 +03:00
|
|
|
|
optionalString config.security.pam.krb5.enable ''
|
2021-11-12 04:19:54 +03:00
|
|
|
|
password sufficient ${pam_krb5}/lib/security/pam_krb5.so use_first_pass
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.enableGnomeKeyring ''
|
|
|
|
|
password optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so use_authtok
|
|
|
|
|
'' +
|
|
|
|
|
''
|
|
|
|
|
|
|
|
|
|
# Session management.
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.setEnvironment ''
|
2021-07-28 07:28:25 +03:00
|
|
|
|
session required pam_env.so conffile=/etc/pam/environment readenv=0
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
''
|
|
|
|
|
session required pam_unix.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.setLoginUid ''
|
|
|
|
|
session ${if config.boot.isContainer then "optional" else "required"} pam_loginuid.so
|
|
|
|
|
'' +
|
2022-10-23 00:20:09 +03:00
|
|
|
|
optionalString cfg.ttyAudit.enable (concatStringsSep " \\\n " ([
|
|
|
|
|
"session required ${pkgs.pam}/lib/security/pam_tty_audit.so"
|
|
|
|
|
] ++ optional cfg.ttyAudit.openOnly "open_only"
|
|
|
|
|
++ optional (cfg.ttyAudit.enablePattern != null) "enable=${cfg.ttyAudit.enablePattern}"
|
|
|
|
|
++ optional (cfg.ttyAudit.disablePattern != null) "disable=${cfg.ttyAudit.disablePattern}"
|
|
|
|
|
)) +
|
2022-12-08 11:49:12 +03:00
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
session required ${config.systemd.package}/lib/security/pam_systemd_home.so
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.makeHomeDir ''
|
|
|
|
|
session required ${pkgs.pam}/lib/security/pam_mkhomedir.so silent skel=${config.security.pam.makeHomeDir.skelDirectory} umask=0077
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.updateWtmp ''
|
|
|
|
|
session required ${pkgs.pam}/lib/security/pam_lastlog.so silent
|
|
|
|
|
'' +
|
|
|
|
|
optionalString config.security.pam.enableEcryptfs ''
|
|
|
|
|
session optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so
|
|
|
|
|
'' +
|
2022-05-17 21:16:22 +03:00
|
|
|
|
optionalString config.security.pam.enableFscrypt ''
|
|
|
|
|
# Work around https://github.com/systemd/systemd/issues/8598
|
|
|
|
|
# Skips the pam_fscrypt module for systemd-user sessions which do not have a password
|
|
|
|
|
# anyways.
|
|
|
|
|
# See also https://github.com/google/fscrypt/issues/95
|
|
|
|
|
session [success=1 default=ignore] pam_succeed_if.so service = systemd-user
|
|
|
|
|
session optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString cfg.pamMount ''
|
|
|
|
|
session optional ${pkgs.pam_mount}/lib/security/pam_mount.so disable_interactive
|
|
|
|
|
'' +
|
|
|
|
|
optionalString use_ldap ''
|
|
|
|
|
session optional ${pam_ldap}/lib/security/pam_ldap.so
|
|
|
|
|
'' +
|
2022-07-29 18:23:44 +03:00
|
|
|
|
optionalString cfg.mysqlAuth ''
|
|
|
|
|
session optional ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
|
|
|
|
|
'' +
|
2021-11-12 04:19:54 +03:00
|
|
|
|
optionalString config.services.sssd.enable ''
|
|
|
|
|
session optional ${pkgs.sssd}/lib/security/pam_sss.so
|
|
|
|
|
'' +
|
2022-07-16 08:38:42 +03:00
|
|
|
|
optionalString config.security.pam.krb5.enable ''
|
2021-11-12 04:19:54 +03:00
|
|
|
|
session optional ${pam_krb5}/lib/security/pam_krb5.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.otpwAuth ''
|
|
|
|
|
session optional ${pkgs.otpw}/lib/security/pam_otpw.so
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.startSession ''
|
2022-05-05 14:23:32 +03:00
|
|
|
|
session optional ${config.systemd.package}/lib/security/pam_systemd.so
|
2021-11-12 04:19:54 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.forwardXAuth ''
|
|
|
|
|
session optional pam_xauth.so xauthpath=${pkgs.xorg.xauth}/bin/xauth systemuser=99
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (cfg.limits != []) ''
|
|
|
|
|
session required ${pkgs.pam}/lib/security/pam_limits.so conf=${makeLimitsConf cfg.limits}
|
|
|
|
|
'' +
|
2022-11-11 18:11:37 +03:00
|
|
|
|
optionalString (cfg.showMotd && (config.users.motd != null || config.users.motdFile != null)) ''
|
2021-11-12 04:19:54 +03:00
|
|
|
|
session optional ${pkgs.pam}/lib/security/pam_motd.so motd=${motd}
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (cfg.enableAppArmor && config.security.apparmor.enable) ''
|
|
|
|
|
session optional ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so order=user,group,default debug
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (cfg.enableKwallet) ''
|
|
|
|
|
session optional ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so kwalletd=${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (cfg.enableGnomeKeyring) ''
|
|
|
|
|
session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start
|
|
|
|
|
'' +
|
|
|
|
|
optionalString cfg.gnupg.enable ''
|
|
|
|
|
session optional ${pkgs.pam_gnupg}/lib/security/pam_gnupg.so ${optionalString cfg.gnupg.noAutostart " no-autostart"}
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (config.virtualisation.lxc.lxcfs.enable) ''
|
|
|
|
|
session optional ${pkgs.lxc}/lib/security/pam_cgfs.so -c all
|
|
|
|
|
''
|
|
|
|
|
);
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inherit (pkgs) pam_krb5 pam_ccreds;
|
|
|
|
|
|
2016-07-18 16:20:21 +03:00
|
|
|
|
use_ldap = (config.users.ldap.enable && config.users.ldap.loginPam);
|
2013-10-15 16:47:51 +04:00
|
|
|
|
pam_ldap = if config.users.ldap.daemon.enable then pkgs.nss_pam_ldapd else pkgs.pam_ldap;
|
|
|
|
|
|
|
|
|
|
# Create a limits.conf(5) file.
|
|
|
|
|
makeLimitsConf = limits:
|
|
|
|
|
pkgs.writeText "limits.conf"
|
2013-10-17 17:36:59 +04:00
|
|
|
|
(concatMapStrings ({ domain, type, item, value }:
|
|
|
|
|
"${domain} ${type} ${item} ${toString value}\n")
|
|
|
|
|
limits);
|
2013-10-15 16:47:51 +04:00
|
|
|
|
|
2021-12-07 20:26:25 +03:00
|
|
|
|
limitsType = with lib.types; listOf (submodule ({ ... }: {
|
|
|
|
|
options = {
|
|
|
|
|
domain = mkOption {
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Username, groupname, or wildcard this limit applies to";
|
2021-12-07 20:26:25 +03:00
|
|
|
|
example = "@wheel";
|
|
|
|
|
type = str;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type = mkOption {
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Type of this limit";
|
2021-12-07 20:26:25 +03:00
|
|
|
|
type = enum [ "-" "hard" "soft" ];
|
|
|
|
|
default = "-";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
item = mkOption {
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Item this limit applies to";
|
2021-12-07 20:26:25 +03:00
|
|
|
|
type = enum [
|
|
|
|
|
"core"
|
|
|
|
|
"data"
|
|
|
|
|
"fsize"
|
|
|
|
|
"memlock"
|
|
|
|
|
"nofile"
|
|
|
|
|
"rss"
|
|
|
|
|
"stack"
|
|
|
|
|
"cpu"
|
|
|
|
|
"nproc"
|
|
|
|
|
"as"
|
|
|
|
|
"maxlogins"
|
|
|
|
|
"maxsyslogins"
|
|
|
|
|
"priority"
|
|
|
|
|
"locks"
|
|
|
|
|
"sigpending"
|
|
|
|
|
"msgqueue"
|
|
|
|
|
"nice"
|
|
|
|
|
"rtprio"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
value = mkOption {
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Value of this limit";
|
2021-12-07 20:26:25 +03:00
|
|
|
|
type = oneOf [ str int ];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}));
|
|
|
|
|
|
2022-11-11 18:11:37 +03:00
|
|
|
|
motd = if isNull config.users.motdFile
|
|
|
|
|
then pkgs.writeText "motd" config.users.motd
|
|
|
|
|
else config.users.motdFile;
|
2013-10-15 16:47:51 +04:00
|
|
|
|
|
2019-09-14 20:51:29 +03:00
|
|
|
|
makePAMService = name: service:
|
|
|
|
|
{ name = "pam.d/${name}";
|
|
|
|
|
value.source = pkgs.writeText "${name}.pam" service.text;
|
2009-05-28 17:10:02 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
2009-08-16 18:49:14 +04:00
|
|
|
|
|
2019-12-10 04:51:19 +03:00
|
|
|
|
imports = [
|
|
|
|
|
(mkRenamedOptionModule [ "security" "pam" "enableU2F" ] [ "security" "pam" "u2f" "enable" ])
|
|
|
|
|
];
|
|
|
|
|
|
2009-08-16 18:49:14 +04:00
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
2010-01-12 14:02:23 +03:00
|
|
|
|
security.pam.loginLimits = mkOption {
|
|
|
|
|
default = [];
|
2021-12-07 20:26:25 +03:00
|
|
|
|
type = limitsType;
|
2010-01-12 14:02:23 +03:00
|
|
|
|
example =
|
|
|
|
|
[ { domain = "ftp";
|
|
|
|
|
type = "hard";
|
|
|
|
|
item = "nproc";
|
|
|
|
|
value = "0";
|
|
|
|
|
}
|
|
|
|
|
{ domain = "@student";
|
|
|
|
|
type = "-";
|
|
|
|
|
item = "maxlogins";
|
|
|
|
|
value = "4";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2022-08-28 22:18:44 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-08-14 06:16:55 +03:00
|
|
|
|
Define resource limits that should apply to users or groups.
|
|
|
|
|
Each item in the list should be an attribute set with a
|
2022-08-28 22:18:44 +03:00
|
|
|
|
{var}`domain`, {var}`type`,
|
|
|
|
|
{var}`item`, and {var}`value`
|
2022-08-14 06:16:55 +03:00
|
|
|
|
attribute. The syntax and semantics of these attributes
|
2022-08-28 22:18:44 +03:00
|
|
|
|
must be that described in {manpage}`limits.conf(5)`.
|
2022-08-14 06:16:55 +03:00
|
|
|
|
|
|
|
|
|
Note that these limits do not apply to systemd services,
|
2022-08-28 22:18:44 +03:00
|
|
|
|
whose limits can be changed via {option}`systemd.extraConfig`
|
2022-08-14 06:16:55 +03:00
|
|
|
|
instead.
|
|
|
|
|
'';
|
2010-01-12 14:02:23 +03:00
|
|
|
|
};
|
|
|
|
|
|
2009-08-16 18:49:14 +04:00
|
|
|
|
security.pam.services = mkOption {
|
2021-10-03 19:06:03 +03:00
|
|
|
|
default = {};
|
2020-08-23 02:28:45 +03:00
|
|
|
|
type = with types; attrsOf (submodule pamOpts);
|
2009-08-16 18:49:14 +04:00
|
|
|
|
description =
|
2022-07-29 00:19:15 +03:00
|
|
|
|
lib.mdDoc ''
|
2009-08-16 18:49:14 +04:00
|
|
|
|
This option defines the PAM services. A service typically
|
|
|
|
|
corresponds to a program that uses PAM,
|
2022-07-29 00:19:15 +03:00
|
|
|
|
e.g. {command}`login` or {command}`passwd`.
|
2013-10-15 16:47:51 +04:00
|
|
|
|
Each attribute of this set defines a PAM service, with the attribute name
|
|
|
|
|
defining the name of the service.
|
2009-08-16 18:49:14 +04:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-14 21:18:09 +03:00
|
|
|
|
security.pam.makeHomeDir.skelDirectory = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
default = "/var/empty";
|
|
|
|
|
example = "/etc/skel";
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2016-04-14 21:18:09 +03:00
|
|
|
|
Path to skeleton directory whose contents are copied to home
|
2022-07-29 00:19:15 +03:00
|
|
|
|
directories newly created by `pam_mkhomedir`.
|
2016-04-14 21:18:09 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-06-12 02:41:07 +04:00
|
|
|
|
security.pam.enableSSHAgentAuth = mkOption {
|
2020-04-27 10:04:07 +03:00
|
|
|
|
type = types.bool;
|
2012-06-12 02:41:07 +04:00
|
|
|
|
default = false;
|
|
|
|
|
description =
|
2022-07-29 00:19:15 +03:00
|
|
|
|
lib.mdDoc ''
|
2012-06-12 02:41:07 +04:00
|
|
|
|
Enable sudo logins if the user's SSH agent provides a key
|
2022-07-29 00:19:15 +03:00
|
|
|
|
present in {file}`~/.ssh/authorized_keys`.
|
2012-06-12 02:41:07 +04:00
|
|
|
|
This allows machines to exclusively use SSH keys instead of
|
|
|
|
|
passwords.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-28 22:18:44 +03:00
|
|
|
|
security.pam.enableOTPW = mkEnableOption (lib.mdDoc "the OTPW (one-time password) PAM module");
|
2013-03-31 00:06:23 +04:00
|
|
|
|
|
2022-07-16 08:38:42 +03:00
|
|
|
|
security.pam.krb5 = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = config.krb5.enable;
|
|
|
|
|
defaultText = literalExpression "config.krb5.enable";
|
|
|
|
|
type = types.bool;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enables Kerberos PAM modules (`pam-krb5`,
|
|
|
|
|
`pam-ccreds`).
|
2022-07-16 08:38:42 +03:00
|
|
|
|
|
|
|
|
|
If set, users can authenticate with their Kerberos password.
|
|
|
|
|
This requires a valid Kerberos configuration
|
2022-08-03 23:46:41 +03:00
|
|
|
|
(`config.krb5.enable` should be set to
|
|
|
|
|
`true`).
|
2022-07-16 08:38:42 +03:00
|
|
|
|
|
|
|
|
|
Note that the Kerberos PAM modules are not necessary when using SSS
|
|
|
|
|
to handle Kerberos authentication.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-30 12:03:10 +03:00
|
|
|
|
security.pam.p11 = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enables P11 PAM (`pam_p11`) module.
|
2020-05-30 12:03:10 +03:00
|
|
|
|
|
|
|
|
|
If set, users can log in with SSH keys and PKCS#11 tokens.
|
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://github.com/OpenSC/pam_p11).
|
2020-05-30 12:03:10 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
control = mkOption {
|
|
|
|
|
default = "sufficient";
|
|
|
|
|
type = types.enum [ "required" "requisite" "sufficient" "optional" ];
|
2022-08-05 20:39:00 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2020-05-30 12:03:10 +03:00
|
|
|
|
This option sets pam "control".
|
|
|
|
|
If you want to have multi factor authentication, use "required".
|
|
|
|
|
If you want to use the PKCS#11 device instead of the regular password,
|
|
|
|
|
use "sufficient".
|
|
|
|
|
|
|
|
|
|
Read
|
2022-08-05 20:39:00 +03:00
|
|
|
|
{manpage}`pam.conf(5)`
|
2020-05-30 12:03:10 +03:00
|
|
|
|
for better understanding of this option.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-29 19:45:26 +03:00
|
|
|
|
security.pam.u2f = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enables U2F PAM (`pam-u2f`) module.
|
2019-01-29 19:45:26 +03:00
|
|
|
|
|
|
|
|
|
If set, users listed in
|
2022-08-03 23:46:41 +03:00
|
|
|
|
{file}`$XDG_CONFIG_HOME/Yubico/u2f_keys` (or
|
|
|
|
|
{file}`$HOME/.config/Yubico/u2f_keys` if XDG variable is
|
2019-01-29 19:45:26 +03:00
|
|
|
|
not set) are able to log in with the associated U2F key. The path can
|
2022-08-03 23:46:41 +03:00
|
|
|
|
be changed using {option}`security.pam.u2f.authFile` option.
|
2019-01-29 19:45:26 +03:00
|
|
|
|
|
|
|
|
|
File format is:
|
2022-08-03 23:46:41 +03:00
|
|
|
|
`username:first_keyHandle,first_public_key: second_keyHandle,second_public_key`
|
|
|
|
|
This file can be generated using {command}`pamu2fcfg` command.
|
2019-01-29 19:45:26 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/pam-u2f/).
|
2019-01-29 19:45:26 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
authFile = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr path;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
By default `pam-u2f` module reads the keys from
|
|
|
|
|
{file}`$XDG_CONFIG_HOME/Yubico/u2f_keys` (or
|
|
|
|
|
{file}`$HOME/.config/Yubico/u2f_keys` if XDG variable is
|
2019-01-29 19:45:26 +03:00
|
|
|
|
not set).
|
|
|
|
|
|
|
|
|
|
If you want to change auth file locations or centralize database (for
|
2022-08-03 23:46:41 +03:00
|
|
|
|
example use {file}`/etc/u2f-mappings`) you can set this
|
2019-01-29 19:45:26 +03:00
|
|
|
|
option.
|
|
|
|
|
|
|
|
|
|
File format is:
|
2022-08-03 23:46:41 +03:00
|
|
|
|
`username:first_keyHandle,first_public_key: second_keyHandle,second_public_key`
|
|
|
|
|
This file can be generated using {command}`pamu2fcfg` command.
|
2019-01-29 19:45:26 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/pam-u2f/).
|
2019-01-29 19:45:26 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
2020-10-09 11:31:15 +03:00
|
|
|
|
|
2020-10-08 21:37:40 +03:00
|
|
|
|
appId = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr str;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
By default `pam-u2f` module sets the application
|
|
|
|
|
ID to `pam://$HOSTNAME`.
|
2020-10-08 21:37:40 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
When using {command}`pamu2fcfg`, you can specify your
|
|
|
|
|
application ID with the `-i` flag.
|
2020-10-08 21:37:40 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/pam-u2f/Manuals/pam_u2f.8.html)
|
2020-10-08 21:37:40 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
2019-01-29 19:45:26 +03:00
|
|
|
|
|
2022-04-06 13:23:17 +03:00
|
|
|
|
origin = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr str;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
By default `pam-u2f` module sets the origin
|
|
|
|
|
to `pam://$HOSTNAME`.
|
2022-04-06 13:23:17 +03:00
|
|
|
|
Setting origin to an host independent value will allow you to
|
|
|
|
|
reuse credentials across machines
|
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
When using {command}`pamu2fcfg`, you can specify your
|
|
|
|
|
application ID with the `-o` flag.
|
2022-04-06 13:23:17 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/pam-u2f/Manuals/pam_u2f.8.html)
|
2022-04-06 13:23:17 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-29 19:45:26 +03:00
|
|
|
|
control = mkOption {
|
|
|
|
|
default = "sufficient";
|
|
|
|
|
type = types.enum [ "required" "requisite" "sufficient" "optional" ];
|
2022-08-05 20:39:00 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-01-29 19:45:26 +03:00
|
|
|
|
This option sets pam "control".
|
|
|
|
|
If you want to have multi factor authentication, use "required".
|
|
|
|
|
If you want to use U2F device instead of regular password, use "sufficient".
|
|
|
|
|
|
|
|
|
|
Read
|
2022-08-05 20:39:00 +03:00
|
|
|
|
{manpage}`pam.conf(5)`
|
2019-01-29 19:45:26 +03:00
|
|
|
|
for better understanding of this option.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
debug = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-01-29 19:45:26 +03:00
|
|
|
|
Debug output to stderr.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
interactive = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-01-29 19:45:26 +03:00
|
|
|
|
Set to prompt a message and wait before testing the presence of a U2F device.
|
|
|
|
|
Recommended if your device doesn’t have a tactile trigger.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cue = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
By default `pam-u2f` module does not inform user
|
2019-01-29 19:45:26 +03:00
|
|
|
|
that he needs to use the u2f device, it just waits without a prompt.
|
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
If you set this option to `true`,
|
|
|
|
|
`cue` option is added to `pam-u2f`
|
2019-01-29 19:45:26 +03:00
|
|
|
|
module and reminder message will be displayed.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2015-05-03 17:29:42 +03:00
|
|
|
|
};
|
|
|
|
|
|
2022-03-13 20:20:23 +03:00
|
|
|
|
security.pam.ussh = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enables Uber's USSH PAM (`pam-ussh`) module.
|
2022-03-13 20:20:23 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
This is similar to `pam-ssh-agent`, except that
|
2022-03-13 20:20:23 +03:00
|
|
|
|
the presence of a CA-signed SSH key with a valid principal is checked
|
|
|
|
|
instead.
|
|
|
|
|
|
|
|
|
|
Note that this module must both be enabled using this option and on a
|
2022-08-03 23:46:41 +03:00
|
|
|
|
per-PAM-service level as well (using `usshAuth`).
|
2022-03-13 20:20:23 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://github.com/uber/pam-ussh).
|
2022-03-13 20:20:23 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
caFile = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr path;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
By default `pam-ussh` reads the trusted user CA keys
|
|
|
|
|
from {file}`/etc/ssh/trusted_user_ca`.
|
2022-03-13 20:20:23 +03:00
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
This should be set the same as your `TrustedUserCAKeys`
|
2022-03-13 20:20:23 +03:00
|
|
|
|
option for sshd.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
authorizedPrincipals = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr commas;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-03-13 20:20:23 +03:00
|
|
|
|
Comma-separated list of authorized principals to permit; if the user
|
|
|
|
|
presents a certificate with one of these principals, then they will be
|
|
|
|
|
authorized.
|
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
Note that `pam-ussh` also requires that the certificate
|
2022-03-13 20:20:23 +03:00
|
|
|
|
contain a principal matching the user's username. The principals from
|
|
|
|
|
this list are in addition to those principals.
|
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
Mutually exclusive with `authorizedPrincipalsFile`.
|
2022-03-13 20:20:23 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
authorizedPrincipalsFile = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr path;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-03-13 20:20:23 +03:00
|
|
|
|
Path to a list of principals; if the user presents a certificate with
|
|
|
|
|
one of these principals, then they will be authorized.
|
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
Note that `pam-ussh` also requires that the certificate
|
2022-03-13 20:20:23 +03:00
|
|
|
|
contain a principal matching the user's username. The principals from
|
|
|
|
|
this file are in addition to those principals.
|
|
|
|
|
|
2022-07-29 00:19:15 +03:00
|
|
|
|
Mutually exclusive with `authorizedPrincipals`.
|
2022-03-13 20:20:23 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = with types; nullOr str;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-03-13 20:20:23 +03:00
|
|
|
|
If set, then the authenticating user must be a member of this group
|
|
|
|
|
to use this module.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
control = mkOption {
|
|
|
|
|
default = "sufficient";
|
|
|
|
|
type = types.enum [ "required" "requisite" "sufficient" "optional" ];
|
2022-08-05 20:39:00 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2022-03-13 20:20:23 +03:00
|
|
|
|
This option sets pam "control".
|
|
|
|
|
If you want to have multi factor authentication, use "required".
|
|
|
|
|
If you want to use the SSH certificate instead of the regular password,
|
|
|
|
|
use "sufficient".
|
|
|
|
|
|
|
|
|
|
Read
|
2022-08-05 20:39:00 +03:00
|
|
|
|
{manpage}`pam.conf(5)`
|
2022-03-13 20:20:23 +03:00
|
|
|
|
for better understanding of this option.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-31 04:07:16 +03:00
|
|
|
|
security.pam.yubico = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enables Yubico PAM (`yubico-pam`) module.
|
2019-03-31 04:07:16 +03:00
|
|
|
|
|
|
|
|
|
If set, users listed in
|
2022-08-03 23:46:41 +03:00
|
|
|
|
{file}`~/.yubico/authorized_yubikeys`
|
2019-03-31 04:07:16 +03:00
|
|
|
|
are able to log in with the associated Yubikey tokens.
|
|
|
|
|
|
|
|
|
|
The file must have only one line:
|
2022-08-03 23:46:41 +03:00
|
|
|
|
`username:yubikey_token_id1:yubikey_token_id2`
|
|
|
|
|
More information can be found [here](https://developers.yubico.com/yubico-pam/).
|
2019-03-31 04:07:16 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
control = mkOption {
|
|
|
|
|
default = "sufficient";
|
|
|
|
|
type = types.enum [ "required" "requisite" "sufficient" "optional" ];
|
2022-08-05 20:39:00 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-03-31 04:07:16 +03:00
|
|
|
|
This option sets pam "control".
|
|
|
|
|
If you want to have multi factor authentication, use "required".
|
|
|
|
|
If you want to use Yubikey instead of regular password, use "sufficient".
|
|
|
|
|
|
|
|
|
|
Read
|
2022-08-05 20:39:00 +03:00
|
|
|
|
{manpage}`pam.conf(5)`
|
2019-03-31 04:07:16 +03:00
|
|
|
|
for better understanding of this option.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
id = mkOption {
|
|
|
|
|
example = "42";
|
2019-08-08 23:48:27 +03:00
|
|
|
|
type = types.str;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "client id";
|
2019-03-31 04:07:16 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
debug = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-03-31 04:07:16 +03:00
|
|
|
|
Debug output to stderr.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2019-08-30 20:33:08 +03:00
|
|
|
|
mode = mkOption {
|
|
|
|
|
default = "client";
|
|
|
|
|
type = types.enum [ "client" "challenge-response" ];
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2019-08-30 20:33:08 +03:00
|
|
|
|
Mode of operation.
|
|
|
|
|
|
|
|
|
|
Use "client" for online validation with a YubiKey validation service such as
|
|
|
|
|
the YubiCloud.
|
|
|
|
|
|
|
|
|
|
Use "challenge-response" for offline validation using YubiKeys with HMAC-SHA-1
|
|
|
|
|
Challenge-Response configurations. See the man-page ykpamcfg(1) for further
|
2019-12-10 04:51:19 +03:00
|
|
|
|
details on how to configure offline Challenge-Response validation.
|
2019-08-30 20:33:08 +03:00
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/yubico-pam/Authentication_Using_Challenge-Response.html).
|
2021-07-17 09:56:55 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
challengeResponsePath = mkOption {
|
|
|
|
|
default = null;
|
2021-08-17 17:55:50 +03:00
|
|
|
|
type = types.nullOr types.path;
|
2022-08-03 23:46:41 +03:00
|
|
|
|
description = lib.mdDoc ''
|
2021-07-17 09:56:55 +03:00
|
|
|
|
If not null, set the path used by yubico pam module where the challenge expected response is stored.
|
|
|
|
|
|
2022-08-03 23:46:41 +03:00
|
|
|
|
More information can be found [here](https://developers.yubico.com/yubico-pam/Authentication_Using_Challenge-Response.html).
|
2019-08-30 20:33:08 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
2019-03-31 04:07:16 +03:00
|
|
|
|
};
|
|
|
|
|
|
2022-08-28 22:18:44 +03:00
|
|
|
|
security.pam.enableEcryptfs = mkEnableOption (lib.mdDoc "eCryptfs PAM module (mounting ecryptfs home directory on login)");
|
2022-05-17 21:16:22 +03:00
|
|
|
|
security.pam.enableFscrypt = mkEnableOption (lib.mdDoc ''
|
|
|
|
|
Enables fscrypt to automatically unlock directories with the user's login password.
|
|
|
|
|
|
|
|
|
|
This also enables a service at security.pam.services.fscrypt which is used by
|
|
|
|
|
fscrypt to verify the user's password when setting up a new protector. If you
|
|
|
|
|
use something other than pam_unix to verify user passwords, please remember to
|
|
|
|
|
adjust this PAM service.
|
|
|
|
|
'');
|
2015-03-05 03:33:05 +03:00
|
|
|
|
|
2012-10-23 17:10:48 +04:00
|
|
|
|
users.motd = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
example = "Today is Sweetmorn, the 4th day of The Aftermath in the YOLD 3178.";
|
2015-08-17 20:52:45 +03:00
|
|
|
|
type = types.nullOr types.lines;
|
2022-07-29 00:19:15 +03:00
|
|
|
|
description = lib.mdDoc "Message of the day shown to users when they log in.";
|
2012-10-23 17:10:48 +04:00
|
|
|
|
};
|
|
|
|
|
|
2022-11-11 18:11:37 +03:00
|
|
|
|
users.motdFile = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
example = "/etc/motd";
|
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
|
description = lib.mdDoc "A file containing the message of the day shown to users when they log in.";
|
|
|
|
|
};
|
2009-08-16 18:49:14 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
|
|
config = {
|
2022-11-11 18:11:37 +03:00
|
|
|
|
assertions = [
|
|
|
|
|
{
|
|
|
|
|
assertion = isNull config.users.motd || isNull config.users.motdFile;
|
|
|
|
|
message = ''
|
|
|
|
|
Only one of users.motd and users.motdFile can be set.
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
];
|
2010-08-13 18:07:34 +04:00
|
|
|
|
|
2009-08-16 18:49:14 +04:00
|
|
|
|
environment.systemPackages =
|
|
|
|
|
# Include the PAM modules in the system path mostly for the manpages.
|
2010-06-02 23:59:44 +04:00
|
|
|
|
[ pkgs.pam ]
|
2010-08-06 12:50:48 +04:00
|
|
|
|
++ optional config.users.ldap.enable pam_ldap
|
2016-04-14 21:18:09 +03:00
|
|
|
|
++ optional config.services.sssd.enable pkgs.sssd
|
2022-07-16 08:38:42 +03:00
|
|
|
|
++ optionals config.security.pam.krb5.enable [pam_krb5 pam_ccreds]
|
2015-02-15 01:52:22 +03:00
|
|
|
|
++ optionals config.security.pam.enableOTPW [ pkgs.otpw ]
|
2022-04-04 04:08:24 +03:00
|
|
|
|
++ optionals config.security.pam.oath.enable [ pkgs.oath-toolkit ]
|
2020-05-30 12:03:10 +03:00
|
|
|
|
++ optionals config.security.pam.p11.enable [ pkgs.pam_p11 ]
|
2022-05-17 21:16:22 +03:00
|
|
|
|
++ optionals config.security.pam.enableFscrypt [ pkgs.fscrypt-experimental ]
|
2019-01-29 19:45:26 +03:00
|
|
|
|
++ optionals config.security.pam.u2f.enable [ pkgs.pam_u2f ];
|
2017-10-07 18:27:46 +03:00
|
|
|
|
|
|
|
|
|
boot.supportedFilesystems = optionals config.security.pam.enableEcryptfs [ "ecryptfs" ];
|
2015-03-05 03:33:05 +03:00
|
|
|
|
|
2017-01-29 14:33:56 +03:00
|
|
|
|
security.wrappers = {
|
|
|
|
|
unix_chkpwd = {
|
|
|
|
|
setuid = true;
|
2021-09-12 20:04:55 +03:00
|
|
|
|
owner = "root";
|
|
|
|
|
group = "root";
|
2022-01-09 12:20:36 +03:00
|
|
|
|
source = "${pkgs.pam}/bin/unix_chkpwd";
|
2017-01-29 14:33:56 +03:00
|
|
|
|
};
|
2017-10-07 18:27:46 +03:00
|
|
|
|
};
|
2009-08-16 18:49:14 +04:00
|
|
|
|
|
2019-09-14 20:51:29 +03:00
|
|
|
|
environment.etc = mapAttrs' makePAMService config.security.pam.services;
|
2009-08-16 18:49:14 +04:00
|
|
|
|
|
|
|
|
|
security.pam.services =
|
2013-10-15 16:47:51 +04:00
|
|
|
|
{ other.text =
|
|
|
|
|
''
|
|
|
|
|
auth required pam_warn.so
|
|
|
|
|
auth required pam_deny.so
|
|
|
|
|
account required pam_warn.so
|
|
|
|
|
account required pam_deny.so
|
|
|
|
|
password required pam_warn.so
|
|
|
|
|
password required pam_deny.so
|
|
|
|
|
session required pam_warn.so
|
|
|
|
|
session required pam_deny.so
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# Most of these should be moved to specific modules.
|
|
|
|
|
i3lock = {};
|
2016-05-15 08:47:31 +03:00
|
|
|
|
i3lock-color = {};
|
2013-10-15 16:47:51 +04:00
|
|
|
|
vlock = {};
|
|
|
|
|
xlock = {};
|
|
|
|
|
xscreensaver = {};
|
2016-09-06 18:23:27 +03:00
|
|
|
|
|
|
|
|
|
runuser = { rootOK = true; unixAuth = false; setEnvironment = false; };
|
|
|
|
|
|
|
|
|
|
/* FIXME: should runuser -l start a systemd session? Currently
|
|
|
|
|
it complains "Cannot create session: Already running in a
|
|
|
|
|
session". */
|
|
|
|
|
runuser-l = { rootOK = true; unixAuth = false; };
|
2022-05-17 21:16:22 +03:00
|
|
|
|
} // optionalAttrs (config.security.pam.enableFscrypt) {
|
|
|
|
|
# Allow fscrypt to verify login passphrase
|
|
|
|
|
fscrypt = {};
|
2013-10-15 16:47:51 +04:00
|
|
|
|
};
|
2009-08-16 18:49:14 +04:00
|
|
|
|
|
2020-10-18 16:36:24 +03:00
|
|
|
|
security.apparmor.includes."abstractions/pam" = let
|
|
|
|
|
isEnabled = test: fold or false (map test (attrValues config.security.pam.services));
|
2021-02-27 23:26:47 +03:00
|
|
|
|
in
|
2021-11-22 01:04:38 +03:00
|
|
|
|
lib.concatMapStrings
|
|
|
|
|
(name: "r ${config.environment.etc."pam.d/${name}".source},\n")
|
2021-02-27 23:26:47 +03:00
|
|
|
|
(attrNames config.security.pam.services) +
|
|
|
|
|
''
|
2020-10-18 16:36:24 +03:00
|
|
|
|
mr ${getLib pkgs.pam}/lib/security/pam_filter/*,
|
|
|
|
|
mr ${getLib pkgs.pam}/lib/security/pam_*.so,
|
|
|
|
|
r ${getLib pkgs.pam}/lib/security/,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString use_ldap ''
|
|
|
|
|
mr ${pam_ldap}/lib/security/pam_ldap.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString config.services.sssd.enable ''
|
|
|
|
|
mr ${pkgs.sssd}/lib/security/pam_sss.so,
|
|
|
|
|
'' +
|
2022-07-16 08:38:42 +03:00
|
|
|
|
optionalString config.security.pam.krb5.enable ''
|
2020-10-18 16:36:24 +03:00
|
|
|
|
mr ${pam_krb5}/lib/security/pam_krb5.so,
|
|
|
|
|
mr ${pam_ccreds}/lib/security/pam_ccreds.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.googleOsLoginAccountVerification)) ''
|
2021-03-18 20:02:07 +03:00
|
|
|
|
mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so,
|
|
|
|
|
mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.googleOsLoginAuthentication)) ''
|
2021-03-18 20:02:07 +03:00
|
|
|
|
mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString (config.security.pam.enableSSHAgentAuth
|
|
|
|
|
&& isEnabled (cfg: cfg.sshAgentAuth)) ''
|
|
|
|
|
mr ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.fprintAuth)) ''
|
|
|
|
|
mr ${pkgs.fprintd}/lib/security/pam_fprintd.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.u2fAuth)) ''
|
|
|
|
|
mr ${pkgs.pam_u2f}/lib/security/pam_u2f.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.usbAuth)) ''
|
|
|
|
|
mr ${pkgs.pam_usb}/lib/security/pam_usb.so,
|
|
|
|
|
'' +
|
2022-03-13 20:20:23 +03:00
|
|
|
|
optionalString (isEnabled (cfg: cfg.usshAuth)) ''
|
|
|
|
|
mr ${pkgs.pam_ussh}/lib/security/pam_ussh.so,
|
|
|
|
|
'' +
|
2021-02-27 23:26:47 +03:00
|
|
|
|
optionalString (isEnabled (cfg: cfg.oathAuth)) ''
|
2022-04-04 04:08:24 +03:00
|
|
|
|
"mr ${pkgs.oath-toolkit}/lib/security/pam_oath.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
2022-07-29 18:23:44 +03:00
|
|
|
|
optionalString (isEnabled (cfg: cfg.mysqlAuth)) ''
|
|
|
|
|
mr ${pkgs.pam_mysql}/lib/security/pam_mysql.so,
|
|
|
|
|
'' +
|
2021-02-27 23:26:47 +03:00
|
|
|
|
optionalString (isEnabled (cfg: cfg.yubicoAuth)) ''
|
|
|
|
|
mr ${pkgs.yubico-pam}/lib/security/pam_yubico.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.duoSecurity.enable)) ''
|
|
|
|
|
mr ${pkgs.duo-unix}/lib/security/pam_duo.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.otpwAuth)) ''
|
|
|
|
|
mr ${pkgs.otpw}/lib/security/pam_otpw.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString config.security.pam.enableEcryptfs ''
|
|
|
|
|
mr ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so,
|
|
|
|
|
'' +
|
2022-05-17 21:16:22 +03:00
|
|
|
|
optionalString config.security.pam.enableFscrypt ''
|
|
|
|
|
mr ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so,
|
|
|
|
|
'' +
|
2021-02-27 23:26:47 +03:00
|
|
|
|
optionalString (isEnabled (cfg: cfg.pamMount)) ''
|
|
|
|
|
mr ${pkgs.pam_mount}/lib/security/pam_mount.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.enableGnomeKeyring)) ''
|
2022-09-25 08:38:04 +03:00
|
|
|
|
mr ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.startSession)) ''
|
2022-05-05 14:23:32 +03:00
|
|
|
|
mr ${config.systemd.package}/lib/security/pam_systemd.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.enableAppArmor)
|
|
|
|
|
&& config.security.apparmor.enable) ''
|
|
|
|
|
mr ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so,
|
|
|
|
|
'' +
|
|
|
|
|
optionalString (isEnabled (cfg: cfg.enableKwallet)) ''
|
2021-05-30 22:42:39 +03:00
|
|
|
|
mr ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so,
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString config.virtualisation.lxc.lxcfs.enable ''
|
|
|
|
|
mr ${pkgs.lxc}/lib/security/pam_cgfs.so
|
2022-12-08 11:49:12 +03:00
|
|
|
|
'' +
|
|
|
|
|
optionalString config.services.homed.enable ''
|
|
|
|
|
mr ${config.systemd.package}/lib/security/pam_systemd_home.so
|
2021-02-27 23:26:47 +03:00
|
|
|
|
'';
|
2009-08-16 18:49:14 +04:00
|
|
|
|
};
|
2010-08-13 18:07:34 +04:00
|
|
|
|
|
2009-05-28 17:10:02 +04:00
|
|
|
|
}
|