2 (kadmind password strength checking plugin)
4 Maintained by Russ Allbery <rra@stanford.edu>
6 Copyright 2006, 2007, 2009, 2010 Board of Trustees, Leland Stanford
7 Jr. University. Portions copyright 1993 Alec Muffett. Developed by
8 Derrick Brashear and Ken Hornstein of Sine Nomine Associates, on behalf
9 of Stanford University.
11 This software is distributed under a BSD-style license and under the
12 Artistic License. Please see the section LICENSE for more information.
16 krb5-strength provides mechanisms for checking the strength of Kerberos
17 passwords against an external dictionary when a user changes passwords
18 in a Kerberos KDC. It is roughly equivalent to checking password
19 strength via CrackLib, except that it embeds a copy of Alec Muffett's
20 CrackLib that has been modified to perform slightly more strenuous
21 tests. It is usable as-is with Heimdal. With MIT Kerberos, it requires
22 an included patch to libkadm5srv to support a dynamically loaded
23 password check module.
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.
33 The MIT Kerberos kadmind supports password strength checking against a
34 dictionary out of the box. Unfortunately, that support loads the entire
35 dictionary into memory, requires uncompressed dictionaries, and doesn't
36 apply any transformations to the password before checking it against the
37 dictionary. CrackLib provides more sophisticated strength checking and
38 an optimized, compressed on-disk database format.
40 This toolkit therefore provides the ability to check password quality
41 against the standard version of CrackLib, or against a modified version
42 of CrackLib that only passes passwords that resist attacks from both
43 Crack and Jack the Ripper using the same rule sets. For Heimdal, it
44 includes both a program usable as an external password quality check and
45 a plugin that implements the dynamic module API. For MIT Kerberos, it
48 * A patch to MIT Kerberos to add a plugin system for password strength
49 checking. This patch adds initialization and shutdown hooks plus a
50 hook that's run prior to each password change. The code in kadmind
51 is independent of what the plugin might do.
53 * A libkadm5srv or Heimdal kpasswdd plugin that provides a wrapper
56 krb5-strength can be built with either the system CrackLib or with the
57 modified version of CrackLib included in this package. Note, however,
58 that if you're building against the system CrackLib, Heimdal includes in
59 the distribution a strength-checking plugin and an external password
60 check program that use the system CrackLib. With Heimdal, it would
61 probably be easier to use that plugin or program than build this package
62 unless you want the modified CrackLib.
64 For information about the changes to the CrackLib included in this
65 toolkit, see cracklib/HISTORY. The primary changes are tighter rules,
66 which are more aggressive at finding dictionary words with characters
67 appended and prepended, which tighten the requirements for password
68 entropy, and which add stricter rules for longer passwords. They are
69 also minor changes to fix portability issues and remove some code that
70 doesn't make sense in the kadmind context.
72 My eventual hope is to submit to CrackLib 2.x modifications that allow
73 the rule set to be configured at runtime, at which point this package
74 can likely wither away in favor of much simpler plugins that link to the
75 standard CrackLib library.
79 For Heimdal, this package is usable without any special considerations.
80 You may use either the external password quality check tool, installed
81 as heimdal-strength, or the plugin as you choose. It has been tested
82 with Heimdal 1.2.1 and later.
84 To use this plugin with MIT Kerberos, you will need to apply the patch
85 in the patches directory to MIT Kerberos and rebuild. Due to how
86 kadmind is constructed, the changes are actually in the libkadm5srv
87 library, not in the kadmind binary, so you'll 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.
96 For this module to be effective for either Heimdal or MIT Kerberos, you
97 will also need to construct a dictionary. The mkdict and packer
98 utilities to build a CrackLib dictionary from a word list are included
99 in this toolkit but not installed by default. You can run them out of
100 the cracklib directory after building. You can also use the utilities
101 that come with the stock CrackLib package (often already packaged in a
102 Linux distribution); the database format is compatible.
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 (or even better, find
107 every word list you can locate on the Internet and combine them). Since
108 word lists are bulky, often covered by murky copyrights, and easily
109 locatable on the Internet with a modicum of searching, none are included
112 To bootstrap from a Git checkout, or If you change the Automake files
113 and need to regenerate Makefile.in, you will need Automake 1.11 or
114 later. For bootstrap or if you change configure.ac or any of the m4
115 files it includes and need to regenerate configure or config.h.in, you
116 will need Autoconf 2.64 or later.
118 COMPILING AND INSTALLING
120 You can build and install the plugin with the standard commands:
126 Pass --enable-silent-rules to configure for a quieter build (similar to
127 the Linux kernel). Use make warnings instead of make to build with full
128 GCC compiler warnings (requires a relatively current version of GCC).
130 The last step will probably have to be done as root. By default, the
131 plugin is installed as /usr/local/lib/kadmind/passwd_strength.so and the
132 Heimdal external password check function is installed as
133 /usr/local/bin/heimdal-strength. You can change these paths with the
134 --prefix, --libdir, and --bindir options to configure.
136 For MIT Kerberos, you also have to apply the patch provided in the
137 patches directory to the MIT Kerberos source and install the new
138 libkadm5srv library. See patches/README for more information about the
139 patch. If you're using a different version of MIT Kerberos, you may
140 need to adjust the patch accordingly.
142 To build with the system version of CrackLib, pass --with-cracklib to
143 configure. You can optionally add a directory, giving the root
144 directory where CrackLib was installed, or separately set the include
145 and library path with --with-cracklib-include and --with-cracklib-lib.
147 Normally, configure will use krb5-config to determine the flags to use
148 to compile with your Kerberos libraries. If krb5-config isn't found, it
149 will look for the standard Kerberos libraries in locations already
150 searched by your compiler. If the the krb5-config script first in your
151 path is not the one corresponding to the Kerberos libraries you want to
152 use or if your Kerberos libraries and includes aren't in a location
153 searched by default by your compiler, you need to specify a different
154 Kerberos installation root via --with-krb5=PATH. For example:
156 ./configure --with-krb5=/usr/pubsw
158 You can also individually set the paths to the include directory and the
159 library directory with --with-krb5-include and --with-krb5-lib. You may
160 need to do this if Autoconf can't figure out whether to use lib, lib32,
161 or lib64 on your platform. Note that these settings aren't used if a
162 krb5-config script is found, so you may need to disable the krb5-config
163 script as described below.
165 To specify a particular krb5-config script to use, either set the
166 KRB5_CONFIG environment variable or pass it to configure like:
168 ./configure KRB5_CONFIG=/path/to/krb5-config
170 To not use krb5-config and force library probing even if there is a
171 krb5-config script on your path, set KRB5_CONFIG to a nonexistent path:
173 ./configure KRB5_CONFIG=/nonexistent
175 You can pass the --enable-reduced-depends flag to configure to try to
176 minimize the shared library dependencies encoded in the binaries. This
177 omits from the link line all the libraries included solely because the
178 Kerberos libraries depend on them and instead links the programs only
179 against libraries whose APIs are called directly. This will only work
180 with shared Kerberos libraries and will only work on platforms where
181 shared libraries properly encode their own dependencies (such as Linux).
182 It is intended primarily for building packages for Linux distributions
183 to avoid encoding unnecessary shared library dependencies that make
184 shared library migrations more difficult. If none of the above made any
185 sense to you, don't bother with this flag.
189 First, build and install a CrackLib dictionary as described above. This
190 dictionary will consist of three files, one each ending in *.hwm, *.pwd,
191 and *.pwi. Install those files somewhere on your system. Then, follow
192 the relevant instructions below for either Heimdal or MIT Kerberos.
196 There are two options: using an external password check program, or
197 using the plugin. I recommend the external password check program
198 unless you encounter speed problems with that approach that cause
201 For either approach, first add a stanza like the following to the
202 [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
206 password_dictionary = /usr/local/lib/kadmind/dictionary
209 The provided path should be the full path to the dictionary files,
210 omitting the trailing *.hwm, *.pwd, and *.pwi extensions.
212 Then, for the external password checking program, add a new section (or
213 modify the existing [password_quality] section) to look like the
217 policies = external-check
218 external_program = /usr/local/bin/heimdal-strength
220 You can, of course, combine this policy with others. Replace the path
221 with the full path to wherever you have installed heimdal-strength. You
222 can put this section in your kdc.conf instead of krb5.conf if you
225 If you want to instead use the module, use the following section
229 policies = krb5-strength
230 policy_libraries = /usr/local/lib/kadmind/passwd_strength.so
232 in either krb5.conf or kdc.conf. Note that some versions of Heimdal
233 have a bug in the support for loading modules when policy_libraries is
234 set. If you get an error like:
236 didn't find `kadm5_password_verifier' symbol in `(null)'
238 you may have to omit policy_libraries in your configuration and instead
239 pass the --check-library argument to kpasswdd specifying the library to
244 In the [realms] section of your kdc.conf, under the appropriate realm or
245 realms, specify the path to the dictionary:
247 dict_file = /path/to/cracklib/dictionary
249 The provided path should be the full path to the dictionary files,
250 omitting the trailing *.hwm, *.pwd, or *.pwi extension. Then, specify
251 the path to the plugin by adding:
253 pwcheck_plugin = /usr/local/lib/kadmind/passwd_strength.so
255 to the same section of the kdc.conf, giving the correct full path to the
256 plugin. Restart kadmind and password strength checking should be
259 Be aware that, for MIT Kerberos, password strength checking is only
260 applied to principals with a policy set. If you want to check all user
261 passwords, assign all user principals a password policy. (Similarly,
262 you can avoid checking the strength of passwords for particular
263 principals by clearing their policy.) Also be aware that enabling this
264 plugin will disable the normal kadmind dictionary check. There
265 currently is no way to have them both enabled at the same time.
267 Finally, note that the default rules of this plugin will reject the
268 temporary password used by addprinc -randkey or ktadd -randkey when
269 initializing a principal. When generating service principals using that
270 flag, you will need to pass in the -clearpolicy flag as well to avoid
271 rejecting the initial temporary password. You can then add a policy
272 later with modprinc if desired.