passwordpolicy
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
passwordpolicy | 2.0.5 | SEC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7040 | passwordpolicy | No | Yes | Yes | Yes | No | Yes | - |
PGDG RPM and Pigsty DEB package fmbiete/passwordpolicy 2.0.5; requires shared_preload_libraries and cracklib runtime.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 2.0.5 | 1817161514 | passwordpolicy | - |
| RPM | PGDG | 2.0.5 | 1817161514 | passwordpolicy_$v | cracklib |
| DEB | PIGSTY | 2.0.5 | 1817161514 | postgresql-$v-passwordpolicy | cracklib-runtime, libcrack2 |
Build
You can build the RPM / DEB packages for passwordpolicy using pig build:
Install
You can install passwordpolicy directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources: README, v2.0.5 release, control file
passwordpolicy is a configurable replacement for PostgreSQL’s passwordcheck module. It checks passwords during CREATE ROLE and ALTER ROLE, can enforce password history and validity rules, and can simulate soft account locks after repeated failed logins.
Enable The Hook
Load the module before other password-check modules, then restart PostgreSQL:
Install the SQL extension in the postgres database when using account soft-lock or password-history features:
Password Complexity
Settings are dynamic, but new values apply to new sessions:
Enable CrackLib dictionary checks only after creating the dictionary file:
Soft Account Lock
Soft-locking tracks failed login attempts and delays/rejects responses after the configured threshold:
Inspect and reset lock state:
If password_policy_lock.include_all = false, only roles listed in passwordpolicy.accounts_lockable are considered for soft-lock.
Password History
Password history stores recent password hashes in the postgres database and checks new passwords against them:
Caveats
- Version 2.0.5 supports PostgreSQL 14-18.
- This module must be preloaded; changing
shared_preload_librariesrequires a restart. - PostgreSQL cannot truly block authentication before it happens, so soft-lock simulates the lock by delaying and returning an error. It does not mitigate authentication DoS attacks.
- Size
password_policy_lock.max_number_accountsandpassword_policy_history.max_number_accountsrealistically to avoid wasted memory or missed accounts.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)