5.3.3.2.2 Ensure password length is configured

Information

minlen - Minimum acceptable size for the new password (plus one if credits are not disabled which is the default). Cannot be set to lower value than 6.

Strong passwords protect systems from being hacked through brute force methods.

Solution

Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set password length of 14 or more characters. Ensure that password length conforms to local site policy:

Example:

# sed -ri 's/^s*minlens*=/# &/' /etc/security/pwquality.conf
# printf '
%s' "minlen = 14" >> /etc/security/pwquality.conf.d/50-pwlength.conf

Run the following script to remove setting minlen on the pam_pwquality.so module in the PAM files:

#!/usr/bin/env bash

{
for l_pam_file in system-auth password-auth; do
l_authselect_file="/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file"
sed -ri 's/(^s*passwords+(requisite|required|sufficient)s+pam_pwquality.so.*)(s+minlens*=s*[0-9]+)(.*$)/14/' "$l_authselect_file"
done
authselect apply-changes
}

See Also

https://workbench.cisecurity.org/benchmarks/18210

Item Details

Category: IDENTIFICATION AND AUTHENTICATION

References: 800-53|IA-5(1), CSCv7|4.4

Plugin: Unix

Control ID: 460ea2ee6195adfe4952d31877d91a52239a79d6d6b4cd8f6b84fdfd1d3530cc