Limit the maximum number of sequential characters in passwords
Limits how long a monotonic sequence (e.g. abcd, 1234) may run in a password by setting maxsequence = 3.
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 strong password increases the time and resources needed to compromise it. The maxsequence parameter rejects passwords containing long monotonic runs such as abcd, 4321 or qwerty-style sequences. These ordered patterns are tested early by password-cracking tools and drastically reduce effective entropy. Capping sequences at 3 forces less predictable passwords and broadens the search space attackers must cover.
What Pavois checks
Pavois reads the effective maxsequence 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 <= 3 (and non-zero, since 0 disables the check).
describe command('v=$(grep -rh \'^[[:space:]]*maxsequence[[:space:]]*=\' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/ 2>/dev/null | tail -1 | grep -oE \'[-]?[0-9]+\'); { [ -n "$v" ] && [ "$v" -le 3 ] && echo ok; } || echo ko') do
its('stdout.strip') { should eq 'ok' }
endHow to verify it is applied
Run grep -rh '^[[:space:]]*maxsequence' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/ | tail -1. The effective line must read maxsequence = 3 (or any value 1..3).
Inspect & investigate
Password changes rejected for monotonic sequences are logged via PAM in /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL family) with pam_pwquality messages like "Too long monotonic character sequence". Inspect the live setting with grep -r maxsequence /etc/security/pwquality.conf.d/.
Remediation
pavois harden apply writes maxsequence = 3 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 | maxsequence |
| resource | keyval |
| value | 3 |
pavois harden plan localwhere the target is local, a user@host SSH alias, or a container , Docs
Impact & precautions
Existing passwords stay valid; only new passwords are constrained. Users picking passwords with sequences longer than 3 (e.g. abcde, 12345) will be rejected. Lockout risk is minimal. Note this parameter is unavailable on AlmaLinux 9 (hence not in supported_os); setting maxsequence = 0 would disable the check, so confirm the value is 1..3.
Standards mapping
| Standard | Reference | Type | Version | Confidence |
|---|---|---|---|---|
| CIS | 5.3.3.2.5 | direct | per OS, see the benchmark table | high |
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.