DOKK / manpages / debian 12 / passwdqc / pwqcheck.1.en
PWQCHECK(1) General Commands Manual PWQCHECK(1)

pwqcheckCheck passphrase quality

pwqcheck [options]

The pwqcheck program checks passphrase quality using the libpasswdqc library. By default, it expects to read 3 lines from standard input:

  • first line is a new password,
  • second line is an old password, and
  • third line is either an existing account name or a passwd(5) entry.

There are a number of supported options, which can be used to control the pwqcheck behavior.

pwqcheck prints OK on success. Scripts invoking pwqcheck are suggested to check for both a zero exit status and the OK line.

=N0,N1,N2,N3,N4
(default: min=disabled,24,11,8,7) The minimum allowed password lengths for different kinds of passwords/passphrases. The keyword disabled can be used to disallow passwords of a given kind regardless of their length. Each subsequent number is required to be no larger than the preceding one.

N0 is used for passwords consisting of characters from one character class only. The character classes are: digits, lower-case letters, upper-case letters, and other characters. There is also a special class for non-ASCII characters, which could not be classified, but are assumed to be non-digits.

N1 is used for passwords consisting of characters from two character classes that do not meet the requirements for a passphrase.

N2 is used for passphrases. Note that besides meeting this length requirement, a passphrase must also consist of a sufficient number of words (see the passphrase option below).

N3 and N4 are used for passwords consisting of characters from three and four character classes, respectively.

When calculating the number of character classes, upper-case letters used as the first character and digits used as the last character of a password are not counted.

In addition to being sufficiently long, passwords are required to contain enough different characters for the character classes and the minimum length they have been checked against.

=N
(default: max=72) The maximum allowed password length. This can be used to prevent users from setting passwords that may be too long for some system services. The value 8 is treated specially: if max is set to 8, passwords longer than 8 characters will not be rejected, but will be truncated to 8 characters for the strength checks and the user will be warned. This is to be used with the traditional DES-based password hashes, which truncate the password at 8 characters.

It is important that you do set max=8 if you are using the traditional hashes, or some weak passwords will pass the checks.

=N
(default: passphrase=3) The number of words required for a passphrase.
=N
(default: match=4) The length of common substring required to conclude that a password is at least partially based on information found in a character string, or 0 to disable the substring search. Note that the password will not be rejected once a weak substring is found; it will instead be subjected to the usual strength requirements with the weak substring partially discounted.

The substring search is case-insensitive and is able to detect and remove a common substring spelled backwards.

similar=permit|
(default: similar=deny) Whether a new password is allowed to be similar to the old one. The passwords are considered to be similar when there is a sufficiently long common substring and the new password with the substring partially discounted would be weak.
=FILE
Deny passwords that are based on lines of the tiny external text FILE, which can reasonably be e.g. a list of a few thousand common passwords. Common dictionary words may also reasonably be included, especially in a local language other than English, or longer yet common English words. (passwdqc includes a list of a few thousand common English words of lengths from 3 to 6 built in. Any word list possibly specified with this option is used in addition to the built-in word list.)

Substring matching and discounting will be used if the match setting above is non-zero. Please note that this is very inefficient, and isn't to be used with large wordlists.

=FILE
Deny passwords or passphrases directly appearing in the tiny external text FILE. That file can reasonably be e.g. a list of common passwords if only a relaxed policy is desired and stricter checks are thus disabled (using their separate options). Such policy would only be somewhat effective against online/remote attacks, but not against offline attacks on hashed passwords.
=FILE
Deny passwords or passphrases directly appearing in a maybe huge binary filter FILE created with pwqfilter. This is very efficient, needing at most two random disk reads per query. A filter created from millions of leaked passwords can reasonably be used on top of passwdqc's other checks to further reduce the number of passing yet weak passwords without causing unreasonable inconvenience (as e.g. higher minimum lengths and character set requirements could).
=FILE
Load config FILE in the passwdqc.conf format. This file may define any options described in passwdqc.conf(5), but only the min, max, passphrase, match, and config options are honored by pwqcheck.
Read just 1 line (new passphrase). This is needed to use pwqcheck as the passwordcheck program on OpenBSD - e.g., with ":passwordcheck=/usr/bin/pwqcheck -1:\" (without the quotes, but with the trailing backslash) in the "default" section in /etc/login.conf.
Read just 2 lines (new and old passphrases).
Check multiple passphrases (until EOF). This option may be used on its own or along with the -1 or -2 options. pwqcheck will read 1, 2, or 3 lines and will output one line per passphrase to check. The lines will start with either OK or a message explaining why the passphrase did not pass the checks, followed by a colon and a space, and finally followed by the passphrase. The explanatory message is guaranteed to not include a colon. With this option, the exit status of pwqcheck depends solely on whether there were any errors preventing the strength of passphrases from being fully checked or not. A primary use for this option is to test different policies and/or different versions of passwdqc on large passphrase lists.
Output pwqcheck program version and exit.
, --help
Output pwqcheck help text and exit.

pwqcheck exits with non-zero status when it encounters invalid config file, invalid option, invalid parameter value, invalid data in standard input, and in any case when it fails to check passphrase strength. Without the --multi option, pwqcheck also exits with non-zero status when it detects a weak passphrase.

/etc/passwdqc.conf (not read unless this suggested file location is specified with the config=/etc/passwdqc.conf option).

pwqgen(1), libpasswdqc(3), passwd(5), passwdqc.conf(5), pam_passwdqc(8).

https://www.openwall.com/passwdqc/

The pam_passwdqc module was written for Openwall GNU/*/Linux by Solar Designer. The pwqcheck program was originally written for ALT GNU/*/Linux by Dmitry V. Levin, indirectly reusing code from pam_passwdqc (via libpasswdqc). This manual page (derived from the pam_passwdqc documentation) was written for Openwall GNU/*/Linux by Dmitry V. Levin.

December 30, 2020 Openwall Project