3 # Password history via Heimdal external strength checking.
5 # This script is meant to be called via the Heimdal external password strength
6 # checking interface and maintains per-user password history. Password
7 # history is stored as Crypt::PBKDF2 hashes with random salt for each
10 ##############################################################################
11 # Declarations and configuration
12 ##############################################################################
21 use Fcntl qw(O_CREAT O_RDWR);
22 use File::Basename qw(basename);
23 use Getopt::Long::Descriptive qw(describe_options);
25 use JSON qw(encode_json decode_json);
26 use POSIX qw(setgid setuid);
28 use Sys::Syslog qw(openlog syslog LOG_AUTH LOG_INFO LOG_WARNING);
30 # The most convenient interface to Berkeley DB files is ties.
31 ## no critic (Miscellanea::ProhibitTies)
33 # The number of PBKDF2 iterations to use when hashing passwords. This number
34 # should be chosen so as to force the hash operation to take approximately 0.1
35 # seconds on current hardware.
36 Readonly my $HASH_ITERATIONS => 14592;
38 # Path to the history database. Currently, this must be a Berkeley DB file in
39 # the old DB_HASH format. Keys will be principal names, and values will be a
40 # JSON array of hashes. Each hash will have two keys: timestamp, which holds
41 # the seconds since UNIX epoch at which the history entry was stored, and
42 # hash, which holds the Crypt::PBKDF2 LDAP-style password hash.
43 Readonly my $HISTORY_PATH => '/var/lib/heimdal-history/history.db';
45 # User and group used to do all password history lookups and writes, assuming
46 # that this program is invoked as root and can therefore change UID and GID.
47 Readonly my $HISTORY_USER => '_history';
48 Readonly my $HISTORY_GROUP => '_history';
50 # Path to the Berkeley DB file (DB_HASH format) that stores statistics on
51 # password length of accepted passwords. Each successful password validation
52 # will increase the counter for that length. This is read and written with
53 # $HISTORY_USER and $HISTORY_GROUP.
54 Readonly my $LENGTH_STATS_PATH => '/var/lib/heimdal-history/lengths.db';
56 # The message to return to the user if we reject the password because it was
57 # found in the user's history.
58 Readonly my $REJECT_MESSAGE => 'Password was previously used';
60 # The path to the external strength checking program to run. This is done
61 # first before checking history, and if it fails, that failure is returned as
62 # the failure for this program.
63 Readonly my $STRENGTH_PROGRAM => '/usr/bin/heimdal-strength';
65 # User and group used to do password strength checking. Generally, this
66 # doesn't require any privileges since the strength dictionary is
68 Readonly my $STRENGTH_USER => 'nobody';
69 Readonly my $STRENGTH_GROUP => 'nogroup';
71 # Global boolean variable saying whether to log with syslog. This is set
72 # based on the presence of the -q (--quiet) command-line option.
75 ##############################################################################
77 ##############################################################################
79 # Change real and effective UID and GID to those for the given user and group.
80 # Does nothing if not running as root.
82 # $user - User to change the UID to
83 # $group - Group to change the GID to (and clear all supplemental groups)
86 # Throws: Text exception on any failure
88 my ($user, $group) = @_;
90 # If running as root, drop privileges. Fail if we can't get the UID and
91 # GID corresponding to our users.
92 if ($> == 0 || $< == 0) {
93 my $uid = getpwnam($user)
94 or die "$0: cannot get UID for $user\n";
95 my $gid = getgrnam($group)
96 or die "$0: cannot get GID for $group\n";
97 setgid($gid) or die "$0: cannot setgid to $gid: $!\n";
98 setuid($uid) or die "$0: cannot setuid to $uid: $!\n";
99 if ($> == 0 || $< == 0) {
100 die "$0: failed to drop permissions\n";
106 ##############################################################################
108 ##############################################################################
110 # Given a list of keys and values for a log message as a hash reference,
111 # return in encoded format following our logging protocol. The log format is
112 # a set of <key>=<value> parameters separated by a space. Values containing
113 # whitespace are quoted with double quotes, with any internal double quotes
116 # Here also is defined a custom sort order for the encoded key/value pairs to
117 # keep them in a reasonable order for a human to read.
119 # $params_ref - Reference to a hash of key/value pairs
121 # Returns: The encoded format as a string
122 sub encode_log_message {
123 my ($params_ref) = @_;
125 # Define the custom sort order for keys.
128 = map { $_ => $order++ } qw(action principal error result reason);
130 # Build the message from the parameters.
132 for my $key (sort { $order{$a} <=> $order{$b} } keys %{$params_ref}) {
133 my $value = $params_ref->{$key};
134 $value =~ s{ \" }{\"\"}xmsg;
135 if ($value =~ m{ [ \"] }xms) {
136 $value = qq{"$value"};
138 $message .= qq{$key=$value };
144 # Log a non-fatal error encountered while trying to check or store password
145 # history. This is used for errors where the password is accepted, but we ran
146 # into some anomalous event such as corrupted history data that should be
147 # drawn to the attention of an administrator. The log format is a set of
148 # <key>=<value> parameters, with the following keys:
150 # - action: the action performed (currently always "check")
151 # - principal: the principal to check a password for
152 # - error: an error message explaining the anomalous situation
154 # Values containing whitespace are quoted with double quotes, with any
155 # internal double quotes doubled. No logging will be done if $SYSLOG is
158 # $principal - Principal for which we checked a password
159 # $error - The error message
163 my ($principal, $error) = @_;
167 my $message = encode_log_message(
169 principal => $principal,
172 syslog(LOG_WARNING, '%s', $message);
176 # Log the disposition of a particular password strength checking request. All
177 # log messages are logged through syslog at class info. The log format is a
178 # set of <key>=<value> parameters, with the following keys:
180 # - action: the action performed (currently always "check")
181 # - principal: the principal to check a password for
182 # - result: either "accepted" or "rejected"
183 # - reason: the reason for a rejection
185 # Values containing whitespace are quoted with double quotes, with any
186 # internal double quotes doubled. No logging will be done if $SYSLOG is
189 # $principal - Principal for which we checked a password
190 # $result - "accepted" or "rejected" per above
191 # $reason - On rejection, the reason
195 my ($principal, $result, $reason) = @_;
200 # Create the message.
203 principal => $principal,
206 if ($result eq 'rejected' && defined($reason)) {
207 $message{reason} = $reason;
209 my $message = encode_log_message(\%message);
212 syslog(LOG_INFO, '%s', $message);
216 ##############################################################################
218 ##############################################################################
220 # Given a password, return the hash for that password. Hashing is done with
221 # PBKDF2 using SHA-2 as the underlying hash function. As of version 0.133330,
224 # $password - Password to hash
225 # $iterations - Optional iteration count, defaulting to $HASH_ITERATIONS
227 # Returns: Hash encoded in the LDAP-compatible Crypt::PBKDF2 format
229 my ($password, $iterations) = @_;
230 $iterations //= $HASH_ITERATIONS;
231 my $hasher = Crypt::PBKDF2->new(
232 hash_class => 'HMACSHA2',
233 iterations => $iterations,
235 return $hasher->generate($password);
238 # Given a password and the password history for the user as a reference to a
239 # array, check whether that password is found in the history. The history
240 # array is expected to contain anonymous hashes. The only key of interest is
241 # the "hash" key, whose value is expected to be a hash in the LDAP-compatible
242 # Crypt::PBKDF2 format.
244 # Invalid history entries are ignored for the purposes of this check and
245 # treated as if the entry did not exist.
247 # $principal - Principal to check (solely for logging purposes)
248 # $password - Password to check
249 # $history_ref - Reference to array of anonymous hashes with "hash" keys
251 # Returns: True if the password matches one of the history hashes, false
254 my ($principal, $password, $history_ref) = @_;
255 my $hasher = Crypt::PBKDF2->new(hash_class => 'HMACSHA2');
257 # Walk the history looking at each hash key.
258 for my $entry (@{$history_ref}) {
259 my $hash = $entry->{hash};
260 next if !defined($hash);
262 # validate throws an exception if the hash is in an invalid format.
263 # Treat that case the same as a miss, but log it.
264 if (eval { $hasher->validate($hash, $password) }) {
267 log_error($principal, "hash validate failed: $@");
275 ##############################################################################
277 ##############################################################################
279 # Perform a binary search for a number of hash iterations that makes password
280 # hashing take the given target time on the current system.
284 # * The system load is low enough that this benchmark result is meaningful
285 # and not heavily influenced by other programs running on the system. The
286 # binary search may be unstable if the system load is too variable.
288 # * The static "password" string used for benchmarking will exhibit similar
289 # performance to the statistically average password.
291 # Information about the iteration search process is printed to standard output
292 # while the search runs.
294 # $target - The elapsed time, in real seconds, we're aiming for
295 # $delta - The permissible delta around the target time
297 # Returns: The number of hash iterations with that performance characteristic
298 # Throws: Text exception on failure to write to standard output
299 sub find_iteration_count {
300 my ($target, $delta) = @_;
304 # A static password to use for benchmarking.
305 my $password = 'this is a benchmark';
307 # Start at the current configured iteration count. If this doesn't take
308 # long enough, it becomes the new low mark and we try double that
309 # iteration count. Otherwise, do binary search.
311 # We time twenty iterations each time, chosen because it avoids the
312 # warnings from Benchmark about too few iterations for a reliable count.
314 my $iterations = $HASH_ITERATIONS;
316 my $hash = sub { password_hash($password, $iterations) };
317 my $times = Benchmark::timethis(20, $hash, q{}, 'none');
319 # Extract the CPU time from the formatted time string. This will be
320 # the total time for all of the iterations, so divide by the iteration
321 # count to recover the time per iteration.
322 my $report = Benchmark::timestr($times);
323 my ($time) = ($report =~ m{ ([\d.]+) [ ] CPU }xms);
326 # Tell the user what we discovered.
327 say {*STDOUT} "Performing $iterations iterations takes $time seconds"
328 or die "$0: cannot write to standard output: $!\n";
330 # If this is what we're looking for, we're done.
331 if (abs($time - $target) < $delta) {
335 # Determine the new iteration target.
336 if ($time > $target) {
341 if ($time < $target && $high == 0) {
342 $iterations = $iterations * 2;
344 $iterations = int(($high + $low) / 2);
348 # Report the result and return it.
349 say {*STDOUT} "Use $iterations iterations"
350 or die "$0: cannot write to standard output: $!\n";
354 ##############################################################################
356 ##############################################################################
358 # Given a principal and a password, determine whether the password was found
359 # in the password history for that user.
361 # $path - Path to the history file
362 # $principal - Principal for which to check history
363 # $password - Check history for this password
365 # Returns: True if $password is found in history, false otherwise
366 # Throws: On failure to open, lock, or tie the database
368 my ($path, $principal, $password) = @_;
370 # Open and lock the database and retrieve the history for the user.
371 # We have to lock for write so that we can create the database if it
372 # doesn't already exist. Password change should be infrequent enough
373 # and our window is fast enough that it shouldn't matter. We do this
374 # in a separate scope so that the history hash goes out of scope and
375 # is freed and unlocked.
379 my $mode = O_CREAT | O_RDWR;
380 tie(%history, 'DB_File::Lock', $path, $mode, oct(600), $DB_HASH,
382 or die "$0: cannot open $path: $!\n";
383 $history_json = $history{$principal};
386 # If there is no history for the user, return the trivial false.
387 if (!defined($history_json)) {
391 # Decode history from JSON. If this fails (corrupt history), treat it as
392 # if the user has no history, but log the error message.
393 my $history_ref = eval { decode_json($history_json) };
394 if (!defined($history_ref)) {
395 log_error($principal, "history JSON decoding failed: $@");
399 # Finally, check the password against the hashes in history.
400 return is_in_history($principal, $password, $history_ref);
403 # Write a new history entry to the database given the principal and the
404 # password to record. History records are stored as JSON arrays of objects,
405 # with keys "timestamp" and "hash".
407 # $path - Path to the history file
408 # $principal - Principal for which to check history
409 # $password - Check history for this password
412 # Throws: On failure to open, lock, or tie the database
414 my ($path, $principal, $password) = @_;
416 # Open and lock the database for write.
418 my $mode = O_CREAT | O_RDWR;
419 tie(%history, 'DB_File::Lock', $path, $mode, oct(600), $DB_HASH, 'write')
420 or die "$0: cannot open $path: $!\n";
422 # Read the existing history. If the existing history is corrupt, treat
423 # that as equivalent to not having any history, but log an error.
424 my $history_json = $history{$principal};
426 if (defined($history_json)) {
427 $history_ref = eval { decode_json($history_json) };
429 log_error($principal, "history JSON decoding failed: $@");
432 if (!defined($history_ref)) {
436 # Add a new history entry.
437 my $entry = { timestamp => time(), hash => password_hash($password) };
438 unshift(@{$history_ref}, $entry);
440 # Store the encoded data back in the history database.
441 $history{$principal} = encode_json($history_ref);
443 # The database is closed and unlocked when %history goes out of scope.
444 # Unfortunately, we lose on error detection here, since there doesn't
445 # appear to be a way to determine whether all the writes succeeded. But
446 # losing a bit of history in the rare error case of failing to write to
447 # local disk is probably not a big deal.
451 # Write statistics about password length. Given the length of the password
452 # and the path to the length statistics database, increments the counter for
453 # that password length.
455 # Any failure to open or write to the database is ignored, since this is
456 # considered optional logging and should not block the password change.
458 # $path - Path to the length statistics file
459 # $length - Length of the accepted password
462 sub update_length_counts {
463 my ($path, $length) = @_;
465 # Open and lock the database for write.
467 my $mode = O_CREAT | O_RDWR;
468 tie(%lengths, 'DB_File::Lock', $path, $mode, oct(600), $DB_HASH, 'write')
471 # Write each of the hashes.
474 # The database is closed and unlocked when %lengths goes out of scope.
478 ##############################################################################
479 # Heimdal password quality protocol
480 ##############################################################################
482 # Run another external password quality checker and return the results. This
483 # allows us to chain to another program that handles the actual strength
484 # checking prior to handling history.
486 # $path - Password quality check program to run
487 # $principal - Principal attempting to change their password
488 # $password - The new password
490 # Returns: Scalar context: true if the password was accepted, false otherwise
491 # List context: whether the password is okay, the exit status of the
492 # quality checking program, and the error message if the first
494 # Throws: Text exception on failure to execute the program, or read or write
495 # from it or to it, or if it fails without an error
497 my ($path, $principal, $password) = @_;
499 # Run the external quality checking program. If we're root, we'll run it
500 # as the strength checking user and group.
501 my $in = "principal: $principal\nnew-password: $password\nend\n";
502 my $init = sub { drop_privileges($STRENGTH_USER, $STRENGTH_GROUP) };
504 run([$path, $principal], \$in, \$out, \$err, init => $init);
505 my $status = ($? >> 8);
508 my $okay = ($status == 0 && $out eq "APPROVED\n");
510 # If the program failed, collect the error message.
513 $err =~ s{ \n .* }{}xms;
515 die "$0: password strength checking failed without an error\n";
519 # Return the results.
520 return wantarray ? ($okay, $err, $status) : $okay;
523 # Read a Heimdal external password quality checking request from the provided
524 # file handle and return the principal (ignored for our application) and the
527 # The protocol expects the following data (without leading whitespace) on
528 # standard input, in precisely this order:
530 # principal: <principal>
531 # new-password: <password>
534 # There is one and only one space after the colon, and any subsequent spaces
535 # are part of the value (such as leading spaces in the password).
537 # $fh - File handle from which to read
539 # Returns: Scalar context: the password
540 # List context: a list of the password and the principal
541 # Throws: Text exception on any protocol violations or IO errors
542 sub read_change_data {
544 my @keys = qw(principal new-password);
547 # Read the data elements we expect. Verify that they come in the correct
548 # order and the correct format.
550 for my $key (@keys) {
551 my $line = readline($fh);
552 if (!defined($line)) {
553 die "$0: truncated input before $key: $!\n";
556 if ($line =~ s{ \A \Q$key\E : [ ] }{}xms) {
559 die "$0: unrecognized input line before $key\n";
563 # The final line of input must be a literal "end\n";
564 my $line = readline($fh);
565 if (!defined($line)) {
566 die "$0: truncated input before end: $!\n";
567 } elsif ($line ne "end\n") {
568 die "$0: unrecognized input line before end\n";
571 # Return the results.
572 my $password = $data{'new-password'};
573 my $principal = $data{principal};
574 return wantarray ? ($password, $principal) : $password;
577 ##############################################################################
579 ##############################################################################
581 # Always flush output.
584 # Clean up the script name for error reporting.
586 local $0 = basename($0);
588 # Parse the argument list.
589 my ($opt, $usage) = describe_options(
591 ['benchmark|b=f', 'Benchmark hash iterations for this target time'],
592 ['database|d=s', 'Path to the history database, overriding the default'],
593 ['help|h', 'Print usage message and exit'],
594 ['manual|man|m', 'Print full manual and exit'],
595 ['quiet|q', 'Suppress logging to syslog'],
596 ['stats|S=s', 'Path to hash of length statistics'],
597 ['strength|s=s', 'Path to strength checking program to run'],
600 print {*STDOUT} $usage->text
601 or die "$0: cannot write to standard output: $!\n";
603 } elsif ($opt->manual) {
604 say {*STDOUT} 'Feeding myself to perldoc, please wait...'
605 or die "$0: cannot write to standard output: $!\n";
606 exec('perldoc', '-t', $fullpath);
608 my $database = $opt->database || $HISTORY_PATH;
609 my $stats_db = $opt->stats || $LENGTH_STATS_PATH;
610 my $strength = $opt->strength || $STRENGTH_PROGRAM;
612 # If asked to do benchmarking, ignore other arguments and just do that.
613 # Currently, we hard-code a 0.005-second granularity on our binary search.
614 if ($opt->benchmark) {
615 find_iteration_count($opt->benchmark, 0.005);
619 # Open syslog for result reporting.
623 openlog($0, 'pid', LOG_AUTH);
626 # Read the principal and password that we're supposed to check.
627 my ($password, $principal) = read_change_data(\*STDIN);
629 # Delegate to the external strength checking program.
630 my ($okay, $error, $status) = strength_check($strength, $principal, $password);
632 log_result($principal, 'rejected', $error);
637 # Drop privileges for the rest of the program.
638 drop_privileges($HISTORY_USER, $HISTORY_GROUP);
640 # Hash the password and check history. Exit if a hash is in history.
641 if (check_history($database, $principal, $password)) {
642 log_result($principal, 'rejected', $REJECT_MESSAGE);
643 warn "$REJECT_MESSAGE\n";
647 # The password is accepted. Record it, update the length counter, and return
649 log_result($principal, 'accepted');
650 write_history($database, $principal, $password);
651 say {*STDOUT} 'APPROVED'
652 or die "$0: cannot write to standard output: $!\n";
653 update_length_counts($stats_db, length($password));
658 ##############################################################################
660 ##############################################################################
663 heimdal-history heimdal-strength Heimdal -hmq BerkeleyDB timestamps POSIX
664 whitespace API Allbery sublicense MERCHANTABILITY NONINFRINGEMENT syslog
665 pseudorandom JSON LDAP-compatible PBKDF2 SHA-256 KDC
669 heimdal-history - Password history via Heimdal external strength checking
673 B<heimdal-history> [B<-hmq>] [B<-b> I<target-time>] [B<-d> I<database>]
674 [B<-S> I<length-stats-db>] [B<-s> I<strength-program>] [B<principal>]
678 B<heimdal-history> is an implementation of password history via the
679 Heimdal external password strength checking interface. It stores separate
680 history for each principal, hashed using Crypt::PBKDF2 with
681 randomly-generated salt. (The randomness is from a weak pseudorandom
682 number generator, not strongly random.)
684 Password history is stored in a BerkeleyDB DB_HASH file. The key is the
685 principal. The value is a JSON array of objects, each of which has two
686 keys. C<timestamp> contains the time when the history entry was added (in
687 POSIX seconds since UNIX epoch), and C<hash> contains the hash of a
688 previously-used password in the Crypt::PBKDF2 LDAP-compatible format.
689 Passwords are hashed using PBKDF2 (from PKCS#5) with SHA-256 as the
690 underlying hash function using a number of rounds configured in this
691 script. See L<Crypt::PBKDF2> for more information.
693 B<heimdal-history> also checks password strength before checking history.
694 It does so by invoking another program that also uses the Heimdal external
695 password strength checking interface. By default, it runs
696 B</usr/bin/heimdal-strength>. Only if that program approves the password
697 does it hash it and check history.
699 For more information on how to set up password history, see
700 L</CONFIGURATION> below.
702 As with any implementation of the Heimdal external password strength
703 checking protocol, B<heimdal-history> expects, on standard input:
705 principal: <principal>
706 new-password: <password>
709 (with no leading whitespace). <principal> is the principal changing its
710 password (passed to the other password strength checking program but
711 otherwise unused here), and <password> is the new password. There must
712 be exactly one space after the colon. Any subsequent spaces are taken to
713 be part of the principal or password.
715 If invoked as root, B<heimdal-history> will run the external strength
716 checking program as user C<nobody> and group C<nogroup>, and will check
717 and write to the history database as user C<_history> and group
718 C<_history>. These users must exist on the system if it is run as root.
720 The result of each password check will be logged to syslog (priority
721 LOG_INFO, facility LOG_AUTH). Each log line will be a set of key/value
722 pairs in the format C<< I<key>=I<value> >>. The keys are:
728 The action performed (currently always C<check>).
732 The principal for which a password was checked.
736 An internal error message that did not stop the history check, but which
737 may indicate that something is wrong with the history database (such as
738 corrupted entries or invalid hashes). If this key is present, neither
739 C<result> nor C<reason> will be present. There will be a subsequent log
740 message from the same invocation giving the final result of the history
741 check (assuming B<heimdal-history> doesn't exit with a fatal error).
745 Either C<accepted> or C<rejected>.
749 If the password was rejected, the reason for the rejection.
753 The value will be surrounded with double quotes if it contains a double
754 quote or space. Any double quotes in the value will be doubled, so C<">
761 =item B<-b> I<target-time>, B<--benchmark>=I<target-time>
763 Do not do a password history check. Instead, benchmark the hash algorithm
764 with various possible iteration counts and find an iteration count that
765 results in I<target-time> seconds of computation time required to hash a
766 password (which should be a real number). A result will be considered
767 acceptable if it is within 0.005 seconds of the target time. The results
768 will be printed to standard output and then B<heimdal-history> will exit
771 =item B<-d> I<database>, B<--database>=I<database>
773 Use I<database> as the history database file instead of the default
774 (F</var/lib/heimdal-history/history.db>). Primarily used for testing,
775 since Heimdal won't pass this argument.
777 =item B<-h>, B<--help>
779 Print a short usage message and exit.
781 =item B<-m>, B<--manual>, B<--man>
783 Display this manual and exit.
785 =item B<-q>, B<--quiet>
787 Suppress logging to syslog and only return the results on standard output
788 and standard error. Primarily used for testing, since Heimdal won't pass
791 =item B<-S> I<length-stats-db>, B<--stats>=I<length-stats-db>
793 Use I<length-stats-db> as the database file for password length statistics
794 instead of the default (F</var/lib/heimdal-history/lengths.db>).
795 Primarily used for testing, since Heimdal won't pass this argument.
797 =item B<-s> I<strength-program>, B<--strength>=I<strength-program>
799 Run I<strength-program> as the external strength-checking program instead
800 of the default (F</usr/bin/heimdal-strength>). Primarily used for
801 testing, since Heimdal won't pass this argument.
807 Additional setup is required to use this history implementation with your
810 First, ensure that its dependencies are installed, and then examine the
811 local configuration settings at the top of the B<heimdal-history> program.
812 By default, it requires a C<_history> user and C<_history> group be
813 present on the system, and all history information will be read and
814 written as that user and group. It also requires a C<nobody> user and
815 C<nogroup> group to be present (this should be the default with most
816 variants of UNIX), and all strength checking will be done as that user and
817 group. It uses various files in F</var/lib/heimdal-history> to store
818 history and statistical information by default, so if using the defaults,
819 create that directory and ensure it is writable by the C<_history> user.
821 Once that setup is done, change your C<[password_quality]> configuration
822 in F<krb5.conf> or F<kdc.conf> to:
825 policies = external-check
826 external_program = /usr/local/bin/heimdal-history
828 The B<heimdal-history> program will automatically also run
829 B<heimdal-strength> as well, looking for it in F</usr/bin>. Change the
830 C<$STRENGTH_PROGRAM> setting at the top of the script if you have that
831 program in a different location. You should continue to configure
832 B<heimdal-strength> as if you were running it directly.
836 On approval of the password, B<heimdal-history> will print C<APPROVED> and
837 a newline to standard output and exit with status 0.
839 If the password is rejected by the strength checking program or if it (or
840 a version with a single character removed) matches one of the hashes stored
841 in the password history, B<heimdal-history> will print the reason for
842 rejection to standard error and exit with status 0.
844 On any internal error, B<heimdal-history> will print the error to standard
845 error and exit with a non-zero status.
851 =item F</usr/bin/heimdal-strength>
853 The default password strength checking program. This program must follow
854 the Heimdal external password strength checking API.
856 =item F</var/lib/heimdal-history/history.db>
858 The default database path. If B<heimdal-strength> is run as root, this
859 file needs to be readable and writable by user C<_history> and group
860 C<_history>. If it doesn't exist, it will be created with mode 0600.
862 =item F</var/lib/heimdal-history/history.db.lock>
864 The lock file used to synchronize access to the history database. As with
865 the history database, if B<heimdal-strength> is run as root, this file
866 needs to be readable and writable by user C<_history> and group
869 =item F</var/lib/heimdal-history/lengths.db>
871 The default length statistics path, which will be a BerkeleyDB DB_HASH
872 file of password lengths to counts of passwords with that length. If
873 B<heimdal-strength> is run as root, this file needs to be readable and
874 writable by user C<_history> and group C<_history>. If it doesn't exist,
875 it will be created with mode 0600.
877 =item F</var/lib/heimdal-history/lengths.db.lock>
879 The lock file used to synchronize access to the length statistics
880 database. As with the length statistics database, if B<heimdal-strength>
881 is run as root, this file needs to be readable and writable by user
882 C<_history> and group C<_history>.
888 Russ Allbery <eagle@eyrie.org>
890 =head1 COPYRIGHT AND LICENSE
892 Copyright 2016 Russ Allbery <eagle@eyrie.org>
894 Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
897 Permission is hereby granted, free of charge, to any person obtaining a
898 copy of this software and associated documentation files (the "Software"),
899 to deal in the Software without restriction, including without limitation
900 the rights to use, copy, modify, merge, publish, distribute, sublicense,
901 and/or sell copies of the Software, and to permit persons to whom the
902 Software is furnished to do so, subject to the following conditions:
904 The above copyright notice and this permission notice shall be included in
905 all copies or substantial portions of the Software.
907 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
908 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
909 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
910 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
911 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
912 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
913 DEALINGS IN THE SOFTWARE.
917 L<Crypt::PBKDF2>, L<heimdal-strength(1)>