10b0ecb56SDag-Erling Smørgravpam_passwdqc is a simple password strength checking module for 20b0ecb56SDag-Erling SmørgravPAM-aware password changing programs, such as passwd(1). In addition 30b0ecb56SDag-Erling Smørgravto checking regular passwords, it offers support for passphrases and 40b0ecb56SDag-Erling Smørgravcan provide randomly generated passwords. All features are optional 50b0ecb56SDag-Erling Smørgravand can be (re-)configured without rebuilding. 60b0ecb56SDag-Erling Smørgrav 70b0ecb56SDag-Erling SmørgravThis module should be stacked before your usual password changing 80b0ecb56SDag-Erling Smørgravmodule (such as pam_unix or pam_pwdb) in the password management group 90b0ecb56SDag-Erling Smørgrav(the "password" lines in /etc/pam.d/passwd or /etc/pam.conf). The 100b0ecb56SDag-Erling Smørgravpassword changing module should then be told to use the provided new 110b0ecb56SDag-Erling Smørgravauthentication token (new password) rather than request it from the 120b0ecb56SDag-Erling Smørgravuser. There's usually the "use_authtok" option to do that. If your 130b0ecb56SDag-Erling Smørgravpassword changing module lacks the "use_authtok" option or its prompts 140b0ecb56SDag-Erling Smørgravare inconsistent with pam_passwdqc's, you may tell pam_passwdqc to ask 150b0ecb56SDag-Erling Smørgravfor the old password as well, with "ask_oldauthtok". In that case the 160b0ecb56SDag-Erling Smørgravoption to use with the password changing module is "use_first_pass". 170b0ecb56SDag-Erling Smørgrav 180b0ecb56SDag-Erling SmørgravThere's a number of supported options which can be used to modify the 190b0ecb56SDag-Erling Smørgravbehavior of pam_passwdqc (defaults are given in square brackets): 200b0ecb56SDag-Erling Smørgrav 210b0ecb56SDag-Erling Smørgrav min=N0,N1,N2,N3,N4 [min=disabled,24,12,8,7] 220b0ecb56SDag-Erling Smørgrav 230b0ecb56SDag-Erling SmørgravThe minimum allowed password lengths, separately for different kinds 240b0ecb56SDag-Erling Smørgravof passwords/passphrases. The special word "disabled" can be used to 250b0ecb56SDag-Erling Smørgravdisallow passwords of a given kind regardless of their length. Each 260b0ecb56SDag-Erling Smørgravsubsequent number is required to be no larger than the preceding one. 270b0ecb56SDag-Erling Smørgrav 280b0ecb56SDag-Erling SmørgravN0 is used for passwords consisting of characters from one character 290b0ecb56SDag-Erling Smørgravclass only. (The character classes are: digits, lower-case letters, 300b0ecb56SDag-Erling Smørgravupper-case letters, and other characters. There's also the special 310b0ecb56SDag-Erling Smørgravclass for non-ASCII characters which couldn't be classified, but are 320b0ecb56SDag-Erling Smørgravassumed to be non-digits.) 330b0ecb56SDag-Erling Smørgrav 340b0ecb56SDag-Erling SmørgravN1 is used for passwords consisting of characters from two character 350b0ecb56SDag-Erling Smørgravclasses, which don't meet the requirements for a passphrase. 360b0ecb56SDag-Erling Smørgrav 370b0ecb56SDag-Erling SmørgravN2 is used for passphrases. A passphrase must consist of sufficient 380b0ecb56SDag-Erling Smørgravwords (see the "passphrase" option, below). 390b0ecb56SDag-Erling Smørgrav 400b0ecb56SDag-Erling SmørgravN3 and N4 are used for passwords consisting of characters from three 410b0ecb56SDag-Erling Smørgravand four character classes, respectively. 420b0ecb56SDag-Erling Smørgrav 430b0ecb56SDag-Erling SmørgravWhen calculating the number of character classes, upper-case letters 440b0ecb56SDag-Erling Smørgravused as the first character and digits used as the last character of a 450b0ecb56SDag-Erling Smørgravpassword are not counted. 460b0ecb56SDag-Erling Smørgrav 470b0ecb56SDag-Erling SmørgravIn addition to being sufficiently long, passwords are required to 480b0ecb56SDag-Erling Smørgravcontain enough different characters for the character classes and 490b0ecb56SDag-Erling Smørgravthe minimum length they've been checked against. 500b0ecb56SDag-Erling Smørgrav 510b0ecb56SDag-Erling Smørgrav max=N [max=40] 520b0ecb56SDag-Erling Smørgrav 530b0ecb56SDag-Erling SmørgravThe maximum allowed password length. This can be used to prevent 540b0ecb56SDag-Erling Smørgravusers from setting passwords which may be too long for some system 550b0ecb56SDag-Erling Smørgravservices. 560b0ecb56SDag-Erling Smørgrav 570b0ecb56SDag-Erling SmørgravThe value 8 is treated specially. Passwords longer than 8 characters 580b0ecb56SDag-Erling Smørgravwill not be rejected, but will be truncated to 8 characters for the 590b0ecb56SDag-Erling Smørgravstrength checks and the user will be warned. This is to be used with 600b0ecb56SDag-Erling Smørgravthe traditional crypt(3) password hashes. 610b0ecb56SDag-Erling Smørgrav 620b0ecb56SDag-Erling SmørgravIt is important that you do set max=8 if you're using the traditional 630b0ecb56SDag-Erling Smørgravhashes, or some weak passwords will pass the checks. 640b0ecb56SDag-Erling Smørgrav 650b0ecb56SDag-Erling Smørgrav passphrase=N [passphrase=3] 660b0ecb56SDag-Erling Smørgrav 670b0ecb56SDag-Erling SmørgravThe number of words required for a passphrase, or 0 to disable the 680b0ecb56SDag-Erling Smørgravsupport for passphrases. 690b0ecb56SDag-Erling Smørgrav 700b0ecb56SDag-Erling Smørgrav match=N [match=4] 710b0ecb56SDag-Erling Smørgrav 720b0ecb56SDag-Erling SmørgravThe length of common substring required to conclude that a password is 730b0ecb56SDag-Erling Smørgravat least partially based on information found in a character string, 740b0ecb56SDag-Erling Smørgravor 0 to disable the substring search. Note that the password will not 750b0ecb56SDag-Erling Smørgravbe rejected once a weak substring is found. Instead, the password 760b0ecb56SDag-Erling Smørgravwill be subjected to the usual strength requirements with the weak 770b0ecb56SDag-Erling Smørgravsubstring removed. 780b0ecb56SDag-Erling Smørgrav 790b0ecb56SDag-Erling SmørgravThe substring search is case-insensitive and is able to detect and 800b0ecb56SDag-Erling Smørgravremove a common substring spelled backwards. 810b0ecb56SDag-Erling Smørgrav 820b0ecb56SDag-Erling Smørgrav similar=permit|deny [similar=deny] 830b0ecb56SDag-Erling Smørgrav 840b0ecb56SDag-Erling SmørgravWhether a new password is allowed to be similar to the old one. The 850b0ecb56SDag-Erling Smørgravpasswords are considered to be similar when there's a sufficiently 860b0ecb56SDag-Erling Smørgravlong common substring and the new password with the substring removed 870b0ecb56SDag-Erling Smørgravwould be weak. 880b0ecb56SDag-Erling Smørgrav 890b0ecb56SDag-Erling Smørgrav random=N[,only] [random=42] 900b0ecb56SDag-Erling Smørgrav 910b0ecb56SDag-Erling SmørgravThe size of randomly-generated passwords in bits, or 0 to disable this 920b0ecb56SDag-Erling Smørgravfeature. Passwords that contain the offered randomly-generated string 930b0ecb56SDag-Erling Smørgravwill be allowed regardless of other possible restrictions. 940b0ecb56SDag-Erling Smørgrav 950b0ecb56SDag-Erling SmørgravThe "only" modifier can be used to disallow user-chosen passwords. 960b0ecb56SDag-Erling Smørgrav 970b0ecb56SDag-Erling Smørgrav enforce=none|users|everyone [enforce=everyone] 980b0ecb56SDag-Erling Smørgrav 990b0ecb56SDag-Erling SmørgravThe module can be configured to warn of weak passwords only, but not 1000b0ecb56SDag-Erling Smørgravactually enforce strong passwords. The "users" setting will enforce 1010b0ecb56SDag-Erling Smørgravstrong passwords for non-root users only. 1020b0ecb56SDag-Erling Smørgrav 1030b0ecb56SDag-Erling Smørgrav non-unix [] 1040b0ecb56SDag-Erling Smørgrav 1050b0ecb56SDag-Erling SmørgravBy default, the module uses getpwnam(3) to obtain the user's personal 1060b0ecb56SDag-Erling Smørgravlogin information and use that during the password strength checks. 1070b0ecb56SDag-Erling SmørgravThis behavior can be disabled with "non-unix". 1080b0ecb56SDag-Erling Smørgrav 1090b0ecb56SDag-Erling Smørgrav retry=N [retry=3] 1100b0ecb56SDag-Erling Smørgrav 1110b0ecb56SDag-Erling SmørgravThe number of times the module will ask for a new password if the user 1120b0ecb56SDag-Erling Smørgravfails to provide a sufficiently strong password and enter it twice the 1130b0ecb56SDag-Erling Smørgravfirst time. 1140b0ecb56SDag-Erling Smørgrav 1150b0ecb56SDag-Erling Smørgrav ask_oldauthtok[=update] [] 1160b0ecb56SDag-Erling Smørgrav 1170b0ecb56SDag-Erling SmørgravAsk for the old password as well. Normally, pam_passwdqc leaves this 1180b0ecb56SDag-Erling Smørgravtask for the password changing module. A simple "ask_oldauthtok" will 1190b0ecb56SDag-Erling Smørgravcause pam_passwdqc to ask for the old password during the preliminary 1200b0ecb56SDag-Erling Smørgravcheck phase. With "ask_oldauthtok=update", pam_passwdqc will do that 1210b0ecb56SDag-Erling Smørgravduring the update phase. 1220b0ecb56SDag-Erling Smørgrav 1230b0ecb56SDag-Erling Smørgrav check_oldauthtok [] 1240b0ecb56SDag-Erling Smørgrav 1250b0ecb56SDag-Erling SmørgravThis tells pam_passwdqc to validate the old password before giving a 1260b0ecb56SDag-Erling Smørgravnew password prompt. Normally, this task is left for the password 1270b0ecb56SDag-Erling Smørgravchanging module. 1280b0ecb56SDag-Erling Smørgrav 1290b0ecb56SDag-Erling SmørgravThe primary use for this option is with "ask_oldauthtok=update" in 1300b0ecb56SDag-Erling Smørgravwhich case no other modules have a chance to run and validate the 1310b0ecb56SDag-Erling Smørgravpassword between the prompts. Of course, this will only work with 1320b0ecb56SDag-Erling SmørgravUnix passwords. 1330b0ecb56SDag-Erling Smørgrav 1340b0ecb56SDag-Erling Smørgrav use_first_pass [] 1350b0ecb56SDag-Erling Smørgrav use_authtok [] 1360b0ecb56SDag-Erling Smørgrav 1370b0ecb56SDag-Erling SmørgravUse the new password obtained by modules stacked before pam_passwdqc. 1380b0ecb56SDag-Erling SmørgravThis disables user interaction within pam_passwdqc. With this module, 1390b0ecb56SDag-Erling Smørgravthe only difference between "use_first_pass" and "use_authtok" is that 1400b0ecb56SDag-Erling Smørgravthe former is incompatible with "ask_oldauthtok". 1410b0ecb56SDag-Erling Smørgrav 1420b0ecb56SDag-Erling Smørgrav-- 1430b0ecb56SDag-Erling SmørgravSolar Designer <solar@openwall.com> 144