OpenLDAP password policy pwdCheckModule

OpenLDAP directory server with the ppolicy overlay allows to manage a powerful passwords policy. All aspects of this policy are directly supported by the ppolicy overlay, apart from the password content quality. The passwords content strength management is left to an external plug-in that must be a native shared library. The pqChecker component provides this feature. It allows to check the content of passwords, i.e:

pqChecker allows also:

pqChecker overview

At each modification, or first password entry in the directory, pqChecker is involved. It receives the new value of this attribute and checks its compliance with the defined strength settings. At the end of this control, this value is accepted or rejected.

In addition, it is possible to read and modify the quality settings through pqMessenger component. This feature allows to manage these parameters without any particular system constraint (need to involve a system administrator). It even allows the use of a graphical user interface for this purpose.

Also, pqChecker allows to real-time broadcast the new password value, after its validation. This feature provides the ability to synchronize passwords stored in the OpenLDAP directory with other systems that use it like RDBMS, email servers and other LDAP servers. The passwords broadcasting isn't the default behavior of pqChecker. Default deactivated, It may be activated by simple setting.

pqChecker is a free and opensource software. It is licensed under the GNU GPL v3+ license.

Latest stable version: 2.0.0

How does it works

The ppolicy overlay documentation provides information about the single function that the pqChecker plugin should contain. When OpenLDAP server with ppolicy overlay is installed:

man slapo-ppolicy
...
int check_password (char *pPasswd, char **ppErrStr, Entry *pEntry);
...

The most important parameters are the received password and the value returned to the server.

pqChecker composition

Password content check treatment is performed according settings stored in a text file named pqparams.dat. A system administrator can, manually, modify those settings to make a change of password content quality policy. More effectively, the modification of these settings may be done programmatically. This makes it possible to provide the feature of modifying them through a user-friendly interface. It also allows to avoid involving system administrator to achieve modifying settings. This is why the component provide two additional functions for reading and modifying the passwords strength settings.

When a password is validated, it can be broadcast to other systems, if this feature is enabled in the operating setting. The passwords are broadcast through the pqMessenger middleware.

pqMessenger uses the JNI interface to communicate with pqChecker on one side. On the other side, it communicates with a JMS server. It is an intermediary module between the native pqChecker plug-in and a Java application. An external application which provides the feature of modifying these settings through a user-friendly interface and a data broadcasting feature can use this message transmission chain in a very simple way.

Prerequisites and setting

The ppolicy overlay must be loaded and well configured, see the OpenLDAP administrator guide and password policy setting tutorial for further details. The following command, executed on the server, allows to verify this. The response must shows the ppolicy overlay loaded status ({x}ppolicy).

sudo ldapsearch -Y external -H ldapi:/// -b cn=config "(objectClass=olcModuleList)" -LLL ↵

olcModuleLoad: {0}back_mdb
olcModuleLoad: {1}ppolicy

Especially, take care at 2 settings of this overlay. Assuming ppolicy settings DN is cn=ppolicy,dc=ldaptuto,dc=net, the following command allows to verify those settings values:

sudo ldapsearch -Y external -H ldapi:/// -b cn=ppolicy,dc=ldaptuto,dc=net pwdCheckModule pwdCheckQuality -LLL ↵

pwdCheckQuality: 2
pwdCheckModule: pqchecker.so
pwdCheckQuality Meaning
0 (default value) No check is done, pqChecker is deactivated.
1 Default, the password is accepted. Especially, it's accepted when it's already encrypted or, for some reason, pqChecker does not work. The check is done only if pqChecker works and the password isn't encrypted.
2 Default, the password is rejected. Especially, it's rejected when it's already encrypted or, for some reason, pqChecker does not work. The check is done only if pqChecker works and the password isn't encrypted.

To accept or reject passwords, pqChecker relies on settings stored in a text file: pqparams.dat. A single line of text contains all those settings. 6 fields constitute this line:

Order (left to right) Field Length Sequence Range Meaning of content
1N|2 characters1,20| or 1|1| → Broadcasts passwords, 0| → Don't broadcasts
2UU2 characters3,400 → 99Number of required uppercase characters
3LL2 characters5,600 → 99Number of required lowercase characters
4DD2 characters7,800 → 99Number of required digits
5SS2 characters9,1000 → 99Number of required special characters
6The restindefinite11 → end of lineAll charactersList of forbidden characters. This list may be empty

Versions of pqChecker prior to 2.0 don't support field 1. This field act on passwords broadcasting. Only the last 5 fields are valid for these previous versions. Versions 2.0 and above support both formats.

Deployment and test

pqChecker is deployed on the same machine than OpenLDAP server. Care must be taken, in particular, to the location of two files.

If we try to change the password using a value who not compliant with quality settings, e.g. using the command ldappasswd:

ldappasswd -x -H ldap://localhost -D uid=durand,ou=people,dc=ldaptuto,dc=net -w Dur19@ -s durand ↵

'Constraint violation', code 19

The server responds with a general error message. Further details may be shown in the server log file:

If the modified password is compliant with quality settings, no error message is chown and slapd log look like:
Get and Install It

pqChecker is free & opensource software.It's licensed under the GNU GPL v3+ license. There are binary installation packages, for Debian/Ubuntu & RedHat/CentOS systems, to download from the download section of this website. The source code of the latest stable release is also available in the download section. The history of the source code is available to anonymous download on The Bitbucket platform.

git clone https://bitbucket.org/ameddeb/pqchecker.git

Installation from binary packages is available for Debian/Ubuntu & Redhat/CentOS and compliants systems. The installation procedure is done through the dpkg or rpm utility. The detailed instructions for the installation are given in the README file provided with the binary files. Especially:

sudo dpkg -i pqcheckerxxxxxxx.deb
sudo rpm -iv pqcheckerxxxxxxx.rpm # Install pqChecker

sudo dpkg -r pqchecker
sudo rpm -ev pqchecker # Uninstall it

Security warning: Due to the sensitivity of the data accessed by this software component, never use a binary from untrusted third-party source.

Installation from the source code is available for any POSIX compliant system. The tools of software's build must be installed on the target system: The C compiler, Make utility and the system C header files. Due to use of JNI, the Java JDK 1.8+ is needed also.

Download the source archive of the target version, or get them from the Git repository.

git tag # lists all the available stable releases
git checkout v2.0.0 # provides the sources of this stable version

The INSTALL file contains all the instructions to complete this operation. Especially:

./configure xxxx xxxx xxxx # prepares the build of pqChecker in compliance with the target system
sudo make install # allows pqChecker installation
sudo make uninstall # allows its uninstallation