{"id":2678,"date":"2022-12-20T15:17:01","date_gmt":"2022-12-20T18:17:01","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/pam_faillock-man8\/"},"modified":"2022-12-20T15:17:01","modified_gmt":"2022-12-20T18:17:01","slug":"pam_faillock-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/pam_faillock-man8\/","title":{"rendered":"PAM_FAILLOCK (man8)"},"content":{"rendered":"<h1 align=\"center\">PAM_FAILLOCK<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#MODULE TYPES PROVIDED\">MODULE TYPES PROVIDED<\/a><br \/> <a href=\"#RETURN VALUES\">RETURN VALUES<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">pam_faillock \u2212 Module counting authentication failures during a specified interval<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"89%\">\n<p style=\"margin-top: 1em\"><b>auth &#8230; pam_faillock.so<\/b> {preauth|authfail|authsucc} [dir=<i>\/path\/to\/tally\u2212directory<\/i>] [even_deny_root] [deny=<i>n<\/i>] [fail_interval=<i>n<\/i>] [unlock_time=<i>n<\/i>] [root_unlock_time=<i>n<\/i>] [admin_group=<i>name<\/i>] [audit] [silent] [no_log_info]<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"89%\">\n<p style=\"margin-top: 1em\"><b>account &#8230; pam_faillock.so<\/b> [dir=<i>\/path\/to\/tally\u2212directory<\/i>] [no_log_info]<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than <i>deny<\/i> consecutive failed authentications.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Normally, failed attempts to authenticate <i>root<\/i> will <b>not<\/b> cause the root account to become blocked, to prevent denial\u2212of\u2212service: if your users aren&#8217;t given shell accounts and root may only login via <b>su<\/b> or at the machine console (not telnet\/rsh, etc), this is safe.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>{preauth|authfail|authsucc}<\/b><\/p>\n<p style=\"margin-left:17%;\">This argument must be set accordingly to the position of this module instance in the PAM stack.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The <i>preauth<\/i> argument must be used when the module is called before the modules which ask for the user credentials such as the password. The module just examines whether the user should be blocked from accessing the service in case there were anomalous number of failed consecutive authentication attempts recently. This call is optional if <i>authsucc<\/i> is used.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The <i>authfail<\/i> argument must be used when the module is called after the modules which determine the authentication outcome, failed. Unless the user is already blocked due to previous authentication failures, the module will record the failure into the appropriate user tally file.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The <i>authsucc<\/i> argument must be used when the module is called after the modules which determine the authentication outcome, succeded. Unless the user is already blocked due to previous authentication failures, the module will then clear the record of the failures in the respective user tally file. Otherwise it will return authentication error. If this call is not done, the pam_faillock will not distinguish between consecutive and non\u2212consecutive failed authentication attempts. The <i>preauth<\/i> call must be used in such case. Due to complications in the way the PAM stack can be configured it is also possible to call <i>pam_faillock<\/i> as an account module. In such configuration the module must be also called in the <i>preauth<\/i> stage.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The options for configuring the module behavior are described in the <b>faillock.conf<\/b>(5) manual page. The options specified on the module command line override the values from the configuration file.<\/p>\n<h2>MODULE TYPES PROVIDED <a name=\"MODULE TYPES PROVIDED\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>auth<\/b> and <b>account<\/b> module types are provided.<\/p>\n<h2>RETURN VALUES <a name=\"RETURN VALUES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_AUTH_ERR<\/p>\n<p style=\"margin-left:17%;\">A invalid option was given, the module was not able to retrieve the user name, no valid counter file was found, or too many failed logins.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_SUCCESS<\/p>\n<p style=\"margin-left:17%;\">Everything was successful.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_IGNORE<\/p>\n<p style=\"margin-left:17%;\">User not present in passwd database.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Configuring options on the module command line is not recommend. The <i>\/etc\/security\/faillock.conf<\/i> should be used instead.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The setup of <i>pam_faillock<\/i> in the PAM stack is different from the <i>pam_tally2<\/i> module setup.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Individual files with the failure records are created as owned by the user. This allows <b>pam_faillock.so<\/b> module to work correctly when it is called from a screensaver.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Note that using the module in <b>preauth<\/b> without the <b>silent<\/b> option specified in \/etc\/security\/faillock.conf or with <i>requisite<\/i> control field leaks an information about existence or non\u2212existence of an user account in the system because the failures are not recorded for the unknown users. The message about the user account being locked is never displayed for nonexisting user accounts allowing the adversary to infer that a particular account is not existing on a system.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Here are two possible configuration examples for \/etc\/pam.d\/login. They make <i>pam_faillock<\/i> to lock the account after 4 consecutive failed logins during the default interval of 15 minutes. Root account will be locked as well. The accounts will be automatically unlocked after 20 minutes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the first example the module is called only in the <i>auth<\/i> phase and the module does not print any information about the account blocking by <i>pam_faillock<\/i>. The <i>preauth<\/i> call can be added to tell the user that his login is blocked by the module and also to abort the authentication without even asking for password in such case.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/security\/faillock.conf file example:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">deny=4 <br \/> unlock_time=1200 <br \/> silent<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/pam.d\/config file example:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">auth required pam_securetty.so <br \/> auth required pam_env.so <br \/> auth required pam_nologin.so <br \/> # optionally call: auth requisite pam_faillock.so preauth <br \/> # to display the message about account being locked <br \/> auth [success=1 default=bad] pam_unix.so <br \/> auth [default=die] pam_faillock.so authfail <br \/> auth sufficient pam_faillock.so authsucc <br \/> auth required pam_deny.so <br \/> account required pam_unix.so <br \/> password required pam_unix.so shadow <br \/> session required pam_selinux.so close <br \/> session required pam_loginuid.so <br \/> session required pam_unix.so <br \/> session required pam_selinux.so open<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the second example the module is called both in the <i>auth<\/i> and <i>account<\/i> phases and the module gives the authenticating user message when the account is locked if <b>silent<\/b> option is not specified in the faillock.conf.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">auth required pam_securetty.so <br \/> auth required pam_env.so <br \/> auth required pam_nologin.so <br \/> auth required pam_faillock.so preauth <br \/> # optionally use requisite above if you do not want to prompt for the password <br \/> # on locked accounts <br \/> auth sufficient pam_unix.so <br \/> auth [default=die] pam_faillock.so authfail <br \/> auth required pam_deny.so <br \/> account required pam_faillock.so <br \/> # if you drop the above call to pam_faillock.so the lock will be done also <br \/> # on non\u2212consecutive authentication failures <br \/> account required pam_unix.so <br \/> password required pam_unix.so shadow <br \/> session required pam_selinux.so close <br \/> session required pam_loginuid.so <br \/> session required pam_unix.so <br \/> session required pam_selinux.so open<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">\/var\/run\/faillock\/*<\/p>\n<p style=\"margin-left:17%;\">the files logging the authentication failures for users<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/security\/faillock.conf<\/p>\n<p style=\"margin-left:17%;\">the config file for pam_faillock options<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>faillock<\/b>(8), <b>faillock.conf<\/b>(5), <b>pam.conf<\/b>(5), <b>pam.d<\/b>(5), <b>pam<\/b>(8)<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">pam_faillock was written by Tomas Mraz.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  pam_faillock \u2212 Module counting authentication failures during a specified interval <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,29],"class_list":["post-2678","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-pam_faillock"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/2678","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=2678"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/2678\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=2678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=2678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=2678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}