yubico-pam: add nixos integration
This commit is contained in:
parent
faedd9d527
commit
c8a9c1c2b8
@ -48,6 +48,16 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
yubicoAuth = mkOption {
|
||||||
|
default = config.security.pam.yubico.enable;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
If set, users listed in
|
||||||
|
<filename>~/.yubico/authorized_yubikeys</filename>
|
||||||
|
are able to log in with the asociated Yubikey tokens.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
googleAuthenticator = {
|
googleAuthenticator = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
@ -340,6 +350,8 @@ let
|
|||||||
"auth sufficient ${pkgs.pam_usb}/lib/security/pam_usb.so"}
|
"auth sufficient ${pkgs.pam_usb}/lib/security/pam_usb.so"}
|
||||||
${let oath = config.security.pam.oath; in optionalString cfg.oathAuth
|
${let oath = config.security.pam.oath; in optionalString cfg.oathAuth
|
||||||
"auth requisite ${pkgs.oathToolkit}/lib/security/pam_oath.so window=${toString oath.window} usersfile=${toString oath.usersFile} digits=${toString oath.digits}"}
|
"auth requisite ${pkgs.oathToolkit}/lib/security/pam_oath.so window=${toString oath.window} usersfile=${toString oath.usersFile} digits=${toString oath.digits}"}
|
||||||
|
${let yubi = config.security.pam.yubico; in optionalString cfg.yubicoAuth
|
||||||
|
"auth ${yubi.control} ${pkgs.yubico-pam}/lib/security/pam_yubico.so id=${toString yubi.id} ${optionalString yubi.debug "debug"}"}
|
||||||
'' +
|
'' +
|
||||||
# Modules in this block require having the password set in PAM_AUTHTOK.
|
# 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
|
# pam_unix is marked as 'sufficient' on NixOS which means nothing will run
|
||||||
@ -636,6 +648,54 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
security.pam.yubico = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Enables Yubico PAM (<literal>yubico-pam</literal>) module.
|
||||||
|
|
||||||
|
If set, users listed in
|
||||||
|
<filename>~/.yubico/authorized_yubikeys</filename>
|
||||||
|
are able to log in with the associated Yubikey tokens.
|
||||||
|
|
||||||
|
The file must have only one line:
|
||||||
|
<literal>username:yubikey_token_id1:yubikey_token_id2</literal>
|
||||||
|
More information can be found <link
|
||||||
|
xlink:href="https://developers.yubico.com/yubico-pam/">here</link>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
control = mkOption {
|
||||||
|
default = "sufficient";
|
||||||
|
type = types.enum [ "required" "requisite" "sufficient" "optional" ];
|
||||||
|
description = ''
|
||||||
|
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
|
||||||
|
<citerefentry>
|
||||||
|
<refentrytitle>pam.conf</refentrytitle>
|
||||||
|
<manvolnum>5</manvolnum>
|
||||||
|
</citerefentry>
|
||||||
|
for better understanding of this option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
id = mkOption {
|
||||||
|
example = "42";
|
||||||
|
type = types.string;
|
||||||
|
description = "client id";
|
||||||
|
};
|
||||||
|
|
||||||
|
debug = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Debug output to stderr.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
security.pam.enableEcryptfs = mkOption {
|
security.pam.enableEcryptfs = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user