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. You will also need Perl 5.010 or
135 later and the JSON, Perl6::Slurp, and Readonly modules (from CPAN) to
136 bootstrap the test suite data from a Git checkout.
138 COMPILING AND INSTALLING
140 You can build and install the plugin with the standard commands:
146 Pass --enable-silent-rules to configure for a quieter build (similar to
147 the Linux kernel). Use make warnings instead of make to build with full
148 GCC compiler warnings (requires a relatively current version of GCC).
150 The last step will probably have to be done as root. By default, the
151 plugin is installed as /usr/local/lib/krb5/plugins/pwqual/strength.so
152 and the Heimdal external password check function is installed as
153 /usr/local/bin/heimdal-strength. You can change these paths with the
154 --prefix, --libdir, and --bindir options to configure.
156 To build with the system version of CrackLib, pass --with-cracklib to
157 configure. You can optionally add a directory, giving the root
158 directory where CrackLib was installed, or separately set the include
159 and library path with --with-cracklib-include and --with-cracklib-lib.
161 krb5-strength will automatically build with TinyCDB if it is found. To
162 specify the installation path of TinyCDB, use --with-tinycdb. You can
163 also separately set the include and library path with
164 --with-tinycdb-include and --with-tinycdb-lib.
166 Normally, configure will use krb5-config to determine the flags to use
167 to compile with your Kerberos libraries. If krb5-config isn't found, it
168 will look for the standard Kerberos libraries in locations already
169 searched by your compiler. If the the krb5-config script first in your
170 path is not the one corresponding to the Kerberos libraries you want to
171 use or if your Kerberos libraries and includes aren't in a location
172 searched by default by your compiler, you need to specify a different
173 Kerberos installation root via --with-krb5=PATH. For example:
175 ./configure --with-krb5=/usr/pubsw
177 You can also individually set the paths to the include directory and the
178 library directory with --with-krb5-include and --with-krb5-lib. You may
179 need to do this if Autoconf can't figure out whether to use lib, lib32,
180 or lib64 on your platform.
182 To specify a particular krb5-config script to use, either set the
183 PATH_KRB5_CONFIG environment variable or pass it to configure like:
185 ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
187 To not use krb5-config and force library probing even if there is a
188 krb5-config script on your path, set PATH_KRB5_CONFIG to a nonexistent
191 ./configure PATH_KRB5_CONFIG=/nonexistent
193 krb5-config is not used and library probing is always done if either
194 --with-krb5-include or --with-krb5-lib are given.
196 You can pass the --enable-reduced-depends flag to configure to try to
197 minimize the shared library dependencies encoded in the binaries. This
198 omits from the link line all the libraries included solely because the
199 Kerberos libraries depend on them and instead links the programs only
200 against libraries whose APIs are called directly. This will only work
201 with shared Kerberos libraries and will only work on platforms where
202 shared libraries properly encode their own dependencies (such as Linux).
203 It is intended primarily for building packages for Linux distributions
204 to avoid encoding unnecessary shared library dependencies that make
205 shared library migrations more difficult. If none of the above made any
206 sense to you, don't bother with this flag.
210 First, build and install either a CrackLib dictionary as described in
211 REQUIREMENTS above, or build a CDB dictionary with cdbmake-wordlist.
212 (Or both.) The CrackLib dictionary will consist of three files, one
213 each ending in *.hwm, *.pwd, and *.pwi. The CDB dictionary will consist
214 of a single file ending in *.cdb. Install those files somewhere on your
215 system. Then, follow the relevant instructions below for either Heimdal
218 See "Other Settings" below for additional krb5.conf setting supported by
219 both Heimdal and MIT Kerberos.
223 There are two options: using an external password check program, or
224 using the plugin. I recommend the external password check program
225 unless you encounter speed problems with that approach that cause
228 For either approach, first add a stanza like the following to the
229 [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
233 password_dictionary = /path/to/cracklib/dictionary
234 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
237 The first setting configures a CrackLib dictionary and the second a CDB
238 dictionary. The provided path should be the full path to the dictionary
239 files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
240 CrackLib dictionary. You can use either or both settings. If you use
241 both, CrackLib will be checked first, and then CDB. When checking a CDB
242 database, the password, the password with the first character removed,
243 the last character removed, the first and last characters removed, the
244 first two characters removed, and the last two characters removed will
245 all be checked against the dictionary.
247 Then, for the external password checking program, add a new section (or
248 modify the existing [password_quality] section) to look like the
252 policies = external-check
253 external_program = /usr/local/bin/heimdal-strength
255 You can, of course, combine this policy with others. Replace the path
256 with the full path to wherever you have installed heimdal-strength. You
257 can put this section in your kdc.conf instead of krb5.conf if you
260 If you want to instead use the module, use the following section
264 policies = krb5-strength
265 policy_libraries = /usr/local/lib/krb5/plugins/pwqual/strength.so
267 in either krb5.conf or kdc.conf. Note that some older versions of
268 Heimdal have a bug in the support for loading modules when
269 policy_libraries is set. If you get an error like:
271 didn't find `kadm5_password_verifier' symbol in `(null)'
273 you may have to omit policy_libraries in your configuration and instead
274 pass the --check-library argument to kpasswdd specifying the library to
279 To add this module to the list of password quality checks, add a section
280 to krb5.conf (or to a separate kdc.conf if you use that) like:
284 module = strength:/usr/local/lib/krb5/plugins/pwqual/strength.so
287 to register the plugin.
289 There are two ways to tell where the dictionary is. One option is to
290 use krb5.conf (and in this case you must use krb5.conf, even if you use
291 a separate kdc.conf file). For this approach, add the following to the
292 [appdefaults] section:
295 password_dictionary = /path/to/cracklib/dictionary
296 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
299 The first setting configures a CrackLib dictionary and the second a CDB
300 dictionary. The provided path should be the full path to the dictionary
301 files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
302 CrackLib dictionary. You can use either or both settings. If you use
303 both, CrackLib will be checked first, and then CDB. When checking a CDB
304 database, the password, the password with the first character removed,
305 the last character removed, the first and last characters removed, the
306 first two characters removed, and the last two characters removed will
307 all be checked against the dictionary.
309 The second option is to use the normal dict_path setting. In the
310 [realms] section of your krb5.conf kdc.conf, under the appropriate realm
311 or realms, specify the path to the dictionary:
313 dict_file = /path/to/cracklib/dictionary
315 This will be taken as a CrackLib dictionary path, the same as the
316 setting for password_dictionary above. The provided path should be the
317 full path to the dictionary files, omitting the trailing *.hwm, *.pwd,
318 or *.pwi extension. However, be aware that, if you use this approach,
319 you will probably want to disable the built-in standard dict pwqual
320 plugin by adding the line:
324 to the pwqual block of the [plugins] section as shown above. Otherwise,
325 it will also try to load a dictionary at the same path to do simple
328 You can also mix and match these settings, by using dict_path for the
329 CrackLib dictionary path and krb5.conf for the CDB dictionary path. If
330 both settings are used, krb5.conf overrides the dict_path setting (so
331 that dict_path can be used for other password quality modules). There
332 is no way to specify a CDB dictionary via the dict_path setting.
336 The following additional settings are supported in the [appdefaults]
337 section of krb5.conf when running under either Heimdal or MIT Kerberos.
341 If set to a numeric value, passwords with fewer than that number of
342 characters will be rejected, independent of any length restrictions
343 in CrackLib. Note that this setting does not bypass the minimum
344 length requirements in CrackLib itself (which, for the version
345 embedded in this package, is eight characters).
347 require_ascii_printable
349 If set to a true boolean value, rejects any password that contains
350 non-ASCII characters or ASCII control characters. Spaces are
351 allowed; tabs are not (at least assuming the POSIX C locale). No
352 canonicalization or character set is defined for Kerberos passwords
353 in general, so you may want to reject non-ASCII characters to avoid
354 interoperability problems with computers with different default
355 character sets or Unicode normalization forms.
359 This option allows specification of more complex character class
360 requirements. The value of this parameter should be one or more
361 whitespace-separated rule. Each rule has the syntax:
363 [<min>-<max>:]<class>[,<class>...]
365 where <class> is one of "upper", "lower", "digit", or "symbol"
366 (without the quote marks). The symbol class includes all characters
367 other than alphanumeric characters, including space. The listed
368 classes must appear in the password. Separate multiple required
369 classes with a comma (and no space).
371 The character class checks will be done in whatever locale the
372 plugin or password check program is run in, which will normally be
373 the POSIX C locale but may be different depending on local
378 require_classes = upper,lower,digit
380 This requires all passwords contain at least one uppercase letter,
381 at least one lowercase letter, and at least one digit.
383 If present, <min> and <max> specify the minimum password length and
384 maximum password length to which this rule applies. This allows one
385 to specify character class requirements that change with password
386 length. So, for example:
388 require_classes = 8-19:upper,lower 8-15:digit 8-11:symbol
390 requires all passwords from 8 to 11 characters long contain all four
391 character classes, passwords from 12 to 15 characters long contain
392 upper and lower case and a digit, and passwords from 16 to 19
393 characters long contain both upper and lower case. Passowrds longer
394 than 20 characters have no character class restrictions. (This
395 example is probably used in conjunction with minimum_length = 8.)
399 If set to a true boolean value, the password must contain at least
400 one character that is not a letter (uppercase or lowercase) or a
401 space. This may be helpful in combination with passphrases; users
402 may choose a stock English phrase, and this will force at least some
403 additional complexity.
405 You can omit any dictionary setting and only use the above settings, in
406 which case only the above checks and checks for passwords based on the
407 principal will be done, bypassing any dictionary check. (But for that
408 simple style of password strength checking, there are probably better
409 strength checking plugins already available.)
413 The krb5-strength web page at:
415 http://www.eyrie.org/~eagle/software/krb5-strength/
417 will always have the current version of this package, the current
418 documentation, and pointers to any additional resources.
420 I welcome bug reports and patches for this package at eagle@eyrie.org.
421 However, please be aware that I tend to be extremely busy and work
422 projects often take priority. I'll save your mail and get to it as soon
423 as I can, but it may take me a couple of months.
427 krb5-strength is maintained using Git. You can access the current
428 source by cloning the repository at:
430 git://git.eyrie.org/kerberos/krb5-strength.git
432 or view the repository via the web at:
434 http://git.eyrie.org/?p=kerberos/krb5-strength.git
436 When contributing modifications, either patches (possibly generated by
437 git format-patch) or Git pull requests are welcome.
441 The krb5-strength package as a whole is covered by the following
442 copyright statement and license:
444 Copyright 2006, 2007, 2009, 2010, 2012, 2013
445 The Board of Trustees of the Leland Stanford Junior University
447 Permission is hereby granted, free of charge, to any person obtaining
448 a copy of this software and associated documentation files (the
449 "Software"), to deal in the Software without restriction, including
450 without limitation the rights to use, copy, modify, merge, publish,
451 distribute, sublicense, and/or sell copies of the Software, and to
452 permit persons to whom the Software is furnished to do so, subject to
453 the following conditions:
455 The above copyright notice and this permission notice shall be
456 included in all copies or substantial portions of the Software.
458 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
459 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
460 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
461 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
462 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
463 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
464 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
466 The embedded version of CrackLib (all files in the cracklib
467 subdirectory) is covered by the Artistic license. See the file
468 cracklib/LICENCE for more information. Combined derivative works that
469 include this code, such as binaries built with the embedded CrackLib,
470 will need to follow the terms of the Artistic license as well as the
473 All other individual files without an explicit exception below are
474 released under this license. Some files may have additional copyright
475 holders as noted in those files. There is detailed information about
476 the licensing of each file in the LICENSE file in this distribution.
478 Some files in this distribution are individually released under
479 different licenses, all of which are compatible with the above general
480 package license but which may require preservation of additional
481 notices. All required notices are preserved in the LICENSE file.