2 (Kerberos password strength checking plugin)
4 Maintained by Russ Allbery <eagle@eyrie.org>
6 Copyright 2006, 2007, 2009, 2010, 2012, 2013, 2014 The Board of Trustees
7 of 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), an external password quality
17 program for use with Heimdal, and a per-principal password history
18 implementation for Heimdal. Passwords can be tested with CrackLib,
19 checked against a CDB or SQLite database of known weak passwords with
20 some transformations, checked for length, checked for non-printable or
21 non-ASCII characters that may be difficult to enter reproducibly,
22 required to contain particular character classes, or any combination of
23 these tests. It supports both Heimdal and MIT Kerberos (1.9 or later).
27 Heimdal includes a capability to plug in external password quality
28 checks and comes with an example that checks passwords against CrackLib.
29 However, in testing at Stanford, we found that CrackLib with its default
30 transform rules does not catch passwords that can be guessed using the
31 same dictionary with other tools, such as Jack the Ripper. We then
32 discovered other issues with CrackLib with longer passwords, such as
33 some bad assumptions about how certain measures of complexity will
34 scale, and wanted to impose other limitations that it didn't support.
36 This plugin provides the ability to check password quality against the
37 standard version of CrackLib, or against a modified version of CrackLib
38 that only passes passwords that resist attacks from both Crack and Jack
39 the Ripper using the same rule sets. It also supports doing simpler
40 dictionary checks against a CDB database, which is fast with very large
41 dictionaries, or a SQLite database, which can reject all passwords
42 within edit distance one of a dictionary word. It can also impose other
43 programmatic checks on passwords such as character class requirements.
45 For Heimdal, it includes both a program usable as an external password
46 quality check and a plugin that implements the dynamic module API. For
47 MIT Kerberos (1.9 or later), it includes a plugin for the password
48 quality (pwqual) plugin API.
50 krb5-strength can be built with either the system CrackLib or with the
51 modified version of CrackLib included in this package. Note, however,
52 that if you're building against the system CrackLib, Heimdal includes in
53 the distribution a strength-checking plugin and an external password
54 check program that use the system CrackLib. With Heimdal, it would
55 probably be easier to use that plugin or program than build this package
56 unless you want the modified CrackLib.
58 For information about the changes to the CrackLib included in this
59 toolkit, see cracklib/HISTORY. The primary changes are tighter rules,
60 which are more aggressive at finding dictionary words with characters
61 appended and prepended, which tighten the requirements for password
62 entropy, and which add stricter rules for longer passwords. They are
63 also minor changes to fix portability issues and remove some code that
64 doesn't make sense in the kadmind context.
66 Ideally, the changes to CrackLib should be added to the standard
67 CrackLib distribution by adding an additional interface to configure its
68 behavior, at which point this package can likely wither away in favor of
69 much simpler plugins that link to the standard CrackLib library.
71 krb5-strength also includes a password history implementation for
72 Heimdal. This is separate from the password strength implementation but
73 can be stacked with it so that both strength and history checks are
74 performed. This history implementation is available only via the
75 Heimdal external password quality interface. MIT Kerberos includes its
76 own password history implementation.
80 For Heimdal, you may use either the external password quality check
81 tool, installed as heimdal-strength, or the plugin as you choose. It
82 has been tested with Heimdal 1.2.1 and later, but has not recently been
83 tested with versions prior to 1.5.
85 For MIT Kerberos, version 1.9 or higher is required for the password
86 quality plugin interface. MIT Kerberos does not support an external
87 password quality check tool directly, so you will need to install the
90 You can optionally build against the system CrackLib library. Any
91 version should be supported, but note that some versions, particularly
92 older versions close to the original code, do things like printing
93 diagnostics to stderr, calling exit, and otherwise not being
94 well-behaved for use inside plugins or libraries. If using a system
95 CrackLib library, use version 2.8.22 or later to avoid these problems.
97 You can also optionally build against the TinyCDB library, which
98 provides support for simpler and faster password checking against a CDB
99 dictionary file, and the SQLite library (a version new enough to support
100 the sqlite3_open_v2 API; 3.7 should be more than sufficient), which
101 provides support for checking whether passwords are within edit distance
102 one of a dictionary word.
104 For this module to be effective for either Heimdal or MIT Kerberos, you
105 will also need to construct a dictionary. The mkdict and packer
106 utilities to build a CrackLib dictionary from a word list are included
107 in this toolkit but not installed by default. You can run them out of
108 the cracklib directory after building. You can also use the utilities
109 that come with the stock CrackLib package (often already packaged in a
110 Linux distribution); the database format is compatible.
112 For building a CDB or SQLite dictionary, use the provided
113 krb5-strength-wordlist program. For CDB dictionries, the cdb utility
114 must be on your PATH. For SQLite, the DBI and DBD::SQLite Perl modules
115 are required. krb5-strength-wordlist requires Perl 5.006 or later.
117 For a word list to use as source for the dictionary, you can use
118 /usr/share/dict/words if it's available on your system, but it would be
119 better to find a more comprehensive word list. Since word lists are
120 bulky, often covered by murky copyrights, and easily locatable on the
121 Internet with a modicum of searching, none are included in this toolkit.
123 The password history program, heimdal-history, requires Perl 5.010 or
124 later plus the following CPAN modules:
128 Getopt::Long::Descriptive
133 and their dependencies.
135 To run the test suite, you will need Perl 5.010 or later and the
136 dependencies of the heimdal-history program. The following additional
137 Perl modules will also be used by the test suite if present:
146 All are available on CPAN. Some tests will be skipped if the modules
149 To enable tests that don't detect functionality problems but are used to
150 sanity-check the release, set the environment variable RELEASE_TESTING
151 to a true value. To enable tests that may be sensitive to the local
152 environment or that produce a lot of false positives without uncovering
153 many problems, set the environment variable AUTHOR_TESTING to a true
156 To bootstrap from a Git checkout, or If you change the Automake files
157 and need to regenerate Makefile.in, you will need Automake 1.11 or
158 later. For bootstrap or if you change configure.ac or any of the m4
159 files it includes and need to regenerate configure or config.h.in, you
160 will need Autoconf 2.64 or later. You will also need Perl 5.010 or
161 later and the DBI, DBD::SQLite, JSON, Perl6::Slurp, and Readonly modules
162 (from CPAN) to bootstrap the test suite data from a Git checkout.
164 COMPILING AND INSTALLING
166 You can build and install the plugin with the standard commands:
172 Pass --enable-silent-rules to configure for a quieter build (similar to
173 the Linux kernel). Use make warnings instead of make to build with full
174 GCC compiler warnings (requires a relatively current version of GCC).
176 The last step will probably have to be done as root. By default, the
177 plugin is installed as /usr/local/lib/krb5/plugins/pwqual/strength.so
178 and the Heimdal external password check function is installed as
179 /usr/local/bin/heimdal-strength. You can change these paths with the
180 --prefix, --libdir, and --bindir options to configure.
182 To build with the system version of CrackLib, pass --with-cracklib to
183 configure. You can optionally add a directory, giving the root
184 directory where CrackLib was installed, or separately set the include
185 and library path with --with-cracklib-include and --with-cracklib-lib.
187 krb5-strength will automatically build with TinyCDB if it is found. To
188 specify the installation path of TinyCDB, use --with-tinycdb. You can
189 also separately set the include and library path with
190 --with-tinycdb-include and --with-tinycdb-lib.
192 Similarly, krb5-strength will automatically build with SQLite if it is
193 found. To specify the installation path of SQLite, use --with-sqlite.
194 You can also separately set the include and library path with
195 --with-sqlite-include and --with-sqlite-lib.
197 Normally, configure will use krb5-config to determine the flags to use
198 to compile with your Kerberos libraries. If krb5-config isn't found, it
199 will look for the standard Kerberos libraries in locations already
200 searched by your compiler. If the the krb5-config script first in your
201 path is not the one corresponding to the Kerberos libraries you want to
202 use or if your Kerberos libraries and includes aren't in a location
203 searched by default by your compiler, you need to specify a different
204 Kerberos installation root via --with-krb5=PATH. For example:
206 ./configure --with-krb5=/usr/pubsw
208 You can also individually set the paths to the include directory and the
209 library directory with --with-krb5-include and --with-krb5-lib. You may
210 need to do this if Autoconf can't figure out whether to use lib, lib32,
211 or lib64 on your platform.
213 To specify a particular krb5-config script to use, either set the
214 PATH_KRB5_CONFIG environment variable or pass it to configure like:
216 ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
218 To not use krb5-config and force library probing even if there is a
219 krb5-config script on your path, set PATH_KRB5_CONFIG to a nonexistent
222 ./configure PATH_KRB5_CONFIG=/nonexistent
224 krb5-config is not used and library probing is always done if either
225 --with-krb5-include or --with-krb5-lib are given.
227 You can pass the --enable-reduced-depends flag to configure to try to
228 minimize the shared library dependencies encoded in the binaries. This
229 omits from the link line all the libraries included solely because the
230 Kerberos libraries depend on them and instead links the programs only
231 against libraries whose APIs are called directly. This will only work
232 with shared Kerberos libraries and will only work on platforms where
233 shared libraries properly encode their own dependencies (such as Linux).
234 It is intended primarily for building packages for Linux distributions
235 to avoid encoding unnecessary shared library dependencies that make
236 shared library migrations more difficult. If none of the above made any
237 sense to you, don't bother with this flag.
241 First, build and install either a CrackLib dictionary as described in
242 REQUIREMENTS above, or build a CDB or SQLite dictionary with
243 krb5-strength-wordlist. (Or any combination thereof.) The CrackLib
244 dictionary will consist of three files, one each ending in *.hwm, *.pwd,
245 and *.pwi. The CDB and SQLite dictionaries will be single files,
246 conventionally ending in *.cdb and *.sqlite respectively. Install those
247 files somewhere on your system. Then, follow the relevant instructions
248 below for either Heimdal or MIT Kerberos.
250 See "Other Settings" below for additional krb5.conf setting supported by
251 both Heimdal and MIT Kerberos.
255 There are two options: using an external password check program, or
256 using the plugin. I recommend the external password check program
257 unless you encounter speed problems with that approach that cause
260 For either approach, first add a stanza like the following to the
261 [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
265 password_dictionary = /path/to/cracklib/dictionary
266 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
267 password_dictionary_sqlite = /path/to/sqlite/dictionary.sqlite
270 The first setting configures a CrackLib dictionary, the second a CDB
271 dictionary, and the third a SQLite dictionary. The provided path should
272 be the full path to the dictionary files, omitting the trailing *.hwm,
273 *.pwd, and *.pwi extensions for the CrackLib dictionary. You can use
274 any combination of the three settings. If you use more than one,
275 CrackLib will be checked first, then CDB, and then SQLite as
278 When checking against a CDB database, the password, the password with
279 the first character removed, the last character removed, the first and
280 last characters removed, the first two characters removed, and the last
281 two characters removed will all be checked against the dictionary.
283 When checking a SQLite database, the password will be rejected if it is
284 within edit distance one of any word in the dictionary, meaning that the
285 database word can be formed from the password by deleting, adding, or
286 changing a single character.
288 Then, for the external password checking program, add a new section (or
289 modify the existing [password_quality] section) to look like the
293 policies = external-check
294 external_program = /usr/local/bin/heimdal-strength
296 You can, of course, combine this policy with others. Replace the path
297 with the full path to wherever you have installed heimdal-strength. You
298 can put this section in your kdc.conf instead of krb5.conf if you
301 If you want to instead use the module, use the following section
305 policies = krb5-strength
306 policy_libraries = /usr/local/lib/krb5/plugins/pwqual/strength.so
308 in either krb5.conf or kdc.conf. Note that some older versions of
309 Heimdal have a bug in the support for loading modules when
310 policy_libraries is set. If you get an error like:
312 didn't find `kadm5_password_verifier' symbol in `(null)'
314 you may have to omit policy_libraries in your configuration and instead
315 pass the --check-library argument to kpasswdd specifying the library to
318 Additional configuration is required to use the history implementation.
319 Ensure that its dependencies are installed, and then examine the local
320 configuration settings at the top of the heimdal-history program. By
321 default, it requires a _history user and _history group be present on
322 the system, and all history information will be read and written as that
323 user and group. It also requires a nobody user and nogroup group to be
324 present, and all strength checking will be done as that user and group.
325 It uses various files in /var/lib/heimdal-history to store history and
326 statistical information by default, so if using the defaults, create
327 that directory and ensure it is writable by the _history user.
329 Once that setup is done, change your [password_quality] configuration
333 policies = external-check
334 external_program = /usr/local/bin/heimdal-history
336 The heimdal-history program will automatically also run heimdal-strength
337 as well, looking for it in /usr/local/bin, /usr/bin, and /bin. Change
338 the PATH setting at the top of the script if you have different
339 requirements. You should continue to configure heimdal-strength as if
340 you were running it directly.
344 To add this module to the list of password quality checks, add a section
345 to krb5.conf (or to a separate kdc.conf if you use that) like:
349 module = strength:/usr/local/lib/krb5/plugins/pwqual/strength.so
352 to register the plugin.
354 There are two ways to tell where the dictionary is. One option is to
355 use krb5.conf (and in this case you must use krb5.conf, even if you use
356 a separate kdc.conf file). For this approach, add the following to the
357 [appdefaults] section:
360 password_dictionary = /path/to/cracklib/dictionary
361 password_dictionary_cdb = /path/to/cdb/dictionary.cdb
362 password_dictionary_sqlite = /path/to/sqlite/dictionary.sqlite
365 The first setting configures a CrackLib dictionary, the second a CDB
366 dictionary, and the third a SQLite dictionary. The provided path should
367 be the full path to the dictionary files, omitting the trailing *.hwm,
368 *.pwd, and *.pwi extensions for the CrackLib dictionary. You can use
369 any combination of the three settings. If you use more than one,
370 CrackLib will be checked first, then CDB, and then SQLite as
373 When checking against a CDB database, the password, the password with
374 the first character removed, the last character removed, the first and
375 last characters removed, the first two characters removed, and the last
376 two characters removed will all be checked against the dictionary.
378 When checking a SQLite database, the password will be rejected if it is
379 within edit distance one of any word in the dictionary, meaning that the
380 database word can be formed from the password by deleting, adding, or
381 changing a single character.
383 The second option is to use the normal dict_path setting. In the
384 [realms] section of your krb5.conf kdc.conf, under the appropriate realm
385 or realms, specify the path to the dictionary:
387 dict_file = /path/to/cracklib/dictionary
389 This will be taken as a CrackLib dictionary path, the same as the
390 setting for password_dictionary above. The provided path should be the
391 full path to the dictionary files, omitting the trailing *.hwm, *.pwd,
392 or *.pwi extension. However, be aware that, if you use this approach,
393 you will probably want to disable the built-in standard dict pwqual
394 plugin by adding the line:
398 to the pwqual block of the [plugins] section as shown above. Otherwise,
399 it will also try to load a dictionary at the same path to do simple
402 You can also mix and match these settings, by using dict_path for the
403 CrackLib dictionary path and krb5.conf for the CDB or SQLite dictionary
404 paths. If both settings are used for the CrackLib path, krb5.conf
405 overrides the dict_path setting (so that dict_path can be used for other
406 password quality modules). There is no way to specify a CDB or SQLite
407 dictionary via the dict_path setting.
411 The following additional settings are supported in the [appdefaults]
412 section of krb5.conf when running under either Heimdal or MIT Kerberos.
416 If set to a numeric value, passwords with fewer than this number of
417 unique characters will be rejected. This can be used to reject, for
418 example, passwords that are long strings of the same character or
419 repetitions of small numbers of characters, which may be too easy to
424 If set to a numeric value, passwords with fewer than that number of
425 characters will be rejected, independent of any length restrictions
426 in CrackLib. Note that this setting does not bypass the minimum
427 length requirements in CrackLib itself (which, for the version
428 embedded in this package, is eight characters).
430 require_ascii_printable
432 If set to a true boolean value, rejects any password that contains
433 non-ASCII characters or ASCII control characters. Spaces are
434 allowed; tabs are not (at least assuming the POSIX C locale). No
435 canonicalization or character set is defined for Kerberos passwords
436 in general, so you may want to reject non-ASCII characters to avoid
437 interoperability problems with computers with different default
438 character sets or Unicode normalization forms.
442 This option allows specification of more complex character class
443 requirements. The value of this parameter should be one or more
444 whitespace-separated rule. Each rule has the syntax:
446 [<min>-<max>:]<class>[,<class>...]
448 where <class> is one of "upper", "lower", "digit", or "symbol"
449 (without the quote marks). The symbol class includes all characters
450 other than alphanumeric characters, including space. The listed
451 classes must appear in the password. Separate multiple required
452 classes with a comma (and no space).
454 The character class checks will be done in whatever locale the
455 plugin or password check program is run in, which will normally be
456 the POSIX C locale but may be different depending on local
461 require_classes = upper,lower,digit
463 This requires all passwords contain at least one uppercase letter,
464 at least one lowercase letter, and at least one digit.
466 If present, <min> and <max> specify the minimum password length and
467 maximum password length to which this rule applies. This allows one
468 to specify character class requirements that change with password
469 length. So, for example:
471 require_classes = 8-19:upper,lower 8-15:digit 8-11:symbol
473 requires all passwords from 8 to 11 characters long contain all four
474 character classes, passwords from 12 to 15 characters long contain
475 upper and lower case and a digit, and passwords from 16 to 19
476 characters long contain both upper and lower case. Passowrds longer
477 than 20 characters have no character class restrictions. (This
478 example is probably used in conjunction with minimum_length = 8.)
482 If set to a true boolean value, the password must contain at least
483 one character that is not a letter (uppercase or lowercase) or a
484 space. This may be helpful in combination with passphrases; users
485 may choose a stock English phrase, and this will force at least some
486 additional complexity.
488 You can omit any dictionary setting and only use the above settings, in
489 which case only the above checks and checks for passwords based on the
490 principal will be done, bypassing any dictionary check. (But for that
491 simple style of password strength checking, there are probably better
492 strength checking plugins already available.)
496 The krb5-strength web page at:
498 http://www.eyrie.org/~eagle/software/krb5-strength/
500 will always have the current version of this package, the current
501 documentation, and pointers to any additional resources.
503 I welcome bug reports and patches for this package at eagle@eyrie.org.
504 However, please be aware that I tend to be extremely busy and work
505 projects often take priority. I'll save your mail and get to it as soon
506 as I can, but it may take me a couple of months.
510 krb5-strength is maintained using Git. You can access the current
511 source by cloning the repository at:
513 git://git.eyrie.org/kerberos/krb5-strength.git
515 or view the repository via the web at:
517 http://git.eyrie.org/?p=kerberos/krb5-strength.git
519 When contributing modifications, either patches (possibly generated by
520 git format-patch) or Git pull requests are welcome.
524 The krb5-strength package as a whole is covered by the following
525 copyright statement and license:
527 Copyright 2006, 2007, 2009, 2010, 2012, 2013, 2014
528 The Board of Trustees of the Leland Stanford Junior University
530 Permission is hereby granted, free of charge, to any person obtaining
531 a copy of this software and associated documentation files (the
532 "Software"), to deal in the Software without restriction, including
533 without limitation the rights to use, copy, modify, merge, publish,
534 distribute, sublicense, and/or sell copies of the Software, and to
535 permit persons to whom the Software is furnished to do so, subject to
536 the following conditions:
538 The above copyright notice and this permission notice shall be
539 included in all copies or substantial portions of the Software.
541 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
542 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
543 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
544 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
545 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
546 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
547 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
549 The embedded version of CrackLib (all files in the cracklib
550 subdirectory) is covered by the Artistic license. See the file
551 cracklib/LICENCE for more information. Combined derivative works that
552 include this code, such as binaries built with the embedded CrackLib,
553 will need to follow the terms of the Artistic license as well as the
556 All other individual files without an explicit exception below are
557 released under this license. Some files may have additional copyright
558 holders as noted in those files. There is detailed information about
559 the licensing of each file in the LICENSE file in this distribution.
561 Some files in this distribution are individually released under
562 different licenses, all of which are compatible with the above general
563 package license but which may require preservation of additional
564 notices. All required notices are preserved in the LICENSE file.