Skip to content

passwordcheck_cracklib

Strengthen PostgreSQL user password checks with cracklib

Overview

PackageVersionCategoryLicenseLanguage
passwordcheck_cracklib3.2.1SECLGPL-2.1C
IDExtensionBinLibLoadCreateTrustRelocSchema
7000passwordcheck_cracklibNoYesYesNoNoNo-

Preload-only; requires cracklib dictionaries.

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY3.2.11817161514passwordcheck_cracklib-
RPMPIGSTY3.2.11817161514passwordcheck_cracklib_$vcracklib-dicts
DEBPIGSTY3.2.11817161514postgresql-$v-passwordcheck-cracklibcracklib-runtime, libcrack2
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
d12.aarch64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
d13.x86_64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
d13.aarch64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u22.x86_64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u22.aarch64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u24.x86_64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u24.aarch64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u26.x86_64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
u26.aarch64
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1
PIGSTY 3.2.1

Build

You can build the RPM / DEB packages for passwordcheck_cracklib using pig build:

pig build pkg passwordcheck_cracklib         # build RPM / DEB packages

Install

You can install passwordcheck_cracklib directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

Install
pig install passwordcheck_cracklib;          # Install for current active PG version
pig
pig ext install -y passwordcheck_cracklib -v 18  # PG 18
pig ext install -y passwordcheck_cracklib -v 17  # PG 17
pig ext install -y passwordcheck_cracklib -v 16  # PG 16
pig ext install -y passwordcheck_cracklib -v 15  # PG 15
pig ext install -y passwordcheck_cracklib -v 14  # PG 14
dnf
dnf install -y passwordcheck_cracklib_18       # PG 18
dnf install -y passwordcheck_cracklib_17       # PG 17
dnf install -y passwordcheck_cracklib_16       # PG 16
dnf install -y passwordcheck_cracklib_15       # PG 15
dnf install -y passwordcheck_cracklib_14       # PG 14
apt
apt install -y postgresql-18-passwordcheck-cracklib   # PG 18
apt install -y postgresql-17-passwordcheck-cracklib   # PG 17
apt install -y postgresql-16-passwordcheck-cracklib   # PG 16
apt install -y postgresql-15-passwordcheck-cracklib   # PG 15
apt install -y postgresql-14-passwordcheck-cracklib   # PG 14

Preload:

shared_preload_libraries = '$libdir/passwordcheck_cracklib';

Usage

Sources:

passwordcheck_cracklib checks passwords supplied through CREATE ROLE and ALTER ROLE with CrackLib. It is a server hook library, with no SQL extension objects.

Enable the Hook

Add it to the existing preload list and restart PostgreSQL:

shared_preload_libraries = '$libdir/passwordcheck_cracklib'

Do not run CREATE EXTENSION passwordcheck_cracklib. CrackLib’s library and dictionary must be available to the PostgreSQL operating-system account.

Password Checks

CREATE ROLE app_user LOGIN PASSWORD 'password123';

Weak plaintext passwords cause an error. The hook checks length, the relationship to the username, character composition, and the CrackLib dictionary. A password passing those checks is not a guarantee of resistance to every attack.

Security Boundary

Dictionary checks require the plaintext password at password-change time. When a client supplies an already hashed password, the module cannot perform full strength checks; its remaining check is whether the password equals the username. Enforce the intended password-change path and protect the connection carrying plaintext passwords.

Existing passwords are not scanned retroactively. The hook also chains to a previously installed password-check hook; review other credential-policy libraries before loading them together.

Was this page helpful?