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.

ansibleSecurity & Secrets

Verification

Live-tested

Really 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 · attribution

Paste 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.

README.md, GitLab, Gitea
[![IaC Bazaar: live-tested](https://www.iac-bazaar.com/api/artifacts/ansible-pam-pwhistory/badge)](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:IaC Bazaar: live-tested

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_pwhistory in 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

Live-tested

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.

View module
Live-tested

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.

View module
Live-tested

ansible-bandit

bandit on EL 10 from PyPI into a venv of its own with a link in the PATH; the live test runs pip check, then scans a module that passes a string to subprocess.call with shell=True (B602, High, exit 1) and a clean module (exit 0). Pinned. Original role, live-tested on Rocky Linux 10.

View module
Live-tested

ansible-boundary

boundary on EL 10 from releases.hashicorp.com; SHA256SUMS is signature-checked against HashiCorp's key before get_url trusts it, the live test re-checks both, then runs authenticate against a dead address ('connection refused') and database init with a throwaway config (parsed, root key loaded, then the database refused). Pinned. Original role, live-tested on Rocky Linux 10.

View module
Live-tested

ansible-dockle

dockle on EL 10 from the GitHub release; get_url refuses it unless its SHA-256 is in the vendor's checksums file, and the live test re-checks it, then scans a one-layer image whose config names no user, expecting CIS-DI-0001 in the output, exit code 1 with --exit-level warn, and the warning counted in the JSON form. Pinned. Original role, live-tested on Rocky Linux 10.

View module
Live-tested

ansible-gitleaks

gitleaks on EL 10 from the GitHub release, refused by Ansible's get_url unless its SHA-256 is the one in the project's checksums file, and re-checked with sha256sum -c by the live test, which then plants a file holding an AWS access key that is not one and runs gitleaks detect over it, expecting 'leaks found: 1'. Original role, live-tested on Rocky Linux 10.

View module