KRB5-STRENGTH-WORDLIST(1)

NAME
krb5-strength-wordlist - Create a krb5-strength database from a word list

SYNOPSIS
krb5-strength-wordlist [-am] [-c output-cdb] [-l min-length]
    [-L max-length] [-o output-wordlist] [-s output-sqlite]
    [-x exclude ...] wordlist

DESCRIPTION
krb5-strength-wordlist converts a word list (a file containing one word per line) into a database that can be used by the krb5-strength plugin or heimdal-strength command for checking passwords. Two database formats are supported, with different features. CDB is more space-efficient and possibly faster, but supports checking passwords only against exact matches or simple transformations (removing small numbers of leading and trailing characters). SQLite creates a much larger database, but supports rejecting any password within edit distance one of a word in the word list.

CDB is a format invented by Dan Bernstein for fast, constant databases. The database is fixed during creation and cannot be changed without rebuilding it, and is optimized for very fast access. For cdb, the database generated by this program will have keys for each word in the word list and the constant 1 as the value.

SQLite stores the word list in a single table containing both each word and each word reversed. This allows the krb5-strength plugin or heimdal-strength command to reject passwords within edit distance one of any word in the word list. (Edit distance one means that the word list entry can be formed by changing a single character of the password, either by adding one character, removing one character, or changing one character to a different character.) However, the SQLite database will be much larger and lookups may be somewhat slower.

krb5-strength-wordlist takes one argument, the input word list file. Use the -c option to specify an output CDB file, -s to specify an output SQLite file, or -o to just filter the word list against the criteria given on the command line and generate a new word list. The input word list file does not have to be sorted. See the individual option descriptions for more information.

OPTIONS

-a, --ascii
    Filter all words that contain non-ASCII characters or control characters from the resulting cdb file, leaving only words that consist solely of ASCII non-control characters.

-c output-cdb, --cdb=output-cdb
    Create a CDB database in output-cdb. A temporary file named after output-cdb with ".data" appended will be created in the same directory and used to stage the database contents. The actual CDB file will be built using the cdb command, which must be on the user's path. If either file already exists, krb5-strength-wordlist will abort with an error.

    This option cannot be used with -o or -s.

-L maximum, --max-length=maximum
    Filter all words of length greater than maximum from the resulting cdb database. The length of each line (minus the separating newline) in the input word list will be checked against minimum and will be filtered out of the resulting database if it is shorter. Useful for generating password dictionaries from word lists that contain random noise that's highly unlikely to be used as a password.

    The default is to not filter out any words for maximum length.

-l minimum, --min-length=minimum
    Filter all words of length less than minimum from the resulting cdb database. The length of each line (minus the separating newline) in the input word list will be checked against minimum and will be filtered out of the resulting database if it is shorter. Useful for generating password dictionaries where shorter passwords will be rejected by a generic length check and no dictionary lookup will be done for a transform of the password shorter than the specified minimum.

    The default is not to filter out any words for minimum length.

-m, --man, --manual
    Print out this documentation (which is done simply by feeding the script to "perldoc -t").

-o wordlist, --output=wordlist
    Rather than creating a database, apply the filter rules given by the other command-line arguments and generate a new word list in the file name given by the wordlist option. This can be used to reduce the size of a raw word list file (such as one taken from Internet sources) by removing the words that will be filtered out of the dictionary anyway, thus reducing the size of the source required to regenerate the dictionary.

    This option cannot be used with -c or -s.

-s output-sqlite, --sqlite=output-sqlite
    Create a SQLite database in output-sqlite. If this file already exists, krb5-strength-wordlist will abort with an error. The resulting SQLite database will have one table, "passwords", with two columns, "password" and "drowssap". The first holds a word from the word list, and the second holds the same word reversed.

    Using this option requires the DBI and DBD::SQLite Perl modules be installed.

    This option cannot be used with -c or -o.

-x exclude, --exclude=exclude
    Filter all words matching the regular expression exclude from the resulting cdb database. This regular expression will be matched against each line of the source word list after the trailing newline is removed. This option may be given repeatedly to add multiple exclusion regexes.

AUTHOR
Russ Allbery <eagle@eyrie.org>

COPYRIGHT AND LICENSE
Copyright 2016, 2020, 2023 Russ Allbery <eagle@eyrie.org>

Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SPDX-License-Identifier: MIT

SEE ALSO
cdb(1), DBI, DBD::SQLite

The cdb file format is defined at <http://cr.yp.to/cdb.html>.

The current version of this program is available from its web page at <https://www.eyrie.org/~eagle/software/krb5-strength/> as part of the krb5-strength package.