I have OpenLDAP 2.4.44 running on CentOS 7.4 with a "tester" user added. I can query the user and change the password, but when authenticating with the GNOME login screen is always rejected. I used this guide to set things up.
The LDIF files I used to set the system up are as follows:
db.ldif
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=example
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=ldapadm,dc=example
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: <omitted>
monitor.ldif
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=ldapadm,dc=example" read by * none
base.ldif
dn: dc=example
dc: example
objectClass: top
objectClass: domain
dn: cn=ldapadm,dc=example
objectClass: organizationalRole
cn: ldapadm
description: LDAP Manager
dn: ou=People,dc=example
objectClass: organizationalUnit
ou: People
dn: ou=Groups,dc=example
objectClass: organizationalUnit
ou: Groups
certs.ldif (these certs were created and owner/group changed to ldap:ldap)
dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/managerldapcert.pem
dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/openldap/certs/managerldapkey.pem
tester.ldif
dn: uid=tester,ou=People,dc=example
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: tester
uid: tester
uidNumber: 9001
gidNumber: 100
homeDirectory: /home/tester
loginShell: /bin/bash
gecos: Tester Account
userPassword: {crypt}x
shadowLastChange: 0
shadowMax: 0
shadowWarning: 0
To show the account information for the user:
ldapsearch -x cn=tester -b dc=example
The response is as follows:
# extended LDIF
#
# LDAPv3
# base <dc=example> with scope subtree
# filter: cn=tester
# requesting: ALL
#
# tester, People, example
dn: uid=tester,ou=People,dc=example
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: tester
uid: tester
uidNumber: 9001
gidNumber: 100
homeDirectory: /home/tester
loginShell: /bin/bash
gecos: Tester Account
shadowLastChange: 0
shadowMax: 0
shadowWarning: 0
userPassword:: <omitted>
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
I can change the password using the following:
ldappasswd -H ldap:/// -x -D "cn=ldapadm,dc=example" -W -S "uid=tester,ou=People,dc=example"
This prompts for the new user password (twice) and the LDAP root password, then exits. I can observe that the password changed by re-querying using ldapsearch (where the userPassword:: section changes).
I can log into the LDAP account to verify the password by using:
ldapwhoami -vvv -h ldapi:/// -p 389 -D "uid=tester,ou=People,dc=example" -x -W
I then set up authconfig using:
authconfig --enableldap --enableldapauth --ldapserver=servername.example --ldapbasedn="dc=example" --enablemkhomedir --update
But, when I try and use the CentOS GNOME login screen, the password is rejected.
In /var/log/secure I see the following:
pam_sss(gdm-password:auth): authentication failure; logname= uid=0 euid=0 tty=/dev/tty1 ruser= rhost= user=tester
pam_sss(gdm-password:auth): received for user tester: 6 (Permission denied)
Things I have tried without success:
- Disabling SELinux (as a test, not because its a possible solution)
- Setting
FORCELEGACY=yes
in/etc/sysconfig/authconfig
per this post - Using
system-config-authentication
and other suggestions at this link - Installing the certificate I created using the suggestion here
My question is... how is CentOS 7 trying to log in (and how can I emulate the login attempt using ldapwhoami), and how can this be better debugged/logged? Does my user DN seem reasonable (using uid instead of cn for the first entry; I've seen it done both ways in different guides)?
Any help is appreciated!