2 (kadmind password strength checking plugin)
4 Maintained by Russ Allbery <rra@stanford.edu>
6 Copyright 2006, 2007, 2009, 2010, 2012 The Board of Trustees of the
7 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.
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 PATH_KRB5_CONFIG environment variable or pass it to configure like:
168 ./configure PATH_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 PATH_KRB5_CONFIG to a nonexistent
174 ./configure KRB5_CONFIG=/nonexistent
176 You can pass the --enable-reduced-depends flag to configure to try to
177 minimize the shared library dependencies encoded in the binaries. This
178 omits from the link line all the libraries included solely because the
179 Kerberos libraries depend on them and instead links the programs only
180 against libraries whose APIs are called directly. This will only work
181 with shared Kerberos libraries and will only work on platforms where
182 shared libraries properly encode their own dependencies (such as Linux).
183 It is intended primarily for building packages for Linux distributions
184 to avoid encoding unnecessary shared library dependencies that make
185 shared library migrations more difficult. If none of the above made any
186 sense to you, don't bother with this flag.
190 First, build and install a CrackLib dictionary as described above. This
191 dictionary will consist of three files, one each ending in *.hwm, *.pwd,
192 and *.pwi. Install those files somewhere on your system. Then, follow
193 the relevant instructions below for either Heimdal or MIT Kerberos.
197 There are two options: using an external password check program, or
198 using the plugin. I recommend the external password check program
199 unless you encounter speed problems with that approach that cause
202 For either approach, first add a stanza like the following to the
203 [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
207 password_dictionary = /usr/local/lib/kadmind/dictionary
210 The provided path should be the full path to the dictionary files,
211 omitting the trailing *.hwm, *.pwd, and *.pwi extensions.
213 Then, for the external password checking program, add a new section (or
214 modify the existing [password_quality] section) to look like the
218 policies = external-check
219 external_program = /usr/local/bin/heimdal-strength
221 You can, of course, combine this policy with others. Replace the path
222 with the full path to wherever you have installed heimdal-strength. You
223 can put this section in your kdc.conf instead of krb5.conf if you
226 If you want to instead use the module, use the following section
230 policies = krb5-strength
231 policy_libraries = /usr/local/lib/kadmind/passwd_strength.so
233 in either krb5.conf or kdc.conf. Note that some versions of Heimdal
234 have a bug in the support for loading modules when policy_libraries is
235 set. If you get an error like:
237 didn't find `kadm5_password_verifier' symbol in `(null)'
239 you may have to omit policy_libraries in your configuration and instead
240 pass the --check-library argument to kpasswdd specifying the library to
245 In the [realms] section of your kdc.conf, under the appropriate realm or
246 realms, specify the path to the dictionary:
248 dict_file = /path/to/cracklib/dictionary
250 The provided path should be the full path to the dictionary files,
251 omitting the trailing *.hwm, *.pwd, or *.pwi extension. Then, specify
252 the path to the plugin by adding:
254 pwcheck_plugin = /usr/local/lib/kadmind/passwd_strength.so
256 to the same section of the kdc.conf, giving the correct full path to the
257 plugin. Restart kadmind and password strength checking should be
260 Be aware that, for MIT Kerberos, password strength checking is only
261 applied to principals with a policy set. If you want to check all user
262 passwords, assign all user principals a password policy. (Similarly,
263 you can avoid checking the strength of passwords for particular
264 principals by clearing their policy.) Also be aware that enabling this
265 plugin will disable the normal kadmind dictionary check. There
266 currently is no way to have them both enabled at the same time.
268 Finally, note that the default rules of this plugin will reject the
269 temporary password used by addprinc -randkey or ktadd -randkey when
270 initializing a principal. When generating service principals using that
271 flag, you will need to pass in the -clearpolicy flag as well to avoid
272 rejecting the initial temporary password. You can then add a policy
273 later with modprinc if desired.