]> granicus.if.org Git - linux-pam/blob - doc/modules/pam_cracklib.sgml
Relevant BUGIDs:
[linux-pam] / doc / modules / pam_cracklib.sgml
1 <!--
2    $Id$
3    
4    This file was written by Andrew G. Morgan <morgan@kernel.org>
5    long password amendments are from Philip W. Dalrymple III <pwd@mdtsoft.com>
6 -->
7
8 <sect1>Cracklib pluggable password strength-checker
9
10 <sect2>Synopsis
11
12 <p>
13 <descrip>
14
15 <tag><bf>Module Name:</bf></tag>
16
17 pam_cracklib
18
19 <tag><bf>Author:</bf></tag>
20
21 Cristian Gafton &lt;gafton@redhat.com&gt;
22
23 <tag><bf>Maintainer:</bf></tag>
24
25 Author.
26
27 <tag><bf>Management groups provided:</bf></tag>
28
29 password
30
31 <tag><bf>Cryptographically sensitive:</bf></tag>
32         
33 <tag><bf>Security rating:</bf></tag>
34
35 <tag><bf>Clean code base:</bf></tag>
36
37 <tag><bf>System dependencies:</bf></tag> 
38
39 Requires the system library <tt/libcrack/ and a system dictionary:
40 <tt>/usr/lib/cracklib_dict</tt>.
41
42 <tag><bf>Network aware:</bf></tag>
43
44 </descrip>
45
46 <sect2>Overview of module
47
48 <p>
49 This module can be plugged into the <tt/password/ stack of a given
50 application to provide some plug-in strength-checking for passwords.
51
52 <p>
53 This module works in the following manner: it first calls the
54 <em>Cracklib</em> routine to check the strength of the password; if
55 crack likes the password, the module does an additional set of
56 strength checks.  These checks are:
57 <itemize>
58
59 <item> <bf/Palindrome/ -
60
61 Is the new password a palindrome of the old one?
62
63 <item> <bf/Case Change Only/ -
64
65 Is the new password the the old one with only a change of case?
66
67 <item> <bf/Similar/ -
68
69 Is the new password too much like the old one?  This is primarily
70 controlled by one argument, <tt/difok/ which is a number of characters
71 that if different between the old and new are enough to accept the new
72 password, this defaults to 10 or 1/2 the size of the new password
73 whichever is smaller.
74
75 To avoid the lockup associated with trying to change a long and
76 complicated password, <tt/difignore/ is available. This argument can
77 be used to specify the minimum length a new password needs to be
78 before the <tt/difok/ value is ignored. The default value for
79 <tt/difignore/ is 23.
80
81
82 <item> <bf/Simple/ -
83
84 Is the new password too small?  This is controlled by 5 arguments
85 <tt/minlen/, <tt/dcredit/, <tt/ucredit/, <tt/lcredit/, and
86 <tt/ocredit/. See the section on the arguments for the details of how
87 these work and there defaults.
88
89 <item> <bf/Rotated/ -
90
91 Is the new password a rotated version of the old password?
92
93 <item> <bf/Already used/ -
94
95 Was the password used in the past?  Previously used passwords are to
96 be found in /etc/security/opasswd.
97
98 </itemize>
99
100 <p>
101 This module with no arguments will work well for standard unix
102 password encryption.  With md5 encryption, passwords can be longer
103 than 8 characters and the default settings for this module can make it
104 hard for the user to choose a satisfactory new password.  Notably, the
105 requirement that the new password contain no more than 1/2 of the
106 characters in the old password becomes a non-trivial constraint.  For
107 example, an old password of the form "the quick brown fox jumped over
108 the lazy dogs" would be difficult to change...  In addition, the
109 default action is to allow passwords as small as 5 characters in
110 length.  For a md5 systems it can be a good idea to increase the
111 required minimum size of a password.  One can then allow more credit
112 for different kinds of characters but accept that the new password may
113 share most of these characters with the old password.
114
115 <sect2>Password component
116
117 <p>
118 <descrip>
119
120 <tag><bf>Recognized arguments:</bf></tag>
121
122 <tt/debug/; <tt/type=XXX/; <tt/retry=N/; <tt/difok=N/; <tt/minlen=N/;
123 <tt/dcredit=N/; <tt/ucredit=N/; <tt/lcredit=N/; <tt/ocredit=N/;
124 <tt/use_authtok/;
125
126 <tag><bf>Description:</bf></tag>
127
128 The action of this module is to prompt the user for a password and
129 check its strength against a system dictionary and a set of rules for
130 identifying poor choices.
131
132 <p>
133 The default action is to prompt for a single password, check its
134 strength and then, if it is considered strong, prompt for the password
135 a second time (to verify that it was typed correctly on the first
136 occasion). All being well, the password is passed on to subsequent
137 modules to be installed as the new authentication token.
138
139 <p>
140 The default action may be modified in a number of ways using the
141 arguments recognized by the module:
142 <itemize>
143
144 <item> <tt/debug/ -
145
146 this option makes the module write information to syslog(3) indicating
147 the behavior of the module (this option does <bf/not/ write password
148 information to the log file).
149
150 <item> <tt/type=XXX/ -
151
152 the default action is for the module to use the following prompts when
153 requesting passwords: ``New UNIX password: '' and ``Retype UNIX
154 password: ''. Using this option you can replace the word UNIX with
155 <tt/XXX/.
156
157 <item> <tt/retry=N/ -
158
159 the default number of times this module will request a new password
160 (for strength-checking) from the user is 1. Using this argument this
161 can be increased to <tt/N/.
162
163 <item> <tt/difok=N/ -
164
165 This argument will change the default of 10 for the number of
166 characters in the new password that must not be present in the old
167 password.  In addition, if 1/2 of the characters in the new password
168 are different then the new password will be accepted anyway.
169
170 <item> <tt/minlen=N/ -
171
172 The minimum acceptable size for the new password (plus one if credits 
173 are not disabled which is the default).
174 In addition to the number of characters in the new password, credit (of
175 +1 in length) is given for each different kind of character (<em>other,
176 upper, lower</em> and <em/digit/).  The default for this parameter is
177 9 which is good for a old style UNIX password all of the same type of
178 character but may be too low to exploit the added security of a md5
179 system.  Note that there is a pair of length limits in
180 <em>Cracklib</em> itself, a "way too short" limit of 4 which is hard
181 coded in and a defined limit (6) that will be checked without
182 reference to <tt>minlen</tt>.  If you want to allow passwords as short
183 as 5 characters you should either not use this module or recompile
184 the crack library and then recompile this module.
185
186 <item> <tt/dcredit=N/ -
187
188 (N >= 0) This is the maximum credit for having digits in the new password. If
189 you have less than or <tt/N/ digits, each digit will count +1 towards
190 meeting the current <tt/minlen/ value.  The default for <tt/dcredit/
191 is 1 which is the recommended value for <tt/minlen/ less than 10.
192 (N < 0) This is the minimum number of digits that must be met for a new 
193 password.
194
195 <item> <tt/ucredit=N/ -
196
197 (N >= 0) This is the maximum credit for having upper case letters in the new
198 password.  If you have less than or <tt/N/ upper case letters each
199 letter will count +1 towards meeting the current <tt/minlen/ value.
200 The default for <tt/ucredit/ is 1 which is the recommended value for
201 <tt/minlen/ less than 10. (N < 0) This is the minimum number of upper 
202 case letters that must be met for a new password.
203
204 <item> <tt/lcredit=N/ -
205
206 (N >= 0) This is the maximum credit for having lower case letters in the new
207 password.  If you have less than or <tt/N/ lower case letters, each
208 letter will count +1 towards meeting the current <tt/minlen/ value.
209 The default for <tt/lcredit/ is 1 which is the recommended value for
210 <tt/minlen/ less than 10. (N < 0) This is the minimum number of lower 
211 case letters that must be met for a new password.
212
213 <item> <tt/ocredit=N/ -
214
215 (N >= 0) This is the maximum credit for having other characters in the new
216 password.  If you have less than or <tt/N/ other characters, each
217 character will count +1 towards meeting the current <tt/minlen/ value.
218 The default for <tt/ocredit/ is 1 which is the recommended value for
219 <tt/minlen/ less than 10. (N < 0) This is the minimum number of other 
220 characters that must be met for a new password.
221
222 <item> <tt/use_authtok/ -
223
224 This argument is used to <em/force/ the module to not prompt the user
225 for a new password but use the one provided by the previously stacked
226 <tt/password/ module.
227
228 </itemize>
229
230 <tag><bf>Examples/suggested usage:</bf></tag>
231
232 <p>
233 For an example of the use of this module, we show how it may be
234 stacked with the password component of <tt/pam_unix/:
235 <tscreen>
236 <verb>
237 #
238 # These lines stack two password type modules. In this example the
239 # user is given 3 opportunities to enter a strong password. The
240 # "use_authtok" argument ensures that the pam_unix module does not
241 # prompt for a password, but instead uses the one provided by
242 # pam_cracklib.
243 #
244 passwd  password required       pam_cracklib.so retry=3
245 passwd  password required       pam_unix.so use_authtok
246 </verb>
247 </tscreen>
248
249 <p>
250 Another example (in the <tt>/etc/pam.d/passwd</tt> format) is for the
251 case that you want to use md5 password encryption:
252 <tscreen>
253 <verb>
254 #%PAM-1.0
255 #
256 # These lines allow a md5 systems to support passwords of at least 14
257 # bytes with extra credit of 2 for digits and 2 for others the new
258 # password must have at least three bytes that are not present in the
259 # old password
260 #
261 password  required pam_cracklib.so \
262                difok=3 minlen=15 dcredit= 2 ocredit=2
263 password  required pam_unix.so use_authtok nullok md5
264 </verb>
265 </tscreen>
266
267 <p>
268 And here is another example in case you don't want to use credits:
269 <tscreen>
270 <verb>
271 #%PAM-1.0
272 #
273 # These lines require the user to select a password with a minimum
274 # length of 8 and with at least 1 digit number, 1 upper case letter,
275 # and 1 other character
276 #
277 password  required pam_cracklib.so \
278                dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8
279 password  required pam_unix.so use_authtok nullok md5
280 </verb>
281 </tscreen>
282
283 <p>
284 In this example we simply say that the password must have a minimum 
285 length of 8:
286 <tscreen>
287 <verb>
288 #%PAM-1.0
289 #
290 # These lines require the user to select a password with a mimimum
291 # length of 8. He gets no credits and he is not forced to use
292 # digit numbers, upper case letters etc.
293 #
294 password  required pam_cracklib.so \
295                dcredit=0 ucredit=0 ocredit=0 lcredit=0 minlen=8
296 password  required pam_unix.so use_authtok nullok md5
297 </verb>
298 </tscreen>
299
300 </descrip>
301
302 <!--
303 End of sgml insert for this module.
304 -->