HEIMDAL-HISTORY(1)
π HEIMDAL-HISTORY π
okay bestie so this is heimdal-history, a page from the krb5-strength manual set, and it's genuinely one of those little tools that does a big job: password history via the Heimdal external strength checking interface. yes. we're doing password lore today. let's go π«Ά
β¨ NAME β¨
heimdal-history β password history via Heimdal external strength checking. that's the whole vibe: it remembers what passwords you've already used so you can't just circle back to your old faves. iconic behaviour, honestly.
πΈ SYNOPSIS πΈ
heimdal-history [-chmq] [-b target-time] [-d database]
[-S length-stats-db] [-s strength-program] [principal]
π¦ DESCRIPTION π¦
so heimdal-history is an implementation of password history via the Heimdal external password strength checking interface. it stores separate history for each principal, hashed using Crypt::PBKDF2 with randomly-generated salt. and ngl, the manpage is very honest about one thing: the randomness is from a weak pseudorandom number generator, not strongly random. it said what it said π. password history is stored indefinitely (implementing infinite history), and older password hashes are never removed by this program. never ever. periodt.
Password history is stored in a BerkeleyDB DB_HASH file. the key is the principal. the value is a JSON array of objects, each of which has two keys:
timestampβ the time when the history entry was added (in POSIX seconds since UNIX epoch).hashβ the hash of a previously-used password in theCrypt::PBKDF2LDAP-compatible format.
passwords are hashed using PBKDF2 (from PKCS#5) with SHA-256 as the underlying hash function, using a number of rounds configured in this script. see Crypt::PBKDF2 for more info, iykyk.
heimdal-history also checks password strength before checking history. how? by invoking another program that also uses the Heimdal external password strength checking interface. by default, it runs /usr/bin/heimdal-strength. and only if that program approves the password does it hash it and check history. gatekeeping in the best way π
.
for more info on how to set up password history, see "CONFIGURATION" below.
as with any implementation of the Heimdal external password strength checking protocol, heimdal-history expects, on standard input:
principal: <principal>
new-password: <password>
end
with no leading whitespace, bestie. here's the breakdown:
<principal>is the principal changing its password (passed to the other password strength checking program but otherwise unused here).<password>is the new password.
there must be exactly one space after the colon. any subsequent spaces are taken to be part of the principal or password. one space. not two. not a tab. one. π
if the password is accepted, heimdal-history will assume that it will be used and will update the history database to record the new password. it will also update the password length statistics database to account for the new password. slay.
if invoked as root, heimdal-history will run the external strength checking program as user "nobody" and group "nogroup", and will check and write to the history database as user "_history" and group "_history". these users must exist on the system if it is run as root. no user, no service, that's just how it is π.
the result of each password check will be logged to syslog (priority LOG_INFO, facility LOG_AUTH). each log line will be a set of key/value pairs in the format "key=value". the keys are:
actionβ the action performed (currently always"check").principalβ the principal for which a password was checked.errorβ an internal error message that did not stop the history check, but which may indicate that something is wrong with the history database (such as corrupted entries or invalid hashes). if this key is present, neither"result"nor"reason"will be present. there will be a subsequent log message from the same invocation giving the final result of the history check (assumingheimdal-historydoesn't exit with a fatal error).resultβ either"accepted"or"rejected".reasonβ if the password was rejected, the reason for the rejection.
the value will be surrounded with double quotes if it contains a double quote or space. any double quotes in the value will be doubled, so "" becomes """". (yes it's giving escape-sequence realness, we love to see it.)
π OPTIONS π
-btarget-time,--benchmark=target-time β do not do a password history check. instead, benchmark the hash algorithm with various possible iteration counts and find an iteration count that results in target-time seconds of computation time required to hash a password (which should be a real number). a result will be considered acceptable if it is within0.005seconds of the target time. the results will be printed to standard output and thenheimdal-historywill exit successfully.-c,--check-onlyβ check password history and password strength and print the results as normal, but do not update the history or length statistics databases. this is a read-only mode of operation that will not make any changes to the underlying database, only report if a password would currently be accepted.-ddatabase,--database=database β use database as the history database file instead of the default (/var/lib/heimdal-history/history.db). primarily used for testing, since Heimdal won't pass this argument.-h,--helpβ print a short usage message and exit.-m,--manual,--manβ display this manual and exit.-q,--quietβ suppress logging to syslog and only return the results on standard output and standard error. primarily used for testing, since Heimdal won't pass this argument.-Slength-stats-db,--stats=length-stats-db β use length-stats-db as the database file for password length statistics instead of the default (/var/lib/heimdal-history/lengths.db). primarily used for testing, since Heimdal won't pass this argument.-sstrength-program,--strength=strength-program β run strength-program as the external strength-checking program instead of the default (/usr/bin/heimdal-strength). primarily used for testing, since Heimdal won't pass this argument.
π CONFIGURATION π
additional setup is required to use this history implementation with your Heimdal KDC. yes, there's homework. but it's cute homework, i promise.
first, ensure that its dependencies are installed, and then examine the local configuration settings at the top of the heimdal-history program. by default, it requires a "_history" user and "_history" group be present on the system, and all history information will be read and written as that user and group. it also requires a "nobody" user and "nogroup" group to be present (this should be the default with most variants of UNIX), and all strength checking will be done as that user and group. it uses various files in /var/lib/heimdal-history to store history and statistical information by default, so if using the defaults, create that directory and ensure it is writable by the "_history" user.
once that setup is done, change your "[password_quality]" configuration in krb5.conf or kdc.conf to:
[password_quality]
policies = external-check
external_program = /usr/local/bin/heimdal-history
the heimdal-history program will automatically also run heimdal-strength as well, looking for it in /usr/bin. change the $STRENGTH_PROGRAM setting at the top of the script if you have that program in a different location. you should continue to configure heimdal-strength as if you were running it directly.
β RETURN STATUS β
- on approval of the password,
heimdal-historywill print"APPROVED"and a newline to standard output and exit with status0. π - if the password is rejected by the strength checking program, or if it (or a version with a single character removed) matches one of the hashes stored in the password history,
heimdal-historywill print the reason for rejection to standard error and exit with status0. - on any internal error,
heimdal-historywill print the error to standard error and exit with a non-zero status.
heads up bestie: a rejection still exits 0. it's the internal errors that get the non-zero glow-up. don't mix them up π
π FILES π
/usr/bin/heimdal-strengthβ the default password strength checking program. this program must follow the Heimdal external password strength checking API./var/lib/heimdal-history/history.dbβ the default database path. ifheimdal-strengthis run as root, this file needs to be readable and writable by user"_history"and group"_history". if it doesn't exist, it will be created with mode0600./var/lib/heimdal-history/history.db.lockβ the lock file used to synchronize access to the history database. as with the history database, ifheimdal-strengthis run as root, this file needs to be readable and writable by user"_history"and group"_history"./var/lib/heimdal-history/lengths.dbβ the default length statistics path, which will be a BerkeleyDBDB_HASHfile of password lengths to counts of passwords with that length. ifheimdal-strengthis run as root, this file needs to be readable and writable by user"_history"and group"_history". if it doesn't exist, it will be created with mode0600./var/lib/heimdal-history/lengths.db.lockβ the lock file used to synchronize access to the length statistics database. as with the length statistics database, ifheimdal-strengthis run as root, this file needs to be readable and writable by user"_history"and group"_history".
π AUTHOR π
Russ Allbery <eagle@eyrie.org> β the icon who wrote this. π«Ά
π COPYRIGHT AND LICENSE π
Copyright 2016-2017, 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 π
Crypt::PBKDF2, heimdal-strength(1)
and that's the whole page, bestie π§π version 3.3, dated 2023-12-26, from the krb5-strength collection. go forth and never reuse a password again. no cap. π¦β¨
π¦ where this page comes from
- debian trixie: krb5-strength 3.3-1 Β· MIT
- ubuntu noble: krb5-strength 3.3-1 Β· MIT
- ubuntu resolute: krb5-strength 3.3-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms