krb5-strength 1.1 (kadmind password strength checking plugin) Maintained by Russ Allbery Copyright 2006, 2007, 2009, 2010, 2012 The Board of Trustees of the Leland Stanford Junior 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 the standard version of CrackLib, or 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 libkadm5srv or Heimdal kpasswdd plugin that provides a wrapper around CrackLib. krb5-strength can be built with either the system CrackLib or with the modified version of CrackLib included in this package. Note, however, that if you're building against the system CrackLib, Heimdal includes in the distribution a strength-checking plugin and an external password check program that use the system CrackLib. With Heimdal, it would probably be easier to use that plugin or program than build this package unless you want the modified CrackLib. For information about the changes to the CrackLib included in this toolkit, see cracklib/HISTORY. The primary changes are tighter rules, which are more aggressive at finding dictionary words with characters appended and prepended, which tighten the requirements for password entropy, and which add stricter rules for longer passwords. They are also minor changes to 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. You can optionally build against the system CrackLib library. Any version should be supported, but note that some versions, particularly older versions close to the original code, do things like printing diagnostics to stderr, calling exit, and otherwise not being well-behaved for use inside plugins or 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 Pass --enable-silent-rules to configure for a quieter build (similar to the Linux kernel). Use make warnings instead of make to build with full GCC compiler warnings (requires a relatively current version of GCC). 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 to the MIT Kerberos source 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. To build with the system version of CrackLib, pass --with-cracklib to configure. You can optionally add a directory, giving the root directory where CrackLib was installed, or separately set the include and library path with --with-cracklib-include and --with-cracklib-lib. Normally, configure will use krb5-config to determine the flags to use to compile with your Kerberos libraries. If krb5-config isn't found, it will look for the standard Kerberos libraries in locations already searched by your compiler. If the the krb5-config script first in your path is not the one corresponding to the Kerberos libraries you want to use or if your Kerberos libraries and includes aren't in a location searched by default by your compiler, you need to specify a different Kerberos installation root via --with-krb5=PATH. For example: ./configure --with-krb5=/usr/pubsw You can also individually set the paths to the include directory and the library directory with --with-krb5-include and --with-krb5-lib. You may need to do this if Autoconf can't figure out whether to use lib, lib32, or lib64 on your platform. Note that these settings aren't used if a krb5-config script is found, so you may need to disable the krb5-config script as described below. To specify a particular krb5-config script to use, either set the PATH_KRB5_CONFIG environment variable or pass it to configure like: ./configure PATH_KRB5_CONFIG=/path/to/krb5-config To not use krb5-config and force library probing even if there is a krb5-config script on your path, set PATH_KRB5_CONFIG to a nonexistent path: ./configure KRB5_CONFIG=/nonexistent You can pass the --enable-reduced-depends flag to configure to try to minimize the shared library dependencies encoded in the binaries. This omits from the link line all the libraries included solely because the Kerberos libraries depend on them and instead links the programs only against libraries whose APIs are called directly. This will only work with shared Kerberos libraries and will only work on platforms where shared libraries properly encode their own dependencies (such as Linux). It is intended primarily for building packages for Linux distributions to avoid encoding unnecessary shared library dependencies that make shared library migrations more difficult. If none of the above made any sense to you, don't bother with this flag. 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.