Debian Codegraph @

upstream/fedora-44/man8/pam_faillock.8

raw
1 '\" t
2 .\" Title: pam_faillock
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 01/23/2026
6 .\" Manual: Linux-PAM Manual
7 .\" Source: [FIXME: source]
8 .\" Language: English
9 .\"
10 .TH "PAM_FAILLOCK" "8" "01/23/2026" "[FIXME: source]" "Linux\-PAM Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 pam_faillock \- Module counting authentication failures during a specified interval
32 .SH "SYNOPSIS"
33 .HP \w'\fBauth\ \&.\&.\&.\ pam_faillock\&.so\fR\ 'u
34 \fBauth \&.\&.\&. pam_faillock\&.so\fR {preauth|authfail|authsucc} [conf=\fI/path/to/config\-file\fR] [dir=\fI/path/to/tally\-directory\fR] [even_deny_root] [deny=\fIn\fR] [fail_interval=\fIn\fR] [unlock_time=\fIn\fR] [root_unlock_time=\fIn\fR] [admin_group=\fIname\fR] [audit] [silent] [no_log_info]
35 .HP \w'\fBaccount\ \&.\&.\&.\ pam_faillock\&.so\fR\ 'u
36 \fBaccount \&.\&.\&. pam_faillock\&.so\fR [dir=\fI/path/to/tally\-directory\fR] [no_log_info]
37 .SH "DESCRIPTION"
38 .PP
39 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
40 \fIdeny\fR
41 consecutive failed authentications\&.
42 .PP
43 Normally, failed attempts to authenticate
44 \fIroot\fR
45 will
46 \fBnot\fR
47 cause the root account to become blocked, to prevent denial\-of\-service: if your users aren\*(Aqt given shell accounts and root may only login via
48 \fBsu\fR
49 or at the machine console (not telnet/rsh, etc), this is safe\&.
50 .SH "OPTIONS"
51 .PP
52 {preauth|authfail|authsucc}
53 .RS 4
54 This argument must be set accordingly to the position of this module instance in the PAM stack\&.
55 .sp
56 The
57 \fIpreauth\fR
58 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
59 \fIauthsucc\fR
60 is used\&.
61 .sp
62 The
63 \fIauthfail\fR
64 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\&.
65 .sp
66 The
67 \fIauthsucc\fR
68 argument must be used when the module is called after the modules which determine the authentication outcome, succeeded\&. 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\-consecutive failed authentication attempts\&. The
69 \fIpreauth\fR
70 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
71 \fIpam_faillock\fR
72 as an account module\&. In such configuration the module must be also called in the
73 \fIpreauth\fR
74 stage\&.
75 .RE
76 .PP
77 conf=/path/to/config\-file
78 .RS 4
79 Use another configuration file instead of the default
80 /etc/security/faillock\&.conf\&.
81 .RE
82 .PP
83 The options for configuring the module behavior are described in the
84 \fBfaillock.conf\fR(5)
85 manual page\&. The options specified on the module command line override the values from the configuration file\&.
86 .SH "MODULE TYPES PROVIDED"
87 .PP
88 The
89 \fBauth\fR
90 and
91 \fBaccount\fR
92 module types are provided\&.
93 .SH "RETURN VALUES"
94 .PP
95 PAM_AUTH_ERR
96 .RS 4
97 An 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\&.
98 .RE
99 .PP
100 PAM_BUF_ERR
101 .RS 4
102 Memory buffer error\&.
103 .RE
104 .PP
105 PAM_CONV_ERR
106 .RS 4
107 The conversation method supplied by the application failed to obtain the username\&.
108 .RE
109 .PP
110 PAM_INCOMPLETE
111 .RS 4
112 The conversation method supplied by the application returned PAM_CONV_AGAIN\&.
113 .RE
114 .PP
115 PAM_SUCCESS
116 .RS 4
117 Everything was successful\&.
118 .RE
119 .PP
120 PAM_IGNORE
121 .RS 4
122 User not present in passwd database\&.
123 .RE
124 .SH "NOTES"
125 .PP
126 Configuring options on the module command line is not recommend\&. The
127 /etc/security/faillock\&.conf
128 should be used instead\&.
129 .PP
130 The setup of
131 \fIpam_faillock\fR
132 in the PAM stack is different from the
133 \fIpam_tally2\fR
134 module setup\&.
135 .PP
136 Individual files with the failure records are created as owned by the user\&. This allows
137 \fBpam_faillock\&.so\fR
138 module to work correctly when it is called from a screensaver\&.
139 .PP
140 Note that using the module in
141 \fBpreauth\fR
142 without the
143 \fBsilent\fR
144 option specified in
145 /etc/security/faillock\&.conf
146 or with
147 \fIrequisite\fR
148 control field leaks an information about existence or non\-existence of a 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 non\-existing user accounts allowing the adversary to infer that a particular account is not existing on a system\&.
149 .PP
150 If the
151 \fBauth\fR
152 stack has not been run prior to the
153 \fBaccount\fR
154 stack, the logic to reset the failed login counter is intentionally skipped\&. This prevents automated services, such as
155 \fIcrond\fR
156 or
157 \fIsystemd\-user\fR, which might only perform account management tasks, from inadvertently clearing a user\*(Aqs failed attempt records\&. This ensures the faillock counter is only reset by a service that performs a full, successful authentication\&.
158 .SH "EXAMPLES"
159 .PP
160 Here are two possible configuration examples for
161 /etc/pam\&.d/login\&. They make
162 \fIpam_faillock\fR
163 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\&.
164 .PP
165 In the first example the module is called only in the
166 \fIauth\fR
167 phase and the module does not print any information about the account being blocked by
168 \fIpam_faillock\fR\&. The
169 \fIpreauth\fR
170 call can be added to tell users that their logins are blocked by the module and also to abort the authentication without even asking for password in such case\&.
171 .PP
172 /etc/security/faillock\&.conf
173 file example:
174 .sp
175 .if n \{\
176 .RS 4
177 .\}
178 .nf
179 deny=4
180 unlock_time=1200
181 silent
182
183 .fi
184 .if n \{\
185 .RE
186 .\}
187 .PP
188 /etc/pam\&.d/config file example:
189 .sp
190 .if n \{\
191 .RS 4
192 .\}
193 .nf
194 auth required pam_securetty\&.so
195 auth required pam_env\&.so
196 auth required pam_nologin\&.so
197 # optionally call: auth requisite pam_faillock\&.so preauth
198 # to display the message about account being locked
199 auth [success=1 default=bad] pam_unix\&.so
200 auth [default=die] pam_faillock\&.so authfail
201 auth sufficient pam_faillock\&.so authsucc
202 auth required pam_deny\&.so
203 account required pam_unix\&.so
204 password required pam_unix\&.so shadow
205 session required pam_selinux\&.so close
206 session required pam_loginuid\&.so
207 session required pam_unix\&.so
208 session required pam_selinux\&.so open
209
210 .fi
211 .if n \{\
212 .RE
213 .\}
214 .PP
215 In the second example the module is called both in the
216 \fIauth\fR
217 and
218 \fIaccount\fR
219 phases and the module informs the authenticating user when the account is locked if
220 \fBsilent\fR
221 option is not specified in the
222 faillock\&.conf\&.
223 .sp
224 .if n \{\
225 .RS 4
226 .\}
227 .nf
228 auth required pam_securetty\&.so
229 auth required pam_env\&.so
230 auth required pam_nologin\&.so
231 auth required pam_faillock\&.so preauth
232 # optionally use requisite above if you do not want to prompt for the password
233 # on locked accounts
234 auth sufficient pam_unix\&.so
235 auth [default=die] pam_faillock\&.so authfail
236 auth required pam_deny\&.so
237 account required pam_faillock\&.so
238 # if you drop the above call to pam_faillock\&.so the lock will be done also
239 # on non\-consecutive authentication failures
240 account required pam_unix\&.so
241 password required pam_unix\&.so shadow
242 session required pam_selinux\&.so close
243 session required pam_loginuid\&.so
244 session required pam_unix\&.so
245 session required pam_selinux\&.so open
246
247 .fi
248 .if n \{\
249 .RE
250 .\}
251 .SH "FILES"
252 .PP
253 /var/run/faillock/*
254 .RS 4
255 the files logging the authentication failures for users
256 .sp
257 Note: These files will disappear after reboot on systems configured with directory
258 /var/run/faillock
259 mounted on virtual memory\&. For persistent storage use the option
260 \fIdir=\fR
261 in file
262 /etc/security/faillock\&.conf\&.
263 .RE
264 .PP
265 /etc/security/faillock\&.conf
266 .RS 4
267 the config file for pam_faillock options
268 .RE
269 .SH "SEE ALSO"
270 .PP
271 \fBfaillock\fR(8),
272 \fBfaillock.conf\fR(5),
273 \fBpam.conf\fR(5),
274 \fBpam.d\fR(5),
275 \fBpam\fR(8)
276 .SH "AUTHOR"
277 .PP
278 pam_faillock was written by Tomas Mraz\&.