]> granicus.if.org Git - linux-pam/blob - modules/pam_tally/pam_tally.8.xml
91925688a547886d9bd464ab5707005a41d98183
[linux-pam] / modules / pam_tally / pam_tally.8.xml
1 <?xml version="1.0" encoding='UTF-8'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3         "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
4
5 <refentry id="pam_tally">
6
7   <refmeta>
8     <refentrytitle>pam_tally</refentrytitle>
9     <manvolnum>8</manvolnum>
10     <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
11   </refmeta>
12
13   <refnamediv id="pam_tally-name">
14     <refname>pam_tally</refname>
15     <refpurpose>The login counter (tallying) module</refpurpose>
16   </refnamediv>
17
18   <refsynopsisdiv>
19     <cmdsynopsis id="pam_tally-cmdsynopsis1">
20       <command>pam_tally.so</command>
21       <arg choice="opt">
22         file=<replaceable>/path/to/counter</replaceable>
23       </arg>
24       <arg choice="opt">
25         onerr=[<replaceable>fail</replaceable>|<replaceable>succeed</replaceable>]
26       </arg>
27       <arg choice="opt">
28         magic_root
29       </arg>
30       <arg choice="opt">
31         even_deny_root_account
32       </arg>
33       <arg choice="opt">
34         deny=<replaceable>n</replaceable>
35       </arg>
36       <arg choice="opt">
37         lock_time=<replaceable>n</replaceable>
38       </arg>
39       <arg choice="opt">
40         unlock_time=<replaceable>n</replaceable>
41       </arg>
42       <arg choice="opt">
43         per_user
44       </arg>
45       <arg choice="opt">
46         no_lock_time
47       </arg>
48       <arg choice="opt">
49         no_reset
50       </arg>
51       <arg choice="opt">
52         audit
53       </arg>
54       <arg choice="opt">
55         silent
56       </arg>
57       <arg choice="opt">
58         no_log_info
59       </arg>
60     </cmdsynopsis>
61     <cmdsynopsis id="pam_tally-cmdsynopsis2">
62       <command>pam_tally</command>
63       <arg choice="opt">
64         --file <replaceable>/path/to/counter</replaceable>
65       </arg>
66       <arg choice="opt">
67         --user <replaceable>username</replaceable>
68       </arg>
69       <arg choice="opt">
70         --reset[=<replaceable>n</replaceable>]
71       </arg>
72       <arg choice="opt">
73         --quiet
74       </arg>
75     </cmdsynopsis>
76   </refsynopsisdiv>
77
78   <refsect1 id="pam_tally-description">
79
80     <title>DESCRIPTION</title>
81
82     <para>
83       This module maintains a count of attempted accesses, can
84       reset count on success, can deny access if too many attempts fail.
85     </para>
86     <para>
87       pam_tally comes in two parts:
88       <emphasis remap='B'>pam_tally.so</emphasis> and
89       <command>pam_tally</command>. The former is the PAM module and
90       the latter, a stand-alone program. <command>pam_tally</command>
91       is an (optional) application which can be used to interrogate and
92       manipulate the counter file. It can display users' counts, set
93       individual counts, or clear all counts. Setting artificially high
94       counts may be useful for blocking users without changing their
95       passwords. For example, one might find it useful to clear all counts
96       every midnight from a cron job. The
97       <citerefentry>
98         <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
99       </citerefentry> command can be used instead of pam_tally to to
100       maintain the counter file.
101     </para>
102     <para>
103       Normally, failed attempts to access <emphasis>root</emphasis> will
104       <emphasis remap='B'>not</emphasis> cause the root account to become
105       blocked, to prevent denial-of-service: if your users aren't given
106       shell accounts and root may only login via <command>su</command> or
107       at the machine console (not telnet/rsh, etc), this is safe.
108     </para>
109   </refsect1>
110
111   <refsect1 id="pam_tally-options">
112
113     <title>OPTIONS</title>
114     <variablelist>
115       <varlistentry>
116         <term>
117           GLOBAL OPTIONS
118         </term>
119         <listitem>
120           <para>
121             This can be used for <emphasis>auth</emphasis> and
122             <emphasis>account</emphasis> module types.
123           </para>
124           <variablelist>
125             <varlistentry>
126               <term>
127                 <option>onerr=[<replaceable>fail</replaceable>|<replaceable>succeed</replaceable>]</option>
128               </term>
129               <listitem>
130                 <para>
131                   If something weird happens (like unable to open the file),
132                   return with <errorcode>PAM_SUCCESS</errorcode> if
133                   <option>onerr=<replaceable>succeed</replaceable></option>
134                   is given, else with the corresponding PAM error code.
135                 </para>
136               </listitem>
137             </varlistentry>
138             <varlistentry>
139               <term>
140                 <option>file=<replaceable>/path/to/counter</replaceable></option>
141               </term>
142               <listitem>
143                 <para>
144                   File where to keep counts. Default is
145                   <filename>/var/log/faillog</filename>.
146                 </para>
147               </listitem>
148             </varlistentry>
149             <varlistentry>
150               <term>
151                 <option>audit</option>
152               </term>
153               <listitem>
154                 <para>
155                   Will log the user name into the system log if the user is not found.
156                 </para>
157               </listitem>
158             </varlistentry>
159             <varlistentry>
160               <term>
161                 <option>silent</option>
162               </term>
163               <listitem>
164                 <para>
165                   Don't print informative messages.
166                 </para>
167               </listitem>
168             </varlistentry>
169             <varlistentry>
170               <term>
171                 <option>no_log_info</option>
172               </term>
173               <listitem>
174                 <para>
175                   Don't log informative messages via <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
176                 </para>
177               </listitem>
178             </varlistentry>
179           </variablelist>
180         </listitem>
181       </varlistentry>
182
183       <varlistentry>
184         <term>
185           AUTH OPTIONS
186         </term>
187         <listitem>
188           <para>
189             Authentication phase first checks if user should be denied
190             access and if not it increments attempted login counter. Then
191             on call to <citerefentry>
192               <refentrytitle>pam_setcred</refentrytitle><manvolnum>3</manvolnum>
193             </citerefentry> it resets the attempts counter.
194           </para>
195           <variablelist>
196             <varlistentry>
197               <term>
198                 <option>deny=<replaceable>n</replaceable></option>
199               </term>
200               <listitem>
201                 <para>
202                   Deny access if tally for this user exceeds
203                   <replaceable>n</replaceable>.
204                 </para>
205               </listitem>
206             </varlistentry>
207             <varlistentry>
208               <term>
209                 <option>lock_time=<replaceable>n</replaceable></option>
210               </term>
211               <listitem>
212                 <para>
213                   Always deny for <replaceable>n</replaceable> seconds
214                   after failed attempt.
215                 </para>
216               </listitem>
217             </varlistentry>
218             <varlistentry>
219               <term>
220                 <option>unlock_time=<replaceable>n</replaceable></option>
221               </term>
222               <listitem>
223                 <para>
224                   Allow access after <replaceable>n</replaceable> seconds
225                   after failed attempt. If this option is used the user will
226                   be locked out for the specified amount of time after he
227                   exceeded his maximum allowed attempts. Otherwise the
228                   account is locked until the lock is removed by a manual
229                   intervention of the system administrator.
230                 </para>
231               </listitem>
232             </varlistentry>
233             <varlistentry>
234               <term>
235                 <option>magic_root</option>
236               </term>
237               <listitem>
238                 <para>
239                   If the module is invoked by a user with uid=0 the
240                   counter is not incremented. The sysadmin should use this
241                   for user launched services, like <command>su</command>,
242                   otherwise this argument should be omitted.
243                 </para>
244               </listitem>
245             </varlistentry>
246             <varlistentry>
247               <term>
248                 <option>no_lock_time</option>
249               </term>
250               <listitem>
251                 <para>
252                   Do not use the .fail_locktime field in
253                   <filename>/var/log/faillog</filename> for this user.
254                 </para>
255               </listitem>
256             </varlistentry>
257             <varlistentry>
258               <term>
259                 <option>no_reset</option>
260               </term>
261               <listitem>
262                 <para>
263                   Don't reset count on successful entry, only decrement.
264                 </para>
265               </listitem>
266             </varlistentry>
267             <varlistentry>
268               <term>
269                 <option>even_deny_root_account</option>
270               </term>
271               <listitem>
272                 <para>
273                   Root account can become unavailable.
274                 </para>
275               </listitem>
276             </varlistentry>
277             <varlistentry>
278               <term>
279                 <option>per_user</option>
280               </term>
281               <listitem>
282                 <para>
283                   If <filename>/var/log/faillog</filename> contains a non-zero
284                   .fail_max/.fail_locktime field for this user then use it
285                   instead of <option>deny=<replaceable>n</replaceable></option>/
286                   <option>lock_time=<replaceable>n</replaceable></option> parameter.
287                 </para>
288               </listitem>
289             </varlistentry>
290             <varlistentry>
291               <term>
292                 <option>no_lock_time</option>
293               </term>
294               <listitem>
295                 <para>
296                   Don't use .fail_locktime filed in
297                   <filename>/var/log/faillog</filename> for this user.
298                 </para>
299               </listitem>
300             </varlistentry>
301
302           </variablelist>
303         </listitem>
304       </varlistentry>
305
306
307       <varlistentry>
308         <term>
309           ACCOUNT OPTIONS
310         </term>
311         <listitem>
312           <para>
313             Account phase resets attempts counter if the user is
314             <emphasis remap='B'>not</emphasis> magic root.
315             This phase can be used optionally for services which don't call
316             <citerefentry>
317               <refentrytitle>pam_setcred</refentrytitle><manvolnum>3</manvolnum>
318             </citerefentry> correctly or if the reset should be done regardless
319             of the failure of the account phase of other modules.
320           </para>
321           <variablelist>
322             <varlistentry>
323               <term>
324                 <option>magic_root</option>
325               </term>
326               <listitem>
327                 <para>
328                   If the module is invoked by a user with uid=0 the
329                   counter is not incremented. The sysadmin should use this
330                   for user launched services, like <command>su</command>,
331                   otherwise this argument should be omitted.
332                 </para>
333               </listitem>
334             </varlistentry>
335             <varlistentry>
336               <term>
337                 <option>no_reset</option>
338               </term>
339               <listitem>
340                 <para>
341                   Don't reset count on successful entry, only decrement.
342                 </para>
343               </listitem>
344             </varlistentry>
345           </variablelist>
346         </listitem>
347       </varlistentry>
348     </variablelist>
349   </refsect1>
350
351   <refsect1 id="pam_tally-types">
352     <title>MODULE TYPES PROVIDED</title>
353     <para>
354       The <option>auth</option> and <option>account</option>
355       module types are provided.
356     </para>
357   </refsect1>
358
359   <refsect1 id='pam_tally-return_values'>
360     <title>RETURN VALUES</title>
361     <variablelist>
362       <varlistentry>
363         <term>PAM_AUTH_ERR</term>
364         <listitem>
365           <para>
366             A invalid option was given, the module was not able
367             to retrieve the user name, no valid counter file
368             was found, or too many failed logins.
369           </para>
370         </listitem>
371       </varlistentry>
372       <varlistentry>
373         <term>PAM_SUCCESS</term>
374         <listitem>
375           <para>
376             Everything was successful.
377           </para>
378         </listitem>
379       </varlistentry>
380       <varlistentry>
381         <term>PAM_USER_UNKNOWN</term>
382         <listitem>
383           <para>
384             User not known.
385           </para>
386         </listitem>
387       </varlistentry>
388     </variablelist>
389   </refsect1>
390
391   <refsect1 id='pam_tally-examples'>
392     <title>EXAMPLES</title>
393     <para>
394       Add the following line to <filename>/etc/pam.d/login</filename> to
395       lock the account after too many failed logins. The number of
396       allowed fails is specified by <filename>/var/log/faillog</filename>
397       and needs to be set with pam_tally or <citerefentry>
398         <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
399       </citerefentry> before.
400     </para>
401     <programlisting>
402 auth     required       pam_securetty.so
403 auth     required       pam_tally.so per_user
404 auth     required       pam_env.so
405 auth     required       pam_unix.so
406 auth     required       pam_nologin.so
407 account  required       pam_unix.so
408 password required       pam_unix.so
409 session  required       pam_limits.so
410 session  required       pam_unix.so
411 session  required       pam_lastlog.so nowtmp
412 session  optional       pam_mail.so standard
413     </programlisting>
414   </refsect1>
415
416   <refsect1 id="pam_tally-files">
417     <title>FILES</title>
418     <variablelist>
419       <varlistentry>
420         <term><filename>/var/log/faillog</filename></term>
421         <listitem>
422           <para>failure logging file</para>
423         </listitem>
424       </varlistentry>
425     </variablelist>
426   </refsect1>
427
428   <refsect1 id='pam_tally-see_also'>
429     <title>SEE ALSO</title>
430     <para>
431       <citerefentry>
432         <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
433       </citerefentry>,
434       <citerefentry>
435         <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
436       </citerefentry>,
437       <citerefentry>
438         <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
439       </citerefentry>,
440       <citerefentry>
441         <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
442       </citerefentry>
443     </para>
444   </refsect1>
445
446   <refsect1 id='pam_tally-author'>
447     <title>AUTHOR</title>
448       <para>
449         pam_tally was written by Tim Baverstock and Tomas Mraz.
450       </para>
451   </refsect1>
452
453 </refentry>