]> eyrie.org Git - kerberos/krb5-strength.git/blob - README.md
Update util/xmalloc.c from rra-c-util
[kerberos/krb5-strength.git] / README.md
1 # krb5-strength
2
3 [![Build
4 status](https://github.com/rra/krb5-strength/workflows/build/badge.svg)](https://github.com/rra/krb5-strength/actions)
5 [![Debian
6 package](https://img.shields.io/debian/v/krb5-strength/unstable)](https://tracker.debian.org/pkg/krb5-strength)
7
8 Copyright 2016, 2020, 2023 Russ Allbery <eagle@eyrie.org>.  Copyright
9 2006-2007, 2009-2010, 2012-2014 The Board of Trustees of the Leland
10 Stanford Junior University.  Copyright 1993 Alec Muffett.  This software
11 is distributed under a BSD-style license.  Please see the section
12 [License](#license) below for more information.
13
14 ## Blurb
15
16 krb5-strength provides a password quality plugin for the MIT Kerberos KDC
17 (specifically the kadmind server) and Heimdal KDC, an external password
18 quality program for use with Heimdal, and a per-principal password history
19 implementation for Heimdal.  Passwords can be tested with CrackLib,
20 checked against a CDB or SQLite database of known weak passwords with some
21 transformations, checked for length, checked for non-printable or
22 non-ASCII characters that may be difficult to enter reproducibly, required
23 to contain particular character classes, or any combination of these
24 tests.
25
26 ## Description
27
28 Heimdal includes a capability to plug in external password quality checks
29 and comes with an example that checks passwords against CrackLib.
30 However, in testing at Stanford, we found that CrackLib with its default
31 transform rules does not catch passwords that can be guessed using the
32 same dictionary with other tools, such as Jack the Ripper.  We then
33 discovered other issues with CrackLib with longer passwords, such as some
34 bad assumptions about how certain measures of complexity will scale, and
35 wanted to impose other limitations that it didn't support.
36
37 This plugin provides the ability to check password quality against the
38 standard version of CrackLib, or against a modified version of CrackLib
39 that only passes passwords that resist attacks from both Crack and Jack
40 the Ripper using the same rule sets.  It also supports doing simpler
41 dictionary checks against a CDB database, which is fast with very large
42 dictionaries, or a SQLite database, which can reject all passwords within
43 edit distance one of a dictionary word.  It can also impose other
44 programmatic checks on passwords such as character class requirements.
45
46 If you're just now starting with password checking, I recommend using the
47 SQLite database with a large wordlist and minimum password lengths.  We
48 found this produced the best results with the least user frustration.
49
50 For Heimdal, krb5-strength includes both a program usable as an external
51 password quality check and a plugin that implements the dynamic module
52 API.  For MIT Kerberos (1.9 or later), it includes a plugin for the
53 password quality (pwqual) plugin API.
54
55 krb5-strength can be built with either the system CrackLib or with the
56 modified version of CrackLib included in this package.  Note, however,
57 that if you're building against the system CrackLib, Heimdal includes in
58 the distribution a strength-checking plugin and an external password check
59 program that use the system CrackLib.  With Heimdal, it would probably be
60 easier to use that plugin or program than build this package unless you
61 want the modified CrackLib, one of the other dictionary types, or the
62 additional character class and length checks.
63
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 also
69 minor changes to fix portability issues, remove some code that doesn't
70 make sense in the kadmind context, and close a few security issues.  The
71 standard CrackLib distribution on at least some Linux distributions now
72 supports an additional interface to configure its behavior, and
73 krb5-strength should change in the future to use that interface and drop
74 the embedded copy.
75
76 krb5-strength also includes a password history implementation for Heimdal.
77 This is separate from the password strength implementation but can be
78 stacked with it so that both strength and history checks are performed.
79 This history implementation is available only via the Heimdal external
80 password quality interface.  MIT Kerberos includes its own password
81 history implementation.
82
83 ## Requirements
84
85 For Heimdal, you may use either the external password quality check tool,
86 installed as heimdal-strength, or the plugin as you choose.  It has been
87 tested with Heimdal 1.2.1 and later, but has not recently been tested with
88 versions prior to 7.0.
89
90 For MIT Kerberos, version 1.9 or higher is required for the password
91 quality plugin interface.  MIT Kerberos does not support an external
92 password quality check tool directly, so you will need to install the
93 plugin.
94
95 You can optionally build against the system CrackLib library.  Any version
96 should be supported, but note that some versions, particularly older
97 versions close to the original code, do things like printing diagnostics
98 to stderr, calling exit, and otherwise not being well-behaved for use
99 inside plugins or libraries.  They also have known security
100 vulnerabilities.  If using a system CrackLib library, use version 2.8.22
101 or later to avoid these problems.
102
103 You can also optionally build against the TinyCDB library, which provides
104 support for simpler and faster password checking against a CDB dictionary
105 file, and the SQLite library (a version new enough to support the
106 `sqlite3_open_v2` API; 3.7 should be more than sufficient), which provides
107 support for checking whether passwords are within edit distance one of a
108 dictionary word.
109
110 For this module to be effective for either Heimdal or MIT Kerberos, you
111 will also need to construct a dictionary.  The `mkdict` and `packer`
112 utilities to build a CrackLib dictionary from a word list are included in
113 this toolkit but not installed by default.  You can run them out of the
114 `cracklib` directory after building.  You can also use the utilities that
115 come with the stock CrackLib package (often already packaged in a Linux
116 distribution); the database format is compatible.
117
118 For building a CDB or SQLite dictionary, use the provided
119 `krb5-strength-wordlist` program.  For CDB dictionries, the `cdb` utility
120 must be on your `PATH`.  For SQLite, the DBI and DBD::SQLite Perl modules
121 are required.  `krb5-strength-wordlist` requires Perl 5.010 or later.
122
123 For a word list to use as source for the dictionary, you can use
124 `/usr/share/dict/words` if it's available on your system, but it would be
125 better to find a more comprehensive word list.  Since word lists are
126 bulky, often covered by murky copyrights, and easily locatable on the
127 Internet with a modicum of searching, none are included in this toolkit.
128
129 The password history program, heimdal-history, requires Perl 5.010 or
130 later plus the following CPAN modules:
131
132 * Const::Fast
133 * Crypt::PBKDF2
134 * DB_File::Lock
135 * Getopt::Long::Descriptive
136 * IPC::Run
137 * JSON::MaybeXS
138
139 and their dependencies.
140
141 To bootstrap from a Git checkout, or if you change the Automake files and
142 need to regenerate Makefile.in, you will need Automake 1.11 or later.  For
143 bootstrap or if you change configure.ac or any of the m4 files it includes
144 and need to regenerate configure or config.h.in, you will need Autoconf
145 2.64 or later.  Perl is also required to generate manual pages from a
146 fresh Git checkout.  You will also need Perl 5.010 or later and the
147 Const::Fast, DBI, DBD::SQLite, JSON::MaybeXS, and Perl6::Slurp modules
148 (from CPAN) to bootstrap the test suite data from a Git checkout.
149
150 ## Building and Installation
151
152 You can build and install krb5-strength with the standard commands:
153
154 ```
155     ./configure
156     make
157     make install
158 ```
159
160 If you are building from a Git clone, first run `./bootstrap` in the
161 source directory to generate the build files.  `make install` will
162 probably have to be done as root.  Building outside of the source
163 directory is also supported, if you wish, by creating an empty directory
164 and then running configure with the correct relative path.
165
166 By default, the Heimdal external password check function is installed as
167 `/usr/local/bin/heimdal-strength`, and the plugin is installed as
168 `/usr/local/lib/krb5/plugins/pwqual/strength.so`.  You can change these
169 paths with the `--prefix`, `--libdir`, and `--bindir` options to
170 `configure`.
171
172 By default, the embedded version of CrackLib will be used.  To build with
173 the system version of CrackLib, pass `--with-cracklib` to `configure`.
174 You can optionally add a directory, giving the root directory where
175 CrackLib was installed, or separately set the include and library path
176 with `--with-cracklib-include` and `--with-cracklib-lib`.  You can also
177 build without any CrackLib support by passing `--without-cracklib` to
178 `configure`.
179
180 krb5-strength will automatically build with TinyCDB if it is found.  To
181 specify the installation path of TinyCDB, use `--with-tinycdb`.  You can
182 also separately set the include and library path with
183 `--with-tinycdb-include` and `--with-tinycdb-lib`.
184
185 Similarly, krb5-strength will automatically build with SQLite if it is
186 found.  To specify the installation path of SQLite, use `--with-sqlite`.
187 You can also separately set the include and library path with
188 `--with-sqlite-include` and `--with-sqlite-lib`.
189
190 Normally, configure will use `krb5-config` to determine the flags to use
191 to compile with your Kerberos libraries.  To specify a particular
192 `krb5-config` script to use, either set the `PATH_KRB5_CONFIG` environment
193 variable or pass it to configure like:
194
195 ```
196     ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
197 ```
198
199 If `krb5-config` isn't found, configure will look for the standard
200 Kerberos libraries in locations already searched by your compiler.  If the
201 the `krb5-config` script first in your path is not the one corresponding
202 to the Kerberos libraries you want to use, or if your Kerberos libraries
203 and includes aren't in a location searched by default by your compiler,
204 you need to specify a different Kerberos installation root via
205 `--with-krb5=PATH`.  For example:
206
207 ```
208     ./configure --with-krb5=/usr/pubsw
209 ```
210
211 You can also individually set the paths to the include directory and the
212 library directory with `--with-krb5-include` and `--with-krb5-lib`.  You
213 may need to do this if Autoconf can't figure out whether to use `lib`,
214 `lib32`, or `lib64` on your platform.
215
216 To not use `krb5-config` and force library probing even if there is a
217 `krb5-config` script on your path, set `PATH_KRB5_CONFIG` to a nonexistent
218 path:
219
220 ```
221     ./configure PATH_KRB5_CONFIG=/nonexistent
222 ```
223
224 `krb5-config` is not used and library probing is always done if either
225 `--with-krb5-include` or `--with-krb5-lib` are given.
226
227 Pass `--enable-silent-rules` to configure for a quieter build (similar to
228 the Linux kernel).  Use `make warnings` instead of `make` to build with
229 full GCC compiler warnings (requires either GCC or Clang and may require a
230 relatively current version of the compiler).
231
232 You can pass the `--enable-reduced-depends` flag to configure to try to
233 minimize the shared library dependencies encoded in the binaries.  This
234 omits from the link line all the libraries included solely because other
235 libraries depend on them and instead links the programs only against
236 libraries whose APIs are called directly.  This will only work with shared
237 libraries and will only work on platforms where shared libraries properly
238 encode their own dependencies (this includes most modern platforms such as
239 all Linux).  It is intended primarily for building packages for Linux
240 distributions to avoid encoding unnecessary shared library dependencies
241 that make shared library migrations more difficult.  If none of the above
242 made any sense to you, don't bother with this flag.
243
244 After installing this software, see the man pages for krb5-strength,
245 heimdal-strength, and heimdal-history for configuration information.
246
247 ## Testing
248
249 krb5-strength comes with a test suite, which you can run after building
250 with:
251
252 ```
253     make check
254 ```
255
256 If a test fails, you can run a single test with verbose output via:
257
258 ```
259     tests/runtests -o <name-of-test>
260 ```
261
262 Do this instead of running the test program directly since it will ensure
263 that necessary environment variables are set up.
264
265 To run the test suite, you will need Perl 5.010 or later and the
266 dependencies of the `heimdal-history` program.  The following additional
267 Perl modules will also be used by the test suite if present:
268
269 * Perl6::Slurp
270 * Test::MinimumVersion
271 * Test::Perl::Critic
272 * Test::Pod
273 * Test::Spelling
274 * Test::Strict
275
276 All are available on CPAN.  Some tests will be skipped if the modules are
277 not available.
278
279 To enable tests that don't detect functionality problems but are used to
280 sanity-check the release, set the environment variable `RELEASE_TESTING`
281 to a true value.  To enable tests that may be sensitive to the local
282 environment or that produce a lot of false positives without uncovering
283 many problems, set the environment variable `AUTHOR_TESTING` to a true
284 value.
285
286 ## Support
287
288 The [krb5-strength web
289 page](https://www.eyrie.org/~eagle/software/krb5-strength/) will always
290 have the current version of this package, the current documentation, and
291 pointers to any additional resources.
292
293 For bug tracking, use the [issue tracker on
294 GitHub](https://github.com/rra/krb5-strength/issues).  However, please be
295 aware that I tend to be extremely busy and work projects often take
296 priority.  I'll save your report and get to it as soon as I can, but it
297 may take me a couple of months.
298
299 ## Source Repository
300
301 krb5-strength is maintained using Git.  You can access the current source
302 on [GitHub](https://github.com/rra/krb5-strength) or by cloning the
303 repository at:
304
305 https://git.eyrie.org/git/kerberos/krb5-strength.git
306
307 or [view the repository on the
308 web](https://git.eyrie.org/?p=kerberos/krb5-strength.git).
309
310 The eyrie.org repository is the canonical one, maintained by the author,
311 but using GitHub is probably more convenient for most purposes.  Pull
312 requests are gratefully reviewed and normally accepted.
313
314 ## License
315
316 The krb5-strength package as a whole is covered by the following copyright
317 statement and license:
318
319 > Copyright 2016, 2020, 2023
320 >     Russ Allbery <eagle@eyrie.org>
321 >
322 > Copyright 2006-2007, 2009-2010, 2012-2014
323 >     The Board of Trustees of the Leland Stanford Junior University
324 >
325 > Copyright 1993
326 >     Alec Muffett
327 >
328 > Permission is hereby granted, free of charge, to any person obtaining a
329 > copy of this software and associated documentation files (the "Software"),
330 > to deal in the Software without restriction, including without limitation
331 > the rights to use, copy, modify, merge, publish, distribute, sublicense,
332 > and/or sell copies of the Software, and to permit persons to whom the
333 > Software is furnished to do so, subject to the following conditions:
334 >
335 > The above copyright notice and this permission notice shall be included in
336 > all copies or substantial portions of the Software.
337 >
338 > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
339 > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
340 > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
341 > THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
342 > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
343 > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
344 > DEALINGS IN THE SOFTWARE.
345 >
346 > Developed by Daria Phoebe Brashear and Ken Hornstein of Sine Nomine
347 > Associates, on behalf of Stanford University.
348 >
349 > The embedded version of CrackLib (all files in the `cracklib`
350 > subdirectory) is covered by the Artistic license.  See the file
351 > `cracklib/LICENCE` for more information.  Combined derivative works that
352 > include this code, such as binaries built with the embedded CrackLib, will
353 > need to follow the terms of the Artistic license as well as the above
354 > license.
355
356 Some files in this distribution are individually released under different
357 licenses, all of which are compatible with the above general package
358 license but which may require preservation of additional notices.  All
359 required notices, and detailed information about the licensing of each
360 file, are recorded in the LICENSE file.
361
362 Files covered by a license with an assigned SPDX License Identifier
363 include SPDX-License-Identifier tags to enable automated processing of
364 license information.  See https://spdx.org/licenses/ for more information.
365
366 For any copyright range specified by files in this package as YYYY-ZZZZ,
367 the range specifies every single year in that closed interval.