- Notifications
You must be signed in to change notification settings - Fork18
Password/passphrase strength checking and policy enforcement
License
NotificationsYou must be signed in to change notification settings
openwall/passwdqc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
pam_passwdqc is a simple password strength checking module forPAM-aware password changing programs, such as passwd(1). In additionto checking regular passwords, it offers support for passphrases andcan provide randomly generated ones. All features are optional andcan be (re-)configured without rebuilding.This module should be stacked before your usual password changingmodule (such as pam_unix or pam_pwdb) in the password management group(the "password" lines in /etc/pam.d/passwd or /etc/pam.conf). Thepassword changing module should then be told to use the provided newauthentication token (new password) rather than request it from theuser. There's usually the "use_authtok" option to do that. If yourpassword changing module lacks the "use_authtok" option or its promptsare inconsistent with pam_passwdqc's, you may tell pam_passwdqc to askfor the old password as well, with "ask_oldauthtok". In that case theoption to use with the password changing module is "use_first_pass".There are a number of supported options, which can be used to modify thebehavior of pam_passwdqc (defaults are given in square brackets):config=FILE[]Load the specified configuration FILE, which must be in thepasswdqc.conf format (described in the passwdqc.conf(5) manual page).This file may define any options described in here, including load ofyet another configuration file, but loops are not allowed.min=N0,N1,N2,N3,N4[min=disabled,24,11,8,7]The minimum allowed password lengths for different kinds of passwordsand passphrases. The keyword "disabled" can be used to disallowpasswords of a given kind regardless of their length. Each subsequentnumber is required to be no larger than the preceding one.N0 is used for passwords consisting of characters from one characterclass only. The character classes are: digits, lower-case letters,upper-case letters, and other characters. There is also a specialclass for non-ASCII characters, which could not be classified, but areassumed to be non-digits.N1 is used for passwords consisting of characters from two characterclasses that do not meet the requirements for a passphrase.N2 is used for passphrases. Note that besides meeting this lengthrequirement, a passphrase must also consist of a sufficient number ofwords (see the "passphrase" option below).N3 and N4 are used for passwords consisting of characters from threeand four character classes, respectively.When calculating the number of character classes, upper-case lettersused as the first character and digits used as the last character of apassword are not counted.In addition to being sufficiently long, passwords are required tocontain enough different characters for the character classes andthe minimum length they have been checked against.max=N[max=72]The maximum allowed password length. This can be used to preventusers from setting passwords that may be too long for some systemservices.The value 8 is treated specially: with max=8, passwords longer than 8characters will not be rejected, but will be truncated to 8 charactersfor the strength checks and the user will be warned. This is to beused with the traditional DES-based password hashes, which truncatethe password at 8 characters.It is important that you do set max=8 if you are using the traditionalhashes, or some weak passwords will pass the checks.passphrase=N[passphrase=3]The number of words required for a passphrase, or 0 to disable thesupport for user-chosen passphrases.match=N[match=4]The length of common substring required to conclude that a password isat least partially based on information found in a character string,or 0 to disable the substring search. Note that the password will notbe rejected once a weak substring is found; it will instead besubjected to the usual strength requirements with the weak substringpartially discounted.The substring search is case-insensitive and is able to detect andremove a common substring spelled backwards.similar=permit|deny[similar=deny]Whether a new password is allowed to be similar to the old one. Thepasswords are considered to be similar when there is a sufficientlylong common substring and the new password with the substring partiallydiscounted would be weak.wordlist=FILE[]Deny passwords that are based on lines of a 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 alocal language other than English, or longer yet common English words.(passwdqc includes a list of a few thousand common English words oflengths from 3 to 6 built in. Any word list possibly specified withthis option is used in addition to the built-in word list.)Substring matching and discounting will be used if the "match" settingabove is non-zero. Please note that this is very inefficient, and isn'tto be used with large wordlists.denylist=FILE[]Deny passwords or passphrases directly appearing in a tiny external textfile. That file can reasonably be e.g. a list of common passwords ifonly a relaxed policy is desired and stricter checks are thus disabled(using their separate options). Such policy would only be somewhateffective against online/remote attacks, but not against offline attackson hashed passwords.filter=FILE[]Deny passwords or passphrases directly appearing in a maybe huge binaryfilter file created with pwqfilter. This is very efficient, needing atmost two random disk reads per query. A filter created from millions ofleaked passwords can reasonably be used on top of passwdqc's otherchecks to further reduce the number of passing yet weak passwordswithout causing unreasonable inconvenience (as e.g. higher minimumlengths and character set requirements could).random=N[,only][random=47]The size of randomly-generated passphrases in bits (24 to 136), or 0 todisable this feature. Any passphrase that contains the offeredrandomly-generated string will be allowed regardless of other possiblerestrictions.The "only" modifier can be used to disallow user-chosen passwords.enforce=none|users|everyone[enforce=everyone]The module can be configured to warn of weak passwords only, but notactually enforce strong passwords. The "users" setting is like"everyone" for all PAM services except "chpasswd" and "passwd".For these two PAM services "users" will enforce strong passwordsfor invocations by non-root users only.non-unix[]Normally, the module uses getpwnam(3) to obtain the user's personallogin information and use that during the password strength checks.This behavior can be disabled with the "non-unix" option.retry=N[retry=3]The number of times the module will ask for a new password if the userfails to provide a sufficiently strong password and enter it twice thefirst time.ask_oldauthtok[=update][]Ask for the old password as well. Normally, pam_passwdqc leaves thistask for subsequent modules. With no argument, the "ask_oldauthtok"option will cause pam_passwdqc to ask for the old password during thepreliminary check phase. With "ask_oldauthtok=update", pam_passwdqcwill do that during the update phase.check_oldauthtok[]This tells pam_passwdqc to validate the old password before giving anew password prompt. Normally, this task is left for subsequentmodules.The primary use for this option is when "ask_oldauthtok=update" isalso specified, in which case no other module gets a chance to askfor and validate the password. Of course, this will only work withUnix passwords.use_first_pass[]use_authtok[]Use the new password obtained by modules stacked before pam_passwdqc.This disables user interaction within pam_passwdqc. With this module,the only difference between "use_first_pass" and "use_authtok" is thatthe former is incompatible with "ask_oldauthtok".noaudit[]If audit is enabled at build time, the PAM module logs audit events onceuser tries to change their credentials. This option disables that auditlogging.
About
Password/passphrase strength checking and policy enforcement