2 (Kerberos password strength checking plugin)
4 Maintained by Russ Allbery <eagle@eyrie.org>
6 Copyright 2006, 2007, 2009, 2010, 2012, 2013 The Board of Trustees of
7 the Leland Stanford Junior University. Portions copyright 1993 Alec
8 Muffett. Developed by Derrick Brashear and Ken Hornstein of Sine Nomine
9 Associates, on behalf of Stanford University. This software is
10 distributed under a BSD-style license and under the Artistic License.
11 Please see the section LICENSE for more information.
15 krb5-strength provides a password quality plugin for the MIT Kerberos
16 KDC (specifically the kadmind server) and an external password quality
17 program for use with the Heimdal kpasswdd server. Passwords can be
18 tested with CrackLib, checked against a CDB database of known weak
19 passwords, checked for length, checked for non-printable or non-ASCII
20 characters that may be difficult to enter reproducibly, required to
21 contain particular character classes, or any combination of these tests.
22 It supports both Heimdal and MIT Kerberos (1.9 or later).
26 Heimdal includes a capability to plug in external password quality
27 checks and comes with an example that checks passwords against CrackLib.
28 However, in testing at Stanford, we found that CrackLib with its default
29 transform rules does not catch passwords that can be guessed using the
30 same dictionary with other tools, such as Jack the Ripper. We then
31 discovered other issues with CrackLib with longer passwords, such as
32 some bad assumptions about how certain measures of complexity will
33 scale, and wanted to impose other limitations that it didn't support.
35 This plugin provides the ability to check password quality against the
36 standard version of CrackLib, or against a modified version of CrackLib
37 that only passes passwords that resist attacks from both Crack and Jack
38 the Ripper using the same rule sets. It also supports doing simpler
39 dictionary checks against a CDB database, which is fast with very large
40 dictionaries, and imposing other programmatic checks on passwords such
41 as character class requirements.
43 For Heimdal, it includes both a program usable as an external password
44 quality check and a plugin that implements the dynamic module API. For
45 MIT Kerberos (1.9 or later), it includes a plugin for the password
46 quality (pwqual) plugin API.
48 krb5-strength can be built with either the system CrackLib or with the
49 modified version of CrackLib included in this package. Note, however,
50 that if you're building against the system CrackLib, Heimdal includes in
51 the distribution a strength-checking plugin and an external password
52 check program that use the system CrackLib. With Heimdal, it would
53 probably be easier to use that plugin or program than build this package
54 unless you want the modified CrackLib.
56 For information about the changes to the CrackLib included in this
57 toolkit, see cracklib/HISTORY. The primary changes are tighter rules,
58 which are more aggressive at finding dictionary words with characters
59 appended and prepended, which tighten the requirements for password
60 entropy, and which add stricter rules for longer passwords. They are
61 also minor changes to fix portability issues and remove some code that
62 doesn't make sense in the kadmind context.
64 Ideally, the changes to CrackLib should be added to the standard
65 CrackLib distribution by adding an additional interface to configure its
66 behavior, at which point this package can likely wither away in favor of
67 much simpler plugins that link to the standard CrackLib library.
71 For Heimdal, you may use either the external password quality check
72 tool, installed as heimdal-strength, or the plugin as you choose. It
73 has been tested with Heimdal 1.2.1 and later, but has not recently been
74 tested with versions prior to 1.5.
76 For MIT Kerberos, version 1.9 or higher is required for the password
77 quality plugin interface. MIT Kerberos does not support an external
78 password quality check tool directly, so you will need to install the
81 You can optionally build against the system CrackLib library. Any
82 version should be supported, but note that some versions, particularly
83 older versions close to the original code, do things like printing
84 diagnostics to stderr, calling exit, and otherwise not being
85 well-behaved for use inside plugins or libraries. If using a system
86 CrackLib library, use version 2.8.22 or later to avoid these problems.
88 You can also optionally build against the TinyCDB library, which
89 provides support for simpler and faster password checking against a CDB
92 For this module to be effective for either Heimdal or MIT Kerberos, you
93 will also need to construct a dictionary. The mkdict and packer
94 utilities to build a CrackLib dictionary from a word list are included
95 in this toolkit but not installed by default. You can run them out of
96 the cracklib directory after building. You can also use the utilities
97 that come with the stock CrackLib package (often already packaged in a
98 Linux distribution); the database format is compatible.
100 For building a CDB dictionary, use the provided cdbmake-wordlist
101 program. The CDB utility must be on your PATH. cdbmake-wordlist
102 requires Perl 5.006 or later.
104 For a word list to use as source for the dictionary, you can use
105 /usr/share/dict/words if it's available on your system, but it would be
106 better to find a more comprehensive word list. Since word lists are
107 bulky, often covered by murky copyrights, and easily locatable on the
108 Internet with a modicum of searching, none are included in this toolkit.
110 To run the test suite, you will also need Perl 5.006 or later. The
111 following additional Perl modules will be used by the test suite if
123 All are available on CPAN. Those tests will be skipped if the modules
126 To enable tests that may be sensitive to the local environment or that
127 produce a lot of false positives without uncovering many problems, set
128 RRA_MAINTAINER_TESTS to a true value.
130 To bootstrap from a Git checkout, or If you change the Automake files
131 and need to regenerate Makefile.in, you will need Automake 1.11 or
132 later. For bootstrap or if you change configure.ac or any of the m4
133 files it includes and need to regenerate configure or config.h.in, you
134 will need Autoconf 2.64 or later.
136 COMPILING AND INSTALLING
138 You can build and install the plugin with the standard commands:
144 Pass --enable-silent-rules to configure for a quieter build (similar to
145 the Linux kernel). Use make warnings instead of make to build with full
146 GCC compiler warnings (requires a relatively current version of GCC).
148 The last step will probably have to be done as root. By default, the
149 plugin is installed as /usr/local/lib/krb5/plugins/pwqual/strength.so
150 and the Heimdal external password check function is installed as
151 /usr/local/bin/heimdal-strength. You can change these paths with the
152 --prefix, --libdir, and --bindir options to configure.
154 To build with the system version of CrackLib, pass --with-cracklib to
155 configure. You can optionally add a directory, giving the root
156 directory where CrackLib was installed, or separately set the include
157 and library path with --with-cracklib-include and --with-cracklib-lib.
159 krb5-strength will automatically build with TinyCDB if it is found. To
160 specify the installation path of TinyCDB, use --with-tinycdb. You can
161 also separately set the include and library path with
162 --with-tinycdb-include and --with-tinycdb-lib.
164 Normally, configure will use krb5-config to determine the flags to use
165 to compile with your Kerberos libraries. If krb5-config isn't found, it
166 will look for the standard Kerberos libraries in locations already
167 searched by your compiler. If the the krb5-config script first in your
168 path is not the one corresponding to the Kerberos libraries you want to
169 use or if your Kerberos libraries and includes aren't in a location
170 searched by default by your compiler, you need to specify a different
171 Kerberos installation root via --with-krb5=PATH. For example:
173 ./configure --with-krb5=/usr/pubsw
175 You can also individually set the paths to the include directory and the
176 library directory with --with-krb5-include and --with-krb5-lib. You may
177 need to do this if Autoconf can't figure out whether to use lib, lib32,
178 or lib64 on your platform.
180 To specify a particular krb5-config script to use, either set the
181 PATH_KRB5_CONFIG environment variable or pass it to configure like:
183 ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
185 To not use krb5-config and force library probing even if there is a
186 krb5-config script on your path, set PATH_KRB5_CONFIG to a nonexistent
189 ./configure PATH_KRB5_CONFIG=/nonexistent
191 krb5-config is not used and library probing is always done if either
192 --with-krb5-include or --with-krb5-lib are given.
194 You can pass the --enable-reduced-depends flag to configure to try to
195 minimize the shared library dependencies encoded in the binaries. This
196 omits from the link line all the libraries included solely because the
197 Kerberos libraries depend on them and instead links the programs only
198 against libraries whose APIs are called directly. This will only work
199 with shared Kerberos libraries and will only work on platforms where
200 shared libraries properly encode their own dependencies (such as Linux).
201 It is intended primarily for building packages for Linux distributions
202 to avoid encoding unnecessary shared library dependencies that make
203 shared library migrations more difficult. If none of the above made any
204 sense to you, don't bother with this flag.
208 First, build and install either a CrackLib dictionary as described in
209 REQUIREMENTS above, or build a CDB dictionary with cdbmake-wordlist.
210 (Or both.) The CrackLib dictionary will consist of three files, one
211 each ending in *.hwm, *.pwd, and *.pwi. The CDB dictionary will consist
212 of a single file ending in *.cdb. Install those files somewhere on your
213 system. Then, follow the relevant instructions below for either Heimdal
216 See "Other Settings" below for additional krb5.conf setting supported by
217 both Heimdal and MIT Kerberos.
221 There are two options: using an external password check program, or
222 using the plugin. I recommend the external password check program
223 unless you encounter speed problems with that approach that cause
226 For either approach, first add a stanza like the following to the
227 [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
231 password_dictionary = /path/to/cracklib/dictionary
232 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
235 The first setting configures a CrackLib dictionary and the second a CDB
236 dictionary. The provided path should be the full path to the dictionary
237 files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
238 CrackLib dictionary. You can use either or both settings. If you use
239 both, CrackLib will be checked first, and then CDB. When checking a CDB
240 database, the password, the password with the first character removed,
241 the last character removed, the first and last characters removed, the
242 first two characters removed, and the last two characters removed will
243 all be checked against the dictionary.
245 Then, for the external password checking program, add a new section (or
246 modify the existing [password_quality] section) to look like the
250 policies = external-check
251 external_program = /usr/local/bin/heimdal-strength
253 You can, of course, combine this policy with others. Replace the path
254 with the full path to wherever you have installed heimdal-strength. You
255 can put this section in your kdc.conf instead of krb5.conf if you
258 If you want to instead use the module, use the following section
262 policies = krb5-strength
263 policy_libraries = /usr/local/lib/krb5/plugins/pwqual/strength.so
265 in either krb5.conf or kdc.conf. Note that some older versions of
266 Heimdal have a bug in the support for loading modules when
267 policy_libraries is set. If you get an error like:
269 didn't find `kadm5_password_verifier' symbol in `(null)'
271 you may have to omit policy_libraries in your configuration and instead
272 pass the --check-library argument to kpasswdd specifying the library to
277 To add this module to the list of password quality checks, add a section
278 to krb5.conf (or to a separate kdc.conf if you use that) like:
282 module = strength:/usr/local/lib/krb5/plugins/pwqual/strength.so
285 to register the plugin.
287 There are two ways to tell where the dictionary is. One option is to
288 use krb5.conf (and in this case you must use krb5.conf, even if you use
289 a separate kdc.conf file). For this approach, add the following to the
290 [appdefaults] section:
293 password_dictionary = /path/to/cracklib/dictionary
294 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
297 The first setting configures a CrackLib dictionary and the second a CDB
298 dictionary. The provided path should be the full path to the dictionary
299 files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
300 CrackLib dictionary. You can use either or both settings. If you use
301 both, CrackLib will be checked first, and then CDB. When checking a CDB
302 database, the password, the password with the first character removed,
303 the last character removed, the first and last characters removed, the
304 first two characters removed, and the last two characters removed will
305 all be checked against the dictionary.
307 The second option is to use the normal dict_path setting. In the
308 [realms] section of your krb5.conf kdc.conf, under the appropriate realm
309 or realms, specify the path to the dictionary:
311 dict_file = /path/to/cracklib/dictionary
313 This will be taken as a CrackLib dictionary path, the same as the
314 setting for password_dictionary above. The provided path should be the
315 full path to the dictionary files, omitting the trailing *.hwm, *.pwd,
316 or *.pwi extension. However, be aware that, if you use this approach,
317 you will probably want to disable the built-in standard dict pwqual
318 plugin by adding the line:
322 to the pwqual block of the [plugins] section as shown above. Otherwise,
323 it will also try to load a dictionary at the same path to do simple
326 You can also mix and match these settings, by using dict_path for the
327 CrackLib dictionary path and krb5.conf for the CDB dictionary path. If
328 both settings are used, krb5.conf overrides the dict_path setting (so
329 that dict_path can be used for other password quality modules). There
330 is no way to specify a CDB dictionary via the dict_path setting.
334 The following additional settings are supported in the [appdefaults]
335 section of krb5.conf when running under either Heimdal or MIT Kerberos.
339 If set to a numeric value, passwords with fewer than that number of
340 characters will be rejected, independent of any length restrictions
341 in CrackLib. Note that this setting does not bypass the minimum
342 length requirements in CrackLib itself (which, for the version
343 embedded in this package, is eight characters).
345 require_ascii_printable
347 If set to a true boolean value, rejects any password that contains
348 non-ASCII characters or ASCII control characters. Spaces are
349 allowed; tabs are not (at least assuming the POSIX C locale). No
350 canonicalization or character set is defined for Kerberos passwords
351 in general, so you may want to reject non-ASCII characters to avoid
352 interoperability problems with computers with different default
353 character sets or Unicode normalization forms.
357 This option allows specification of more complex character class
358 requirements. The value of this parameter should be one or more
359 whitespace-separated rule. Each rule has the syntax:
361 [<min>-<max>:]<class>[,<class>...]
363 where <class> is one of "upper", "lower", "digit", or "symbol"
364 (without the quote marks). The symbol class includes all characters
365 other than alphanumeric characters, including space. The listed
366 classes must appear in the password. Separate multiple required
367 classes with a comma (and no space).
369 The character class checks will be done in whatever locale the
370 plugin or password check program is run in, which will normally be
371 the POSIX C locale but may be different depending on local
376 require_classes = upper,lower,digit
378 This requires all passwords contain at least one uppercase letter,
379 at least one lowercase letter, and at least one digit.
381 If present, <min> and <max> specify the minimum password length and
382 maximum password length to which this rule applies. This allows one
383 to specify character class requirements that change with password
384 length. So, for example:
386 require_classes = 8-19:upper,lower 8-15:digit 8-11:symbol
388 requires all passwords from 8 to 11 characters long contain all four
389 character classes, passwords from 12 to 15 characters long contain
390 upper and lower case and a digit, and passwords from 16 to 19
391 characters long contain both upper and lower case. Passowrds longer
392 than 20 characters have no character class restrictions. (This
393 example is probably used in conjunction with minimum_length = 8.)
397 If set to a true boolean value, the password must contain at least
398 one character that is not a letter (uppercase or lowercase) or a
399 space. This may be helpful in combination with passphrases; users
400 may choose a stock English phrase, and this will force at least some
401 additional complexity.
403 You can omit any dictionary setting and only use the above settings, in
404 which case only the above checks and checks for passwords based on the
405 principal will be done, bypassing any dictionary check. (But for that
406 simple style of password strength checking, there are probably better
407 strength checking plugins already available.)
411 The krb5-strength web page at:
413 http://www.eyrie.org/~eagle/software/krb5-strength/
415 will always have the current version of this package, the current
416 documentation, and pointers to any additional resources.
418 I welcome bug reports and patches for this package at eagle@eyrie.org.
419 However, please be aware that I tend to be extremely busy and work
420 projects often take priority. I'll save your mail and get to it as soon
421 as I can, but it may take me a couple of months.
425 krb5-strength is maintained using Git. You can access the current
426 source by cloning the repository at:
428 git://git.eyrie.org/kerberos/krb5-strength.git
430 or view the repository via the web at:
432 http://git.eyrie.org/?p=kerberos/krb5-strength.git
434 When contributing modifications, either patches (possibly generated by
435 git format-patch) or Git pull requests are welcome.
439 The krb5-strength package as a whole is covered by the following
440 copyright statement and license:
442 Copyright 2006, 2007, 2009, 2010, 2012, 2013
443 The Board of Trustees of the Leland Stanford Junior University
445 Permission is hereby granted, free of charge, to any person obtaining
446 a copy of this software and associated documentation files (the
447 "Software"), to deal in the Software without restriction, including
448 without limitation the rights to use, copy, modify, merge, publish,
449 distribute, sublicense, and/or sell copies of the Software, and to
450 permit persons to whom the Software is furnished to do so, subject to
451 the following conditions:
453 The above copyright notice and this permission notice shall be
454 included in all copies or substantial portions of the Software.
456 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
457 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
458 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
459 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
460 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
461 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
462 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
464 The embedded version of CrackLib (all files in the cracklib
465 subdirectory) is covered by the Artistic license. See the file
466 cracklib/LICENCE for more information. Combined derivative works that
467 include this code, such as binaries built with the embedded CrackLib,
468 will need to follow the terms of the Artistic license as well as the
471 All other individual files without an explicit exception below are
472 released under this license. Some files may have additional copyright
473 holders as noted in those files. There is detailed information about
474 the licensing of each file in the LICENSE file in this distribution.
476 Some files in this distribution are individually released under
477 different licenses, all of which are compatible with the above general
478 package license but which may require preservation of additional
479 notices. All required notices are preserved in the LICENSE file.