1PAM_CRACKLIB(8) Linux-PAM Manual PAM_CRACKLIB(8)
2
3
4
6 pam_cracklib - PAM module to check the password against dictionary
7 words
8
10 pam_cracklib.so [...]
11
13 This module can be plugged into the password stack of a given
14 application to provide some plug-in strength-checking for passwords.
15
16 The action of this module is to prompt the user for a password and
17 check its strength against a system dictionary and a set of rules for
18 identifying poor choices.
19
20 The first action is to prompt for a single password, check its strength
21 and then, if it is considered strong, prompt for the password a second
22 time (to verify that it was typed correctly on the first occasion). All
23 being well, the password is passed on to subsequent modules to be
24 installed as the new authentication token.
25
26 The strength checks works in the following manner: at first the
27 Cracklib routine is called to check if the password is part of a
28 dictionary; if this is not the case an additional set of strength
29 checks is done. These checks are:
30
31 Palindrome
32 Is the new password a palindrome?
33
34 Case Change Only
35 Is the new password the the old one with only a change of case?
36
37 Similar
38 Is the new password too much like the old one? This is primarily
39 controlled by one argument, difok which is a number of character
40 changes (inserts, removals, or replacements) between the old and
41 new password that are enough to accept the new password. This
42 defaults to 5 changes.
43
44 Simple
45 Is the new password too small? This is controlled by 6 arguments
46 minlen, maxclassrepeat, dcredit, ucredit, lcredit, and ocredit. See
47 the section on the arguments for the details of how these work and
48 there defaults.
49
50 Rotated
51 Is the new password a rotated version of the old password?
52
53 Same consecutive characters
54 Optional check for same consecutive characters.
55
56 Too long monotonic character sequence
57 Optional check for too long monotonic character sequence.
58
59 Contains user name
60 Optional check whether the password contains the user´s name in
61 some form.
62
63 This module with no arguments will work well for standard unix password
64 encryption. With md5 encryption, passwords can be longer than 8
65 characters and the default settings for this module can make it hard
66 for the user to choose a satisfactory new password. Notably, the
67 requirement that the new password contain no more than 1/2 of the
68 characters in the old password becomes a non-trivial constraint. For
69 example, an old password of the form "the quick brown fox jumped over
70 the lazy dogs" would be difficult to change... In addition, the default
71 action is to allow passwords as small as 5 characters in length. For a
72 md5 systems it can be a good idea to increase the required minimum size
73 of a password. One can then allow more credit for different kinds of
74 characters but accept that the new password may share most of these
75 characters with the old password.
76
78 debug
79 This option makes the module write information to syslog(3)
80 indicating the behavior of the module (this option does not write
81 password information to the log file).
82
83 authtok_type=XXX
84 The default action is for the module to use the following prompts
85 when requesting passwords: "New UNIX password: " and "Retype UNIX
86 password: ". The example word UNIX can be replaced with this
87 option, by default it is empty.
88
89 type=XXX
90 Alias for authtok_type kept for backwards compatibility.
91
92 retry=N
93 Prompt user at most N times before returning with error. The
94 default is 1.
95
96 difok=N
97 This argument will change the default of 5 for the number of
98 character changes in the new password that differentiate it from
99 the old password.
100
101 minlen=N
102 The minimum acceptable size for the new password (plus one if
103 credits are not disabled which is the default). In addition to the
104 number of characters in the new password, credit (of +1 in length)
105 is given for each different kind of character (other, upper, lower
106 and digit). The default for this parameter is 9 which is good for a
107 old style UNIX password all of the same type of character but may
108 be too low to exploit the added security of a md5 system. Note that
109 there is a pair of length limits in Cracklib itself, a "way too
110 short" limit of 4 which is hard coded in and a defined limit (6)
111 that will be checked without reference to minlen. If you want to
112 allow passwords as short as 5 characters you should not use this
113 module.
114
115 dcredit=N
116 (N >= 0) This is the maximum credit for having digits in the new
117 password. If you have less than or N digits, each digit will count
118 +1 towards meeting the current minlen value. The default for
119 dcredit is 1 which is the recommended value for minlen less than
120 10.
121
122 (N < 0) This is the minimum number of digits that must be met for a
123 new password.
124
125 ucredit=N
126 (N >= 0) This is the maximum credit for having upper case letters
127 in the new password. If you have less than or N upper case letters
128 each letter will count +1 towards meeting the current minlen value.
129 The default for ucredit is 1 which is the recommended value for
130 minlen less than 10.
131
132 (N < 0) This is the minimum number of upper case letters that must
133 be met for a new password.
134
135 lcredit=N
136 (N >= 0) This is the maximum credit for having lower case letters
137 in the new password. If you have less than or N lower case letters,
138 each letter will count +1 towards meeting the current minlen value.
139 The default for lcredit is 1 which is the recommended value for
140 minlen less than 10.
141
142 (N < 0) This is the minimum number of lower case letters that must
143 be met for a new password.
144
145 ocredit=N
146 (N >= 0) This is the maximum credit for having other characters in
147 the new password. If you have less than or N other characters, each
148 character will count +1 towards meeting the current minlen value.
149 The default for ocredit is 1 which is the recommended value for
150 minlen less than 10.
151
152 (N < 0) This is the minimum number of other characters that must be
153 met for a new password.
154
155 minclass=N
156 The minimum number of required classes of characters for the new
157 password. The default number is zero. The four classes are digits,
158 upper and lower letters and other characters. The difference to the
159 credit check is that a specific class if of characters is not
160 required. Instead N out of four of the classes are required.
161
162 maxrepeat=N
163 Reject passwords which contain more than N same consecutive
164 characters. The default is 0 which means that this check is
165 disabled.
166
167 maxsequence=N
168 Reject passwords which contain monotonic character sequences longer
169 than N. The default is 0 which means that this check is disabled.
170 Examples of such sequence are ´12345´ or ´fedcb´. Note that most
171 such passwords will not pass the simplicity check unless the
172 sequence is only a minor part of the password.
173
174 maxclassrepeat=N
175 Reject passwords which contain more than N consecutive characters
176 of the same class. The default is 0 which means that this check is
177 disabled.
178
179 reject_username
180 Check whether the name of the user in straight or reversed form is
181 contained in the new password. If it is found the new password is
182 rejected.
183
184 gecoscheck
185 Check whether the words from the GECOS field (usualy full name of
186 the user) longer than 3 characters in straight or reversed form are
187 contained in the new password. If any such word is found the new
188 password is rejected.
189
190 enforce_for_root
191 The module will return error on failed check also if the user
192 changing the password is root. This option is off by default which
193 means that just the message about the failed check is printed but
194 root can change the password anyway. Note that root is not asked
195 for an old password so the checks that compare the old and new
196 password are not performed.
197
198 use_authtok
199 This argument is used to force the module to not prompt the user
200 for a new password but use the one provided by the previously
201 stacked password module.
202
203 dictpath=/path/to/dict
204 Path to the cracklib dictionaries.
205
207 Only the password module type is provided.
208
210 PAM_SUCCESS
211 The new password passes all checks.
212
213 PAM_AUTHTOK_ERR
214 No new password was entered, the username could not be determined
215 or the new password fails the strength checks.
216
217 PAM_AUTHTOK_RECOVERY_ERR
218 The old password was not supplied by a previous stacked module or
219 got not requested from the user. The first error can happen if
220 use_authtok is specified.
221
222 PAM_SERVICE_ERR
223 A internal error occurred.
224
226 For an example of the use of this module, we show how it may be stacked
227 with the password component of pam_unix(8)
228
229 #
230 # These lines stack two password type modules. In this example the
231 # user is given 3 opportunities to enter a strong password. The
232 # "use_authtok" argument ensures that the pam_unix module does not
233 # prompt for a password, but instead uses the one provided by
234 # pam_cracklib.
235 #
236 passwd password required pam_cracklib.so retry=3
237 passwd password required pam_unix.so use_authtok
238
239
240 Another example (in the /etc/pam.d/passwd format) is for the case that
241 you want to use md5 password encryption:
242
243 #%PAM-1.0
244 #
245 # These lines allow a md5 systems to support passwords of at least 14
246 # bytes with extra credit of 2 for digits and 2 for others the new
247 # password must have at least three bytes that are not present in the
248 # old password
249 #
250 password required pam_cracklib.so \
251 difok=3 minlen=15 dcredit= 2 ocredit=2
252 password required pam_unix.so use_authtok nullok md5
253
254
255 And here is another example in case you don´t want to use credits:
256
257 #%PAM-1.0
258 #
259 # These lines require the user to select a password with a minimum
260 # length of 8 and with at least 1 digit number, 1 upper case letter,
261 # and 1 other character
262 #
263 password required pam_cracklib.so \
264 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8
265 password required pam_unix.so use_authtok nullok md5
266
267
268
270 pam.conf(5), pam.d(5), pam(8)
271
273 pam_cracklib was written by Cristian Gafton <gafton@redhat.com>
274
275
276
277Linux-PAM Manual 03/22/2017 PAM_CRACKLIB(8)