krb5-strength 1.0 (kadmind password strength checking plugin) Maintained by Russ Allbery Copyright 2006, 2007, 2009, 2010 Board of Trustees, Leland Stanford Jr. University. Portions copyright 1993 Alec Muffett. Developed by Derrick Brashear and Ken Hornstein of Sine Nomine Associates, on behalf of Stanford University. This software is distributed under a BSD-style license and under the Artistic License. Please see the section LICENSE for more information. BLURB krb5-strength provides mechanisms for checking the strength of Kerberos passwords against an external dictionary when a user changes passwords in a Kerberos KDC. It is roughly equivalent to checking password strength via CrackLib, except that it embeds a copy of Alec Muffett's CrackLib that has been modified to perform slightly more strenuous tests. It is usable as-is with Heimdal. With MIT Kerberos, it requires an included patch to libkadm5srv to support a dynamically loaded password check module. DESCRIPTION Heimdal includes a capability to plug in external password quality checks and comes with an example that checks passwords against CrackLib. However, in testing at Stanford, we found that CrackLib with its default transform rules does not catch passwords that can be guessed using the same dictionary with other tools, such as Jack the Ripper. The MIT Kerberos kadmind supports password strength checking against a dictionary out of the box. Unfortunately, that support loads the entire dictionary into memory, requires uncompressed dictionaries, and doesn't apply any transformations to the password before checking it against the dictionary. CrackLib provides more sophisticated strength checking and an optimized, compressed on-disk database format. This toolkit therefore provides the ability to check password quality against a modified version of CrackLib that only passes passwords that resist attacks from both Crack and Jack the Ripper using the same rule sets. For Heimdal, it includes both a program usable as an external password quality check and a plugin that implements the dynamic module API. For MIT Kerberos, it includes two pieces: * A patch to MIT Kerberos to add a plugin system for password strength checking. This patch adds initialization and shutdown hooks plus a hook that's run prior to each password change. The code in kadmind is independent of what the plugin might do. * A kadmind plugin that provides a wrapper around the included, slightly modified version of CrackLib. Currently, the embedded CrackLib is built unconditionally. In a future release, I hope to add support for building against an already-installed CrackLib if so desired (although built that way this package is only useful for MIT Kerberos, since Heimdal provides a similar facility as an example in the distribution). For information about the changes to the CrackLib included in this toolkit, see cracklib/HISTORY. They are minor changes to tighten the rules in some places, be stricter with longer passwords, fix portability issues, and remove some code that doesn't make sense in the kadmind context. My eventual hope is to submit to CrackLib 2.x modifications that allow the rule set to be configured at runtime, at which point this package can likely wither away in favor of much simpler plugins that link to the standard CrackLib library. REQUIREMENTS For Heimdal, this package is usable without any special considerations. You may use either the external password quality check tool, installed as heimdal-strength, or the plugin as you choose. It has been tested with Heimdal 1.2.1 and later. To use this plugin with MIT Kerberos, you will need to apply the patch in the patches directory to MIT Kerberos and rebuild. Due to how kadmind is constructed, the changes are actually in the libkadm5srv library, not in the kadmind binary, so you'll need to install the modified libraries. For this module to be effective for either Heimdal or MIT Kerberos, you will also need to construct a dictionary. The mkdict and packer utilities to build a CrackLib dictionary from a word list are included in this toolkit but not installed by default. You can run them out of the cracklib directory after building. You can also use the utilities that come with the stock CrackLib package (often already packaged in a Linux distribution); the database format is compatible. For a word list to use as source for the dictionary, you can use /usr/share/dict/words if it's available on your system, but it would be better to find a more comprehensive word list (or even better, find every word list you can locate on the Internet and combine them). Since word lists are bulky, often covered by murky copyrights, and easily locatable on the Internet with a modicum of searching, none are included in this toolkit. To bootstrap from a Git checkout, or If you change the Automake files and need to regenerate Makefile.in, you will need Automake 1.11 or later. For bootstrap or if you change configure.ac or any of the m4 files it includes and need to regenerate configure or config.h.in, you will need Autoconf 2.64 or later. COMPILING AND INSTALLING You can build and install the plugin with the standard commands: ./configure make make install The last step will probably have to be done as root. By default, the plugin is installed as /usr/local/lib/kadmind/passwd_strength.so and the Heimdal external password check function is installed as /usr/local/bin/heimdal-strength. You can change these paths with the --prefix, --libdir, and --bindir options to configure. For MIT Kerberos, you also have to apply the patch provided in the patches directory and install the new libkadm5srv library. See patches/README for more information about the patch. If you're using a different version of MIT Kerberos, you may need to adjust the patch accordingly. CONFIGURATION First, build and install a CrackLib dictionary as described above. This dictionary will consist of three files, one each ending in *.hwm, *.pwd, and *.pwi. Install those files somewhere on your system. Then, follow the relevant instructions below for either Heimdal or MIT Kerberos. Heimdal There are two options: using an external password check program, or using the plugin. I recommend the external password check program unless you encounter speed problems with that approach that cause kpasswd to time out. For either approach, first add a stanza like the following to the [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf file is located): krb5-strength = { password_dictionary = /usr/local/lib/kadmind/dictionary } The provided path should be the full path to the dictionary files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions. Then, for the external password checking program, add a new section (or modify the existing [password_quality] section) to look like the following: [password_quality] policies = external-check external_program = /usr/local/bin/heimdal-strength You can, of course, combine this policy with others. Replace the path with the full path to wherever you have installed heimdal-strength. You can put this section in your kdc.conf instead of krb5.conf if you prefer. If you want to instead use the module, use the following section instead: [password_quality] policies = krb5-strength policy_libraries = /usr/local/lib/kadmind/passwd_strength.so in either krb5.conf or kdc.conf. Note that some versions of Heimdal have a bug in the support for loading modules when policy_libraries is set. If you get an error like: didn't find `kadm5_password_verifier' symbol in `(null)' you may have to omit policy_libraries in your configuration and instead pass the --check-library argument to kpasswdd specifying the library to load. MIT Kerberos In the [realms] section of your kdc.conf, under the appropriate realm or realms, specify the path to the dictionary: dict_file = /path/to/cracklib/dictionary The provided path should be the full path to the dictionary files, omitting the trailing *.hwm, *.pwd, or *.pwi extension. Then, specify the path to the plugin by adding: pwcheck_plugin = /usr/local/lib/kadmind/passwd_strength.so to the same section of the kdc.conf, giving the correct full path to the plugin. Restart kadmind and password strength checking should be enabled. Be aware that, for MIT Kerberos, password strength checking is only applied to principals with a policy set. If you want to check all user passwords, assign all user principals a password policy. (Similarly, you can avoid checking the strength of passwords for particular principals by clearing their policy.) Also be aware that enabling this plugin will disable the normal kadmind dictionary check. There currently is no way to have them both enabled at the same time. Finally, note that the default rules of this plugin will reject the temporary password used by addprinc -randkey or ktadd -randkey when initializing a principal. When generating service principals using that flag, you will need to pass in the -clearpolicy flag as well to avoid rejecting the initial temporary password. You can then add a policy later with modprinc if desired.