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