Ensure PAM Enforces Password Requirements - Minimum Different Categories
Forces pam_pwquality to require characters from at least 4 distinct classes (lowercase, uppercase, digits, special) in every new password by setting minclass = 4.
Checked against the content of a persistent configuration file, the source of truth that survives reboots.
A mapping is a cross-reference to where each standard places this requirement, anchored and cross-validated, not a claim of equivalence. A passing check is evidence toward these references, how to read it.
Why this rule matters
A complex password increases the time and resources needed to compromise it. The minclass parameter requires a minimum number of distinct character categories (lowercase, uppercase, digits, special). Demanding 4 categories enlarges the search space far more than length alone and resists pattern-based guessing. Without it, a long but single-category password (e.g. all letters) remains weak against dictionary and rule-based attacks.
What Pavois checks
Pavois reads the effective minclass value across /etc/security/pwquality.conf and all drop-ins under /etc/security/pwquality.conf.d/, keeping the last definition that wins at runtime. A file-based scanner reading only the main config would miss a value set in a drop-in. The control passes only when the resolved value is >= 4.
describe command('v=$(grep -rh \'^[[:space:]]*minclass[[:space:]]*=\' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/ 2>/dev/null | tail -1 | grep -oE \'[-]?[0-9]+\'); { [ -n "$v" ] && [ "$v" -ge 4 ] && echo ok; } || echo ko') do
its('stdout.strip') { should eq 'ok' }
endHow to verify it is applied
Run grep -rh '^[[:space:]]*minclass' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/ | tail -1. The effective line must read minclass = 4 (or any value >= 4).
Inspect & investigate
Password changes rejected for too few character classes are logged via PAM in /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL family) with pam_pwquality messages like "not enough character classes". Inspect the live setting with grep -r minclass /etc/security/pwquality.conf.d/.
Remediation
pavois harden apply writes minclass = 4 to the drop-in /etc/security/pwquality.conf.d/99-Pavois.conf via the idempotent keyval resource. The 99- prefix ensures it overrides any earlier value. No service restart is needed; it applies at the next password change.
Pavois applies this with its own harden engine, the plan below, not a shell script:
| file | /etc/security/pwquality.conf.d/99-pavois.conf |
|---|---|
| key | minclass |
| resource | keyval |
| value | 4 |
pavois harden plan localwhere the target is local, a user@host SSH alias, or a container , Docs
Impact & precautions
Requiring all 4 classes is strict and may conflict with per-class credit settings; note that minclass and the Xcredit parameters interact in pwquality. Existing passwords stay valid; only new passwords must span 4 classes. Lockout risk is low, but before applying confirm provisioning and rotation tooling generate four-class passwords, and consider that some org policies prefer length over forced classes.
Standards mapping
| Standard | Reference | Type | Version | Confidence |
|---|---|---|---|---|
| ANSSI BP-028 | R68 | direct | 2.0 | high |
| CIS | 5.3.3.2.3 | direct | per OS, see the benchmark table | high |
| NIST | CM-6(a), IA-5(1)(a), IA-5(4), IA-5(c) | supporting | 800-53 Rev 5 · 800-171 Rev 2 (pinned) | medium |
Each reference is a cross-reference anchored in the upstream benchmark and cross-validated against the SCAP Security Guide and ansible-lockdown, not a claim of equivalence. Direct = a prescriptive, line-level requirement; supporting = an abstract control family (NIST) the check provides evidence toward. How to read a mapping.