Password Reuse, Refused By A Host That Remembers
EL remembers nothing: pam_pwhistory is not in the authentication stack, the history file is empty, and a password can be put straight back. Measured, three changes, there and back. This role writes the policy, adds the module through authselect, and proves the refusal by attempting the reuse and reading the reason PAM gives for it. Original role, live-tested on Rocky Linux 10.
Verification
Live-testedReally deployed to a container sandbox, proven idempotent (a second run changes nothing), verified against the role’s assertions, then torn down.
Conformance
- Static validation (yamllint · ansible-lint)
Provenance
- SHA-256 checksum
- Signature (pending)
Functional
- Live-tested - applied, verified, destroyed
Last verified 2026-09-27 · podman 4.9.3 · ansible 2.21.4 · how we verify
Cite it in your README
badge · attributionPaste this beside the module in the repository that uses it. The badge is rendered from this artifact's verification record, so it reads live-tested because the record says so, and the link lands on this page.
[](https://www.iac-bazaar.com/catalog/ansible-pam-pwhistory?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
Ansible role 1.0.0, live-tested on IaC Bazaar: [Password Reuse, Refused By A Host That Remembers](https://www.iac-bazaar.com/catalog/ansible-pam-pwhistory?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
```yaml
# Password Reuse, Refused By A Host That Remembers: https://www.iac-bazaar.com/catalog/ansible-pam-pwhistory (download from your IaC Bazaar account)
```Preview:
Documentation
pam-pwhistory
An EL host does not remember passwords, so one can be put straight back.
pam_pwhistory is not in the authentication stack, /etc/security/pwhistory.conf
ships with nothing active in it, and /etc/security/opasswd - where the history
would live - is an empty file. Measured: three changes, A to B and back to A, all
accepted, with opasswd still zero bytes afterwards. This role writes the policy,
puts the module into the stack through authselect, and proves the refusal by
attempting the reuse.
No download, and no version to pin. pam and authselect are EL 10 packages.
What the role owns is pwhistory.conf, the mode of the history file, and one
authselect feature - and what it proves is that a password the host has already
seen is refused, for that reason.
enforce_for_root is not about root's password. It is about who is making the
change. The check is skipped whenever the calling process is root - so with this
option off, an administrator resetting somebody else's password bypasses the
history entirely, which is how most passwords are reset. The mutation matrix is
what established that: turning the option off was expected to affect only root's
own account and instead let an ordinary account's reuse through, because the test
makes its changes as root. Root's own reuse is the smaller half of the same fact:
without the option it prints "Password has been already used" and then reports
"authentication token altered successfully".
chpasswd run as root bypasses the history entirely. Measured: with this
policy in force and the password in the history, echo user:password | chpasswd
succeeded and the account then authenticated with it. chpasswd writes
/etc/shadow and never asks PAM, so the live test drives pamtester instead -
the same lesson the password-quality role in this catalogue paid for.
The file is what turns the control on, not just what tunes it. With
pwhistory.conf left exactly as the distribution ships it - every line a comment
- a reuse was accepted even with the module in the authentication stack. So both
halves of this role are load-bearing: the authselect feature that puts
pam_pwhistoryin the stack, and the policy file that gives it something to enforce. Measured by pointing the role's file elsewhere and watching the refusal disappear.
Nothing validates pwhistory.conf, and a bad value fails OPEN. With
remember = notanumber the module printed its complaint and the change went
through. remember = 0 disables the check outright, which was measured with two
identical changes in a row, both accepted. So the test attempts a reuse rather
than reading the number back out of the file.
A refusal does not say which rule refused. pam_pwquality is in the same
stack and refuses passwords for length, class and dictionary reasons. This test
asserts the message - "already used" - so the assertion is tied to the history
and not to whichever rule happened to object.
Getting the test client right took two attempts, and the failure looked like a
policy refusal. Run as root, the passwd stack does not ask for the current
password, so a change is TWO lines and not three; fed three, every change failed
with "Sorry, passwords do not match", which reads exactly like a rule rejecting
the password. And printf '%s' with no trailing newline leaves pamtester waiting
on a line that never ends.
License
Commercial - IaC Bazaar EULA. (c) IaC Bazaar.
Usage code & full reference need an account
The complete copy-paste usage, the full input/output reference, and operational notes are free with an account - shown here and bundled in the download. Sign in and this section fills in.
- Variables
- Test
Related modules
ansible-lynis
Lynis from EPEL on a systemd timer, with the units the package keeps only in its docs, your skipped tests in custom.prf, and a minimum hardening index below which the audit unit fails, so a falling score shows as a failed unit. The live test runs the audit, reads the index and the tests that ran, and finds the timer enabled. Original role, live-tested on Rocky Linux 10.
ansible-suricata
Suricata from EPEL watching the default-route interface as the suricata user, ET Open fetched at install and refreshed daily, plus a canary rule that proves the sensor is alive. A root-run check left root-owned logs and a daemon recording nothing; the role prevents it. The live test raises the canary alert while a second lookup is logged, not alerted. Original role, live-tested on Rocky Linux 10.
ansible-aide
AIDE from AppStream on EL 10: a watched tree, a baseline database built once, and the oneshot unit and timer the package does not ship. The live test passes on an unchanged host, FAILS when a file appears inside a watched path and names it, ignores one inside an excluded path, and passes again once the change is gone. Original role, live-tested on Rocky Linux 10.
ansible-389-ds
389 Directory Server from AppStream. A fresh instance listens on every interface and lets anonymous clients read the tree; this role binds both listeners to loopback and limits anonymous clients to the rootDSE. The live test adds a user who binds, sees a wrong password and an anonymous search refused, and reads the LDAPS certificate. Original role, live-tested on Rocky Linux 10.
ansible-krb5-kdc
An MIT Kerberos KDC: the realm created once with a stash, kadmind behind an ACL, a default policy that locks an account after five wrong passwords, every listener on loopback. The KDC starts on a broken config without a word, so the live test proves each setting by behaviour: the ticket lifetime, the refusals, the lockout. Original role, live-tested on Rocky Linux 10.
ansible-authelia
Authelia from the upstream release (sha256-verified) as a hardened system service on loopback with file users and sqlite; its secrets are generated once on the host and reach the service as AUTHELIA_*_FILE variables. The live test hashes a password with Authelia's hasher, logs in, sees a wrong password refused and an anonymous visitor sent to the portal. Original role, live-tested on Rocky 10.