CentOS 5.2 LDAP/kerberos authentication fails against Active Directory
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
CentOS 5.2 LDAP/kerberos authentication fails against Active Directory
I have a CentOS 5.2 installation doing LDAP lookups and kerberos authentication against Active Directory 2003. NSCD is enabled. If no LDAP user logs in to the system for 24 hours (exact number unknown) then the first auth attempt will fail for several attempts but eventually succeed. After the first failure, another LDAP user can log in fine but the original user trying to log in will continue to fail for several attempts (approximately 25 seconds).
Nothing shows up in the logs. Root can log in and can run getent passwd, getent group, and id $ldapuser with correct results. I had not considered the NFS mounted home directories though. They are mounted with Autofs, but Autofs never gave any kind of error in the logs. If my home directory wasn't mounting, then I would get a permission denied error, not an authentication error. However, I'll look in to it further.
Nothing shows up in the logs. Root can log in and can run getent passwd, getent group, and id $ldapuser with correct results. I had not considered the NFS mounted home directories though. They are mounted with Autofs, but Autofs never gave any kind of error in the logs. If my home directory wasn't mounting, then I would get a permission denied error, not an authentication error. However, I'll look in to it further.
Crap, well if you can get user info, it's not that you're not connected to the directory... Sorry, I guess I should clarify, can you do getent passwd / group with NSCD off?
Assuming you can, to me that seems pretty clear your connection to the directory is fine so maybe Kerberos is the thing to look at but I have much less experience with that (read: next to none). I guess the only thing I know to check there is that your system time is okay. It's not like your system clock has drifted out of that magical 5 minute range and then just happens to get corrected soon thereafter?
Somehow, I suspect you've already got your system time checked and under control... Sorry, I don't know what else it could be.
AutoFS is definitely not the issue. NSCD was disabled. I started experiencing the problem this morning and managed to log in to a local account on the system. Let's say I have an LDAP user with username foo. If I log in as root, the command '# id foo' fails with "id: foo: No such user". However, the command '# getent passwd' returns the list of users, both local and LDAP, correctly. After waiting a few seconds, the foo user is available again and can be logged in to. So the issue is not Kerberos. The issue is not NSCD. The issue is not AutoFS. That just leaves NSS right?
AutoFS is definitely not the issue. NSCD was disabled. I started experiencing the problem this morning and managed to log in to a local account on the system. Let's say I have an LDAP user with username foo. If I log in as root, the command '# id foo' fails with "id: foo: No such user". However, the command '# getent passwd' returns the list of users, both local and LDAP, correctly. After waiting a few seconds, the foo user is available again and can be logged in to. So the issue is not Kerberos. The issue is not NSCD. The issue is not AutoFS. That just leaves NSS right?
That's got to be NSS-LDAP. I looked at your config again and I still don't see anything awry... Maybe changing the bind_policy would be good? Sorry, don't know about that.
Can you check authconfig and see if it shows anything out of place?
I don't have Kerberos on my systems, but here's my output of authconfig --test for your reference (with disabled sections snipped for brevity):
Code:
caching is disabled
nss_files is always enabled
nss_compat is disabled
nss_db is disabled
nss_hesiod is disabled
nss_ldap is enabled
LDAP+TLS is disabled
LDAP server = "ldap://dc1.pointgrey.local/,ldap://dc2.pointgrey.local/"
LDAP base DN = "DC=pointgrey,DC=local"
nss_nis is disabled
nss_nisplus is disabled
nss_winbind is disabled
nss_wins is disabled
pam_unix is always enabled
shadow passwords are enabled
password hashing algorithm is md5
pam_krb5 is disabled
pam_ldap is enabled
LDAP+TLS is disabled
LDAP server = "ldap://dc1.pointgrey.local/,ldap://dc2.pointgrey.local/"
LDAP base DN = "DC=pointgrey,DC=local"
pam_pkcs11 is disabled
pam_smb_auth is disabled
pam_winbind is disabled
pam_cracklib is enabled (try_first_pass retry=3)
pam_passwdqc is disabled ()
pam_access is disabled ()
pam_mkhomedir is disabled ()
Always authorize local users is enabled ()
Authenticate system accounts against network services is disabled
I had both the host and uri set in /etc/ldap.conf. This was causing some weird output from authconfig --test. I doubt it was significant, but I'm going to try with just the uri set and see what happens.
We are seeing a very similar issue under RedHat 5.1 doing both lookups and authentication using LDAP against Active Directory. NSCD is enable and we have been suspecting it but have not yet found the smoking gun. Have you made any headway since your last post?
Nope. No progress. The problem exists on some machines, but not others while they all have identical configurations. If you have any ideas, I'm more than willing to collaborate on solving it.
I've been experiencing the same issue with my setup. To fix it, I had to update the nss_map entries.
I replaced/add the following lines to /etc/ldap.conf
# Services for UNIX 3.5 mappings
nss_map_objectclass posixAccount User
nss_map_objectclass shadowAccount User
nss_map_attribute uid msSFU30Name
nss_map_attribute uidNumber msSFU30UidNumber
nss_map_attribute gidNumber msSFU30GidNumber
nss_map_attribute loginShell msSFU30LoginShell
nss_map_attribute gecos name
nss_map_attribute uniqueMember msSFU30PosixMember
nss_map_attribute userPassword msSFU30Password
nss_map_attribute homeDirectory msSFU30HomeDirectory
nss_map_objectclass posixGroup Group
nss_map_attribute cn cn
pam_login_attribute msSFU30Name
pam_member_attribute msSFU30PosixMember
pam_filter objectclass=User
pam_password md5
As soon, as theses entries were added. I've been able to use AD to auth myself. This map is incomplete, when I want to validate it I use the following commands:
- getent passwd
- getent shadow
- getent group
getent passwd --> works like a charm!
getent shadow --> seems to work, but there's lots of incompleted fields
getent group --> dosen't work! It returns only the local groups
There's a minor difference between your setup and mine. I'm NOT using kerberos and I don't intend to!
Hopefully this will help you with your setup... If you can fix the group issues. Let me know
Thanks
-FB
PS: Sorry for the bad english, is not my mother tongue
I've been experiencing the same issue with my setup. To fix it, I had to update the nss_map entries.
I replaced/add the following lines to /etc/ldap.conf
# Services for UNIX 3.5 mappings
nss_map_objectclass posixAccount User
nss_map_objectclass shadowAccount User
nss_map_attribute uid msSFU30Name
nss_map_attribute uidNumber msSFU30UidNumber
nss_map_attribute gidNumber msSFU30GidNumber
nss_map_attribute loginShell msSFU30LoginShell
nss_map_attribute gecos name
nss_map_attribute uniqueMember msSFU30PosixMember
nss_map_attribute userPassword msSFU30Password
nss_map_attribute homeDirectory msSFU30HomeDirectory
nss_map_objectclass posixGroup Group
nss_map_attribute cn cn
pam_login_attribute msSFU30Name
pam_member_attribute msSFU30PosixMember
pam_filter objectclass=User
pam_password md5
As soon, as theses entries were added. I've been able to use AD to auth myself. This map is incomplete, when I want to validate it I use the following commands:
- getent passwd
- getent shadow
- getent group
getent passwd --> works like a charm!
getent shadow --> seems to work, but there's lots of incompleted fields
getent group --> dosen't work! It returns only the local groups
There's a minor difference between your setup and mine. I'm NOT using kerberos and I don't intend to!
Hopefully this will help you with your setup... If you can fix the group issues. Let me know
Thanks
-FB
PS: Sorry for the bad english, is not my mother tongue
I use the RFC 2307 (AD) mappings instead of the Services for UNIX ones. Those will get you closer to mapping regular group memberships rather than relying on the UNIX attributes tab. Here's the mappings I'm using:
Code:
# RFC 2307 (AD) mappings
nss_map_objectclass posixAccount user
nss_map_objectclass shadowAccount user
nss_map_attribute uid sAMAccountName
nss_map_attribute homeDirectory unixHomeDirectory
nss_map_attribute shadowLastChange pwdLastSet
nss_map_objectclass posixGroup group
nss_map_attribute uniqueMember member
pam_login_attribute sAMAccountName
pam_filter objectclass=User
pam_password ad
# Addtional AD mappings
nss_map_attribute gecos name
nss_map_attribute cn sAMAccountName
This is slightly adjusted from what I had originally posted just to get certain attributes to line-up better.
What I found most effective was getting a LDIF of a sample user (I used my own account typically) and then just looked at which attributes fit for the mappings I wanted.
And it shouldn't matter if you use Kerberos auth or not. This is mostly plain LDAP.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.