Score:1

OpenLDAP ppolicy working with passwd, but not ldappasswd

zw flag

I've been working on this for about a week, and can't seem to figure out why this is happening.

I've got passwd working, letting users change their own ldap password from a client machine, and it working with the ppolicy overlay:

$ passwd
Current Password: 
New password: 
BAD PASSWORD: The password is shorter than 8 characters
New password: 
BAD PASSWORD: The password is a palindrome
New password: 
BAD PASSWORD: The password is the same as the old one
passwd: Have exhausted maximum number of retries for service
passwd: password unchanged

However, when I use ldappasswd to change my password, it allows me to create one letter passwords, and palindromes, but not passwords in my history:

$ ldappasswd -H ldap://**** -x -D "uid=test,ou=Users,dc=***,dc=***,dc=***" -W -A -S
Old password: 
Re-enter old password: 
New password: 
Re-enter new password: 
Enter LDAP Password: 
$
# no issues entering "a" as the password (this is bad)
$ ldappasswd -H ldap://**** -x -D "uid=test,ou=Users,dc=***,dc=***,dc=***" -W -A -S
Old password: 
Re-enter old password: 
New password: 
Re-enter new password: 
Enter LDAP Password: 
Result: Constraint violation (19)
Additional info: Password is in history of old passwords
$
# entered "password" as the password and it doesn't let me change it

Ideally, I'd like both passwd and ldappasswd to follow the password policy.

Here are my access rules in the slapd config:

/etc/ldap/slapd.d/cn=config/olcDatabase={1}mdb.ldif

...
# manager is the root bind dn, with password in /etc/ldap.secret
olcAccess: {0}to attrs=userPassword,shadowLastChange by self write by dn.base="uid=manager,ou=Users,dc=***,dc=***,dc=***" write by anonymous auth by * none
olcAccess: {1}to * by * read by dn.base="uid=manager,ou=Users,dc=***,dc=***,dc=***" write
...

It seems to me like passwd is binding to the root dn, because removing the access for the manager account makes passwd stop working entirely, and ldappasswd is unaffected.

Any help is appreciated.

Score:1
fr flag

Those messages from passwd do not look like they come from the ppolicy overlay at all. They come from local checks done by other PAM modules, most likely pam_cracklib. Naturally, local PAM configuration will have no effect on tools that directly contact the LDAP server.

In other words, that sounds like your local tools are working fine, but the ppolicy overlay is not working right (i.e. it's not correctly enforcing the min-length limit; your local config was enforcing that instead).

(And on a different note, if your PAM LDAP configuration is set up to bind using the "manager" DN... that's kind of bad. It means anyone who gets root – or even just a "file read" exploit – on any server can immediately get the manager password from /etc/ldap.conf and obtain full access to your LDAP directory.)

zmehall avatar
zw flag
You're right, the pam configurations are all over the place and I did have cracklib installed, I'm moving away from using the passwd command and just having users change their password with ldappasswd, thank you for the help though.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.