Vulnerability Discussion
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. "pwquality" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system.
Check
Verify the Ubuntu operating system has the libpam-pwquality package installed, by running the following command:
# dpkg -l libpam-pwquality
ii libpam-pwquality:amd64 1.4.0-2 amd64 PAM module to check password strength
If "libpam-pwquality" is not installed, this is a finding.
Verify the operating system uses "pwquality" to enforce the password complexity rules.
Verify the pwquality module is being enforced by the Ubuntu Operating System, by running the following command:
# grep -i enforcing /etc/security/pwquality.conf
enforcing = 1
If the value of "enforcing" is not 1 or the line is commented out, this is a finding.
Check for the use of "pwquality" with the following command:
# sudo cat /etc/pam.d/common-password | grep requisite | grep pam_pwquality
password requisite pam_pwquality.so retry=3 enforce_for_root
If no output is returned or the line is commented out, this is a finding.
If the value of "retry" is set to "0" or greater than "3", this is a finding.
If "enforce_for_root" is missing from the configuration line, this is a finding.
Fix
Configure the operating system to use "pwquality" to enforce password complexity rules.
Install the pam_pwquality package by using the following command:
# apt-get install libpam-pwquality -y
Add the following line to "/etc/security/pwquality.conf" (or modify the line to have the required value):
enforcing = 1
Add the following line to "/etc/pam.d/common-password" (or modify the line to have the required value):
password requisite pam_pwquality.so retry=3 enforce_for_root
Note: The value of "retry" should be between "1" and "3".