
pam_cracklib to complicate passwords on Red Hat 6 or CentOS systems. In Red Hat 7, pam_pwquality replaced cracklib as the pam module for checking passwords. The pam_pwquality module pam_pwquality also supported in Ubuntu and CentOS, as well as in many other operating systems. This module simplifies the creation of password policies to ensure that users accept your password complexity standards. cracklib module. This approach simplifies porting your policies from the old system./etc/security/pwquality.conf file to increase the password complexity requirements. Below is an example of a file with comments for better understanding. # Make sure 5 characters in new password are new compared to old password difok = 5 # Set the minimum length acceptable for new passwords minlen = 15 # Require at least 2 digits dcredit = -2 # Require at least 2 upper case letters ucredit = -2 # Require at least 2 lower case letters lcredit = -2 # Require at least 2 special characters (non-alphanumeric) ocredit = -2 # Require a character from every class (upper, lower, digit, other) minclass = 4 # Only allow each character to be repeated twice, avoid things like LLL maxrepeat = 2 # Only allow a class to be repeated 4 times maxclassrepeat = 4 # Check user information (Real name, etc) to ensure it is not used in password gecoscheck = 1 # Leave default dictionary path dictpath = # Forbid the following words in passwords badwords = password pass word putorius minclass parameter minclass redundant since we already use at least two characters from the class using the [u,l,d,o]credit fields. Our list of words that cannot be used is also redundant, since we have forbidden the repetition of any class 4 times (all words in our list are written with lowercase letters). I enabled these options only to demonstrate how to use them to configure password policies.[u,l,d,o]credit contain a negative number. This is because numbers greater than or equal to 0 will give credit for using the character in your password. If the field contains a negative number, this means that a certain amount is required.(u,l,d,o)credit set to 1, and the required password length is 6, then you will need 6 characters to meet the length requirement, because each character is upper case, lower case, digit or another character will give you one loan.dcredit to 2, you can theoretically use a password of 9 characters in length and get 2 credits per character for numbers and then the password can already be 10. $ pwscore Thisistwelve Password quality check failed: The password is shorter than 13 characters $ pwscore Th1sistwelve 18 libpwquality package provides the functionality described in the article. It also comes with the pwscore program, which is designed to check the password for complexity. We used it above to check loans.pwscore utility reads from stdin . Just run the utility and write your password, it will give an error or a value from 0 to 100.minlen parameter in the configuration file. In general, an indicator less than 50 is considered as a “normal password”, and above - as a “strong password”. Any password that passes quality checks (especially a forced cracklib check) must withstand dictionary attacks, and a password with a score above 50 with the minlen setting by default even a brute force attack.pwquality is easy and simple compared to the inconvenience of using cracklib with direct editing of pam files. In this guide, we covered everything you need when setting up password policies in Red Hat 7, CentOS 7, and even Ubuntu systems. We also talked about the concept of loans, which are rarely written in detail, so this topic has often remained incomprehensible to those who have not previously encountered it.Source: https://habr.com/ru/post/448996/
All Articles