passwordpolicy
passwordpolicy : Dynamically configurable PostgreSQL password complexity checks.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 7040 | passwordpolicy | passwordpolicy | 2.0.5 |
SEC | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_pwhash passwordcheck passwordcheck_cracklib credcheck chkpass pg_enigma column_encrypt |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.0.5 |
18 17 16 15 14 | passwordpolicy |
- |
| RPM | PGDG | 2.0.5 |
18 17 16 15 14 | passwordpolicy_$v |
cracklib |
| DEB | PIGSTY | 2.0.5 |
18 17 16 15 14 | postgresql-$v-passwordpolicy |
cracklib-runtime, libcrack2 |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el8.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el9.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el9.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el10.x86_64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| el10.aarch64 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 | PGDG 2.0.5 |
| d12.x86_64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| d12.aarch64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| d13.x86_64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| d13.aarch64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u22.x86_64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u22.aarch64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u24.x86_64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u24.aarch64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u26.x86_64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
| u26.aarch64 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 | PIGSTY 2.0.5 |
Source
github.com/fmbiete/passwordpolicy
passwordpolicy-2.0.5.tar.gz
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
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.