]> eyrie.org Git - kerberos/krb5-strength.git/blob - README
In CDB checks, check all passwords within edit distance one
[kerberos/krb5-strength.git] / README
1                             krb5-strength 2.2
2                (Kerberos password strength checking plugin)
3
4                Maintained by Russ Allbery <eagle@eyrie.org>
5
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.
12
13 BLURB
14
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 password history implementation for
18   use with Heimdal.  Passwords can be tested with CrackLib, checked
19   against a CDB database of known weak passwords, checked for length,
20   checked for non-printable or non-ASCII characters that may be difficult
21   to enter reproducibly, required to contain particular character classes,
22   or any combination of these tests.  It supports both Heimdal and MIT
23   Kerberos (1.9 or later).
24
25 DESCRIPTION
26
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.
35
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, and imposing other programmatic checks on passwords such
42   as character class requirements.
43
44   For Heimdal, it includes both a program usable as an external password
45   quality check and a plugin that implements the dynamic module API.  For
46   MIT Kerberos (1.9 or later), it includes a plugin for the password
47   quality (pwqual) plugin API.
48
49   krb5-strength can be built with either the system CrackLib or with the
50   modified version of CrackLib included in this package.  Note, however,
51   that if you're building against the system CrackLib, Heimdal includes in
52   the distribution a strength-checking plugin and an external password
53   check program that use the system CrackLib.  With Heimdal, it would
54   probably be easier to use that plugin or program than build this package
55   unless you want the modified CrackLib.
56
57   For information about the changes to the CrackLib included in this
58   toolkit, see cracklib/HISTORY.  The primary changes are tighter rules,
59   which are more aggressive at finding dictionary words with characters
60   appended and prepended, which tighten the requirements for password
61   entropy, and which add stricter rules for longer passwords.  They are
62   also minor changes to fix portability issues and remove some code that
63   doesn't make sense in the kadmind context.
64
65   Ideally, the changes to CrackLib should be added to the standard
66   CrackLib distribution by adding an additional interface to configure its
67   behavior, at which point this package can likely wither away in favor of
68   much simpler plugins that link to the standard CrackLib library.
69
70   krb5-strength also includes a password history implementation for
71   Heimdal.  This is separate from the password strength implementation but
72   can be stacked with it so that both strength and history checks are
73   performed.  This history implementation is available only via the
74   Heimdal external password quality interface.  MIT Kerberos includes its
75   own password history implementation.
76
77 REQUIREMENTS
78
79   For Heimdal, you may use either the external password quality check
80   tool, installed as heimdal-strength, or the plugin as you choose.  It
81   has been tested with Heimdal 1.2.1 and later, but has not recently been
82   tested with versions prior to 1.5.
83
84   For MIT Kerberos, version 1.9 or higher is required for the password
85   quality plugin interface.  MIT Kerberos does not support an external
86   password quality check tool directly, so you will need to install the
87   plugin.
88
89   You can optionally build against the system CrackLib library.  Any
90   version should be supported, but note that some versions, particularly
91   older versions close to the original code, do things like printing
92   diagnostics to stderr, calling exit, and otherwise not being
93   well-behaved for use inside plugins or libraries.  If using a system
94   CrackLib library, use version 2.8.22 or later to avoid these problems.
95
96   You can also optionally build against the TinyCDB library, which
97   provides support for simpler and faster password checking against a CDB
98   dictionary file.
99
100   For this module to be effective for either Heimdal or MIT Kerberos, you
101   will also need to construct a dictionary.  The mkdict and packer
102   utilities to build a CrackLib dictionary from a word list are included
103   in this toolkit but not installed by default.  You can run them out of
104   the cracklib directory after building.  You can also use the utilities
105   that come with the stock CrackLib package (often already packaged in a
106   Linux distribution); the database format is compatible.
107
108   For building a CDB dictionary, use the provided cdbmake-wordlist
109   program.  The CDB utility must be on your PATH.  cdbmake-wordlist
110   requires Perl 5.006 or later.
111
112   For a word list to use as source for the dictionary, you can use
113   /usr/share/dict/words if it's available on your system, but it would be
114   better to find a more comprehensive word list.  Since word lists are
115   bulky, often covered by murky copyrights, and easily locatable on the
116   Internet with a modicum of searching, none are included in this toolkit.
117
118   The password history program, heimdal-history, requires Perl 5.010 or
119   later plus the following CPAN modules:
120
121       DB_File::Lock
122       Crypt::PBKDF2
123       Getopt::Long::Descriptive
124       IPC::Run
125       JSON
126       Readonly
127
128   and their dependencies.
129
130   To run the test suite, you will need Perl 5.010 or later and the
131   dependencies of the heimdal-history program.  The following additional
132   Perl modules will be used by the test suite if present:
133
134       Perl6::Slurp
135       Test::MinimumVersion
136       Test::Perl::Critic
137       Test::Pod
138       Test::Spelling
139       Test::Strict
140
141   All are available on CPAN.  Those tests will be skipped if the modules
142   are not available.
143
144   To enable tests that may be sensitive to the local environment or that
145   produce a lot of false positives without uncovering many problems, set
146   RRA_MAINTAINER_TESTS to a true value.
147
148   To bootstrap from a Git checkout, or If you change the Automake files
149   and need to regenerate Makefile.in, you will need Automake 1.11 or
150   later.  For bootstrap or if you change configure.ac or any of the m4
151   files it includes and need to regenerate configure or config.h.in, you
152   will need Autoconf 2.64 or later.  You will also need Perl 5.010 or
153   later and the JSON, Perl6::Slurp, and Readonly modules (from CPAN) to
154   bootstrap the test suite data from a Git checkout.
155
156 COMPILING AND INSTALLING
157
158   You can build and install the plugin with the standard commands:
159
160       ./configure
161       make
162       make install
163
164   Pass --enable-silent-rules to configure for a quieter build (similar to
165   the Linux kernel).  Use make warnings instead of make to build with full
166   GCC compiler warnings (requires a relatively current version of GCC).
167
168   The last step will probably have to be done as root.  By default, the
169   plugin is installed as /usr/local/lib/krb5/plugins/pwqual/strength.so
170   and the Heimdal external password check function is installed as
171   /usr/local/bin/heimdal-strength.  You can change these paths with the
172   --prefix, --libdir, and --bindir options to configure.
173
174   To build with the system version of CrackLib, pass --with-cracklib to
175   configure.  You can optionally add a directory, giving the root
176   directory where CrackLib was installed, or separately set the include
177   and library path with --with-cracklib-include and --with-cracklib-lib.
178
179   krb5-strength will automatically build with TinyCDB if it is found.  To
180   specify the installation path of TinyCDB, use --with-tinycdb.  You can
181   also separately set the include and library path with
182   --with-tinycdb-include and --with-tinycdb-lib.
183
184   Normally, configure will use krb5-config to determine the flags to use
185   to compile with your Kerberos libraries.  If krb5-config isn't found, it
186   will look for the standard Kerberos libraries in locations already
187   searched by your compiler.  If the the krb5-config script first in your
188   path is not the one corresponding to the Kerberos libraries you want to
189   use or if your Kerberos libraries and includes aren't in a location
190   searched by default by your compiler, you need to specify a different
191   Kerberos installation root via --with-krb5=PATH.  For example:
192
193       ./configure --with-krb5=/usr/pubsw
194
195   You can also individually set the paths to the include directory and the
196   library directory with --with-krb5-include and --with-krb5-lib.  You may
197   need to do this if Autoconf can't figure out whether to use lib, lib32,
198   or lib64 on your platform.
199
200   To specify a particular krb5-config script to use, either set the
201   PATH_KRB5_CONFIG environment variable or pass it to configure like:
202
203       ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
204
205   To not use krb5-config and force library probing even if there is a
206   krb5-config script on your path, set PATH_KRB5_CONFIG to a nonexistent
207   path:
208
209       ./configure PATH_KRB5_CONFIG=/nonexistent
210
211   krb5-config is not used and library probing is always done if either
212   --with-krb5-include or --with-krb5-lib are given.
213
214   You can pass the --enable-reduced-depends flag to configure to try to
215   minimize the shared library dependencies encoded in the binaries.  This
216   omits from the link line all the libraries included solely because the
217   Kerberos libraries depend on them and instead links the programs only
218   against libraries whose APIs are called directly.  This will only work
219   with shared Kerberos libraries and will only work on platforms where
220   shared libraries properly encode their own dependencies (such as Linux).
221   It is intended primarily for building packages for Linux distributions
222   to avoid encoding unnecessary shared library dependencies that make
223   shared library migrations more difficult.  If none of the above made any
224   sense to you, don't bother with this flag.
225
226 CONFIGURATION
227
228   First, build and install either a CrackLib dictionary as described in
229   REQUIREMENTS above, or build a CDB dictionary with cdbmake-wordlist.
230   (Or both.)  The CrackLib dictionary will consist of three files, one
231   each ending in *.hwm, *.pwd, and *.pwi.  The CDB dictionary will consist
232   of a single file ending in *.cdb.  Install those files somewhere on your
233   system.  Then, follow the relevant instructions below for either Heimdal
234   or MIT Kerberos.
235
236   See "Other Settings" below for additional krb5.conf setting supported by
237   both Heimdal and MIT Kerberos.
238
239  Heimdal
240
241   There are two options: using an external password check program, or
242   using the plugin.  I recommend the external password check program
243   unless you encounter speed problems with that approach that cause
244   kpasswd to time out.
245
246   For either approach, first add a stanza like the following to the
247   [appdefaults] section of your /etc/krb5.conf (or wherever your krb5.conf
248   file is located):
249
250       krb5-strength = {
251           password_dictionary     = /path/to/cracklib/dictionary
252           password_dictionary_cdb = /path/to/cdb/dictionary.cdb
253       }
254
255   The first setting configures a CrackLib dictionary and the second a CDB
256   dictionary.  The provided path should be the full path to the dictionary
257   files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
258   CrackLib dictionary.  You can use either or both settings.  If you use
259   both, CrackLib will be checked first, and then CDB.  When checking a CDB
260   database, the password, all printable ASCII passwords within edit
261   distance one of the password, and the password with the first and last
262   characters removed, the first two characters removed, and the last two
263   characters removed will all be checked against the dictionary.
264
265   Then, for the external password checking program, add a new section (or
266   modify the existing [password_quality] section) to look like the
267   following:
268
269       [password_quality]
270           policies         = external-check
271           external_program = /usr/local/bin/heimdal-strength
272
273   You can, of course, combine this policy with others.  Replace the path
274   with the full path to wherever you have installed heimdal-strength.  You
275   can put this section in your kdc.conf instead of krb5.conf if you
276   prefer.
277
278   If you want to instead use the module, use the following section
279   instead:
280
281       [password_quality]
282           policies         = krb5-strength
283           policy_libraries = /usr/local/lib/krb5/plugins/pwqual/strength.so
284
285   in either krb5.conf or kdc.conf.  Note that some older versions of
286   Heimdal have a bug in the support for loading modules when
287   policy_libraries is set.  If you get an error like:
288
289       didn't find `kadm5_password_verifier' symbol in `(null)'
290
291   you may have to omit policy_libraries in your configuration and instead
292   pass the --check-library argument to kpasswdd specifying the library to
293   load.
294
295   Additional configuration is required to use the history implementation.
296   Ensure that its dependencies are installed, and then examine the local
297   configuration settings at the top of the heimdal-history program.  By
298   default, it requires a _history user and _history group be present on
299   the system, and all history information will be read and written as that
300   user and group.  It also requires a nobody user and nogroup group to be
301   present, and all strength checking will be done as that user and group.
302   It uses various files in /var/lib/heimdal-history to store history and
303   statistical information by default, so if using the defaults, create
304   that directory and ensure it is writable by the _history user.
305
306   Once that setup is done, change your [password_quality] configuration
307   to:
308
309       [password_quality]
310           policies         = external-check
311           external_program = /usr/local/bin/heimdal-history
312
313   The heimdal-history program will automatically also run heimdal-strength
314   as well, looking for it in /usr/local/bin, /usr/bin, and /bin.  Change
315   the PATH setting at the top of the script if you have different
316   requirements.  You should continue to configure heimdal-strength as if
317   you were running it directly.
318
319  MIT Kerberos
320
321   To add this module to the list of password quality checks, add a section
322   to krb5.conf (or to a separate kdc.conf if you use that) like:
323
324       [plugins]
325           pwqual = {
326               module = strength:/usr/local/lib/krb5/plugins/pwqual/strength.so
327           }
328
329   to register the plugin.
330
331   There are two ways to tell where the dictionary is.  One option is to
332   use krb5.conf (and in this case you must use krb5.conf, even if you use
333   a separate kdc.conf file).  For this approach, add the following to the
334   [appdefaults] section:
335
336       krb5-strength = {
337           password_dictionary     = /path/to/cracklib/dictionary
338           password_dictionary_cdb = /path/to/cdb/dictionary.cdb
339       }
340
341   The first setting configures a CrackLib dictionary and the second a CDB
342   dictionary.  The provided path should be the full path to the dictionary
343   files, omitting the trailing *.hwm, *.pwd, and *.pwi extensions for the
344   CrackLib dictionary.  You can use either or both settings.  If you use
345   both, CrackLib will be checked first, and then CDB.  When checking a CDB
346   database, the password, all printable ASCII passwords within edit
347   distance one of the password, and the password with the first and last
348   characters removed, the first two characters removed, and the last two
349   characters removed will all be checked against the dictionary.
350
351   The second option is to use the normal dict_path setting.  In the
352   [realms] section of your krb5.conf kdc.conf, under the appropriate realm
353   or realms, specify the path to the dictionary:
354
355       dict_file = /path/to/cracklib/dictionary
356
357   This will be taken as a CrackLib dictionary path, the same as the
358   setting for password_dictionary above.  The provided path should be the
359   full path to the dictionary files, omitting the trailing *.hwm, *.pwd,
360   or *.pwi extension.  However, be aware that, if you use this approach,
361   you will probably want to disable the built-in standard dict pwqual
362   plugin by adding the line:
363
364       disable = dict
365
366   to the pwqual block of the [plugins] section as shown above.  Otherwise,
367   it will also try to load a dictionary at the same path to do simple
368   dictionary matching.
369
370   You can also mix and match these settings, by using dict_path for the
371   CrackLib dictionary path and krb5.conf for the CDB dictionary path.  If
372   both settings are used, krb5.conf overrides the dict_path setting (so
373   that dict_path can be used for other password quality modules).  There
374   is no way to specify a CDB dictionary via the dict_path setting.
375
376  Other Settings
377
378   The following additional settings are supported in the [appdefaults]
379   section of krb5.conf when running under either Heimdal or MIT Kerberos.
380
381   minimum_length
382
383       If set to a numeric value, passwords with fewer than that number of
384       characters will be rejected, independent of any length restrictions
385       in CrackLib.  Note that this setting does not bypass the minimum
386       length requirements in CrackLib itself (which, for the version
387       embedded in this package, is eight characters).
388
389   require_ascii_printable
390
391       If set to a true boolean value, rejects any password that contains
392       non-ASCII characters or ASCII control characters.  Spaces are
393       allowed; tabs are not (at least assuming the POSIX C locale).  No
394       canonicalization or character set is defined for Kerberos passwords
395       in general, so you may want to reject non-ASCII characters to avoid
396       interoperability problems with computers with different default
397       character sets or Unicode normalization forms.  Also be aware that,
398       when testing passwords within edit distance one against a CDB
399       database, only characters in the printable ASCII character set will
400       be attempted.
401
402   require_classes
403
404       This option allows specification of more complex character class
405       requirements.  The value of this parameter should be one or more
406       whitespace-separated rule.  Each rule has the syntax:
407
408           [<min>-<max>:]<class>[,<class>...]
409
410       where <class> is one of "upper", "lower", "digit", or "symbol"
411       (without the quote marks).  The symbol class includes all characters
412       other than alphanumeric characters, including space.  The listed
413       classes must appear in the password.  Separate multiple required
414       classes with a comma (and no space).
415
416       The character class checks will be done in whatever locale the
417       plugin or password check program is run in, which will normally be
418       the POSIX C locale but may be different depending on local
419       configuration.
420
421       A simple example:
422
423           require_classes = upper,lower,digit
424
425       This requires all passwords contain at least one uppercase letter,
426       at least one lowercase letter, and at least one digit.
427
428       If present, <min> and <max> specify the minimum password length and
429       maximum password length to which this rule applies.  This allows one
430       to specify character class requirements that change with password
431       length.  So, for example:
432
433           require_classes = 8-19:upper,lower 8-15:digit 8-11:symbol
434
435       requires all passwords from 8 to 11 characters long contain all four
436       character classes, passwords from 12 to 15 characters long contain
437       upper and lower case and a digit, and passwords from 16 to 19
438       characters long contain both upper and lower case.  Passowrds longer
439       than 20 characters have no character class restrictions.  (This
440       example is probably used in conjunction with minimum_length = 8.)
441
442   require_non_letter
443
444       If set to a true boolean value, the password must contain at least
445       one character that is not a letter (uppercase or lowercase) or a
446       space.  This may be helpful in combination with passphrases; users
447       may choose a stock English phrase, and this will force at least some
448       additional complexity.
449
450   You can omit any dictionary setting and only use the above settings, in
451   which case only the above checks and checks for passwords based on the
452   principal will be done, bypassing any dictionary check.  (But for that
453   simple style of password strength checking, there are probably better
454   strength checking plugins already available.)
455
456 SUPPORT
457
458   The krb5-strength web page at:
459
460       http://www.eyrie.org/~eagle/software/krb5-strength/
461
462   will always have the current version of this package, the current
463   documentation, and pointers to any additional resources.
464
465   I welcome bug reports and patches for this package at eagle@eyrie.org.
466   However, please be aware that I tend to be extremely busy and work
467   projects often take priority.  I'll save your mail and get to it as soon
468   as I can, but it may take me a couple of months.
469
470 SOURCE REPOSITORY
471
472   krb5-strength is maintained using Git.  You can access the current
473   source by cloning the repository at:
474
475       git://git.eyrie.org/kerberos/krb5-strength.git
476
477   or view the repository via the web at:
478
479       http://git.eyrie.org/?p=kerberos/krb5-strength.git
480
481   When contributing modifications, either patches (possibly generated by
482   git format-patch) or Git pull requests are welcome.
483
484 LICENSE
485
486   The krb5-strength package as a whole is covered by the following
487   copyright statement and license:
488
489     Copyright 2006, 2007, 2009, 2010, 2012, 2013, 2014
490         The Board of Trustees of the Leland Stanford Junior University
491
492     Permission is hereby granted, free of charge, to any person obtaining
493     a copy of this software and associated documentation files (the
494     "Software"), to deal in the Software without restriction, including
495     without limitation the rights to use, copy, modify, merge, publish,
496     distribute, sublicense, and/or sell copies of the Software, and to
497     permit persons to whom the Software is furnished to do so, subject to
498     the following conditions:
499
500     The above copyright notice and this permission notice shall be
501     included in all copies or substantial portions of the Software.
502
503     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
504     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
505     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
506     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
507     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
508     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
509     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
510
511   The embedded version of CrackLib (all files in the cracklib
512   subdirectory) is covered by the Artistic license.  See the file
513   cracklib/LICENCE for more information.  Combined derivative works that
514   include this code, such as binaries built with the embedded CrackLib,
515   will need to follow the terms of the Artistic license as well as the
516   above license.
517
518   All other individual files without an explicit exception below are
519   released under this license.  Some files may have additional copyright
520   holders as noted in those files.  There is detailed information about
521   the licensing of each file in the LICENSE file in this distribution.
522
523   Some files in this distribution are individually released under
524   different licenses, all of which are compatible with the above general
525   package license but which may require preservation of additional
526   notices.  All required notices are preserved in the LICENSE file.