1PAM_CRACKLIB(8)                Linux-PAM Manual                PAM_CRACKLIB(8)
2
3
4

NAME

6       pam_cracklib - PAM module to check the password against dictionary
7       words
8

SYNOPSIS

10       pam_cracklib.so [...]
11

DESCRIPTION

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

OPTIONS

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       retry=N
90           Prompt user at most N times before returning with error. The
91           default is 1.
92
93       difok=N
94           This argument will change the default of 5 for the number of
95           character changes in the new password that differentiate it from
96           the old password.
97
98       minlen=N
99           The minimum acceptable size for the new password (plus one if
100           credits are not disabled which is the default). In addition to the
101           number of characters in the new password, credit (of +1 in length)
102           is given for each different kind of character (other, upper, lower
103           and digit). The default for this parameter is 9 which is good for a
104           old style UNIX password all of the same type of character but may
105           be too low to exploit the added security of a md5 system. Note that
106           there is a pair of length limits in Cracklib itself, a "way too
107           short" limit of 4 which is hard coded in and a defined limit (6)
108           that will be checked without reference to minlen. If you want to
109           allow passwords as short as 5 characters you should not use this
110           module.
111
112       dcredit=N
113           (N >= 0) This is the maximum credit for having digits in the new
114           password. If you have less than or N digits, each digit will count
115           +1 towards meeting the current minlen value. The default for
116           dcredit is 1 which is the recommended value for minlen less than
117           10.
118
119           (N < 0) This is the minimum number of digits that must be met for a
120           new password.
121
122       ucredit=N
123           (N >= 0) This is the maximum credit for having upper case letters
124           in the new password. If you have less than or N upper case letters
125           each letter will count +1 towards meeting the current minlen value.
126           The default for ucredit is 1 which is the recommended value for
127           minlen less than 10.
128
129           (N < 0) This is the minimum number of upper case letters that must
130           be met for a new password.
131
132       lcredit=N
133           (N >= 0) This is the maximum credit for having lower case letters
134           in the new password. If you have less than or N lower case letters,
135           each letter will count +1 towards meeting the current minlen value.
136           The default for lcredit is 1 which is the recommended value for
137           minlen less than 10.
138
139           (N < 0) This is the minimum number of lower case letters that must
140           be met for a new password.
141
142       ocredit=N
143           (N >= 0) This is the maximum credit for having other characters in
144           the new password. If you have less than or N other characters, each
145           character will count +1 towards meeting the current minlen value.
146           The default for ocredit is 1 which is the recommended value for
147           minlen less than 10.
148
149           (N < 0) This is the minimum number of other characters that must be
150           met for a new password.
151
152       minclass=N
153           The minimum number of required classes of characters for the new
154           password. The default number is zero. The four classes are digits,
155           upper and lower letters and other characters. The difference to the
156           credit check is that a specific class if of characters is not
157           required. Instead N out of four of the classes are required.
158
159       maxrepeat=N
160           Reject passwords which contain more than N same consecutive
161           characters. The default is 0 which means that this check is
162           disabled.
163
164       maxsequence=N
165           Reject passwords which contain monotonic character sequences longer
166           than N. The default is 0 which means that this check is disabled.
167           Examples of such sequence are '12345' or 'fedcb'. Note that most
168           such passwords will not pass the simplicity check unless the
169           sequence is only a minor part of the password.
170
171       maxclassrepeat=N
172           Reject passwords which contain more than N consecutive characters
173           of the same class. The default is 0 which means that this check is
174           disabled.
175
176       reject_username
177           Check whether the name of the user in straight or reversed form is
178           contained in the new password. If it is found the new password is
179           rejected.
180
181       gecoscheck
182           Check whether the words from the GECOS field (usualy full name of
183           the user) longer than 3 characters in straight or reversed form are
184           contained in the new password. If any such word is found the new
185           password is rejected.
186
187       enforce_for_root
188           The module will return error on failed check also if the user
189           changing the password is root. This option is off by default which
190           means that just the message about the failed check is printed but
191           root can change the password anyway. Note that root is not asked
192           for an old password so the checks that compare the old and new
193           password are not performed.
194
195       use_authtok
196           This argument is used to force the module to not prompt the user
197           for a new password but use the one provided by the previously
198           stacked password module.
199
200       dictpath=/path/to/dict
201           Path to the cracklib dictionaries.
202

MODULE TYPES PROVIDED

204       Only the password module type is provided.
205

RETURN VALUES

207       PAM_SUCCESS
208           The new password passes all checks.
209
210       PAM_AUTHTOK_ERR
211           No new password was entered, the username could not be determined
212           or the new password fails the strength checks.
213
214       PAM_AUTHTOK_RECOVERY_ERR
215           The old password was not supplied by a previous stacked module or
216           got not requested from the user. The first error can happen if
217           use_authtok is specified.
218
219       PAM_SERVICE_ERR
220           A internal error occurred.
221

EXAMPLES

223       For an example of the use of this module, we show how it may be stacked
224       with the password component of pam_unix(8)
225
226           #
227           # These lines stack two password type modules. In this example the
228           # user is given 3 opportunities to enter a strong password. The
229           # "use_authtok" argument ensures that the pam_unix module does not
230           # prompt for a password, but instead uses the one provided by
231           # pam_cracklib.
232           #
233           passwd  password required       pam_cracklib.so retry=3
234           passwd  password required       pam_unix.so use_authtok
235
236
237       Another example (in the /etc/pam.d/passwd format) is for the case that
238       you want to use md5 password encryption:
239
240           #%PAM-1.0
241           #
242           # These lines allow a md5 systems to support passwords of at least 14
243           # bytes with extra credit of 2 for digits and 2 for others the new
244           # password must have at least three bytes that are not present in the
245           # old password
246           #
247           password  required pam_cracklib.so \
248                          difok=3 minlen=15 dcredit= 2 ocredit=2
249           password  required pam_unix.so use_authtok nullok md5
250
251
252       And here is another example in case you don't want to use credits:
253
254           #%PAM-1.0
255           #
256           # These lines require the user to select a password with a minimum
257           # length of 8 and with at least 1 digit number, 1 upper case letter,
258           # and 1 other character
259           #
260           password  required pam_cracklib.so \
261                          dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8
262           password  required pam_unix.so use_authtok nullok md5
263
264
265

SEE ALSO

267       pam.conf(5), pam.d(5), pam(8)
268

AUTHOR

270       pam_cracklib was written by Cristian Gafton <gafton@redhat.com>
271
272
273
274Linux-PAM Manual                  05/18/2017                   PAM_CRACKLIB(8)
Impressum