[SOLVED] Does OpenLDAP / NSS / PAM produce logs of failed login attempts?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Does OpenLDAP / NSS / PAM produce logs of failed login attempts?
Hi,
I am trying to get OpenLDAP to authenticate user logins, but running around in circles. Are there any logs produced by either client and/or server that would indicate possible reasons why it was unable to login as a user?
Below is an explanation, any ideas would be appreciated, as I think everything is setup as per the various articles on using LDAP.
---
I have a CentOS 5.5 OpenLDAP server, and several others, some host services, some are file shares (samba).
So far I have been able to successfully configure OpenLDAP to carry out all the ldap* commands from both the local server and from any of the remote servers, either via non-ssl or ssl connections. However, as soon as I try connecting any services up to it, it doesn't play ball.
Back to basics, having cleared off all previous attempts at this from all machines, I have gone through the following:
Installed OpenLDAP server/client on host (plus nss_ldap).
Configured /etc/openldap/slapd.conf (see below)
Configured /etc/openldap/ldap.conf (see below)
Configured /etc/ldap.conf (see below)
Configured /etc/sysconfig/iptables (see below)
Started up ldap service.
Ran ldapadd to input .ldif file to set up initial directory (see below)
Ran ldappasswd to set password for testuser entry.
Tested directory load with ldapsearch using both the admin and testuser accounts. Data returned okay on both LDAP server plus another machine.
Ran authconfig-tui to configure use of LDAP for login (same machine as LDAP is on).
Rechecked the above .conf files for any changes, plus /etc/nsswitch.conf (see below).
Checked /etc/pam.d/system-auth (see below) *** I think this is the step where it is not working.
Started nscd service (not sure this is needed) and restarted the server.
Tested logging in via local console as LDAP user - Msg: Login incorrect.
Tested logging in via ssh as LDAP user - Msg: Access denied.
Tested logging in via either with local account - Result: Fine.
Changed order in /etc/nsswitch.conf from 'files ldap' to 'ldap files'.
Definite delay occurs after typing in password, even for local user account, suggesting that it is attempting communication before failing over.
/etc/openldap/slapd.conf:
Code:
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/samba.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
access to attrs=userPassword,sambaLMPassword,sambaNTPassword
by self write
by anonymous auth
by * none
access to *
by self write
by users read
by anonymous auth
database bdb
suffix "dc=intbus,dc=net"
rootdn "cn=admin,dc=intbus,dc=net"
rootpw {SSHA}<crypto removed>
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
/etc/openldap/ldap.conf:
Code:
# Tried the below line with and without the port number
URI ldap://intbus.net:389/
BASE dc=intbus,dc=net
TLS_CACERTDIR /etc/openldap/cacerts
/etc/ldap.conf:
Code:
base dc=intbus,dc=net
# Tried the below line with and without the port number
uri ldap://intbus.net:389/
timelimit 120
bind_timelimit 120
idle_timelimit 3600
pam_filter objectclass=posixAccount
nss_base_passwd ou=Users,dc=intbus,dc=net?one
nss_base_shadow ou=Users,dc=intbus,dc=net?one
nss_base_group ou=Groups,dc=intbus,dc=net?one
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd,gdm
ssl no
tls_cacertdir /etc/openldap/cacerts
pam_password md5
/etc/sysconfig/iptables:
Code:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 389 -s 192.168.1.0/24 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 636 -s 192.168.1.0/24 -j ACCEPT
ok, well the closest part to the user login attempt is /var/log/secure on the server in question, this is pam's output, not ldaps so covers the generic act of logging in. Or not. On the ldap side, then you should have /var/log/ldap or something similar on the ldap server, although tbh I needed to add a syslog entry for local4.* to tell it to write to the ldap log file (nothing else on my servers use local4, and it's slapd's default so works fine...) In there you'd then be able to see all communications, and you've got two "normal" error codes to look for on a bind attempt for authentication purposes, err=49 which is "invalid credentials" which principally means a wrong password, but also covers expired ones and a few other subtleties, and also err=19 which is "constraint violation" which is locked out accounts from successive failed attempts etc. Plenty of other reasons, e.g. broken / malformed accounts etc, but those two are from my experience, the main user level codes. Also in terms of troubleshooting, wireshark is so so useful to capture the network traffic (disable TLS / SSL temporarily first) so you can actually see the full breakdown of the comms between client and ldap server, which can shed huge amounts of information too. A further demarcation thang is to ensure that "getent passwd" also works for user information. It's no good giving the right password if the system doens't even know the account exists, and that's directly using nsswitch.conf and /etc/ldap.conf and (afaik) nothing else significant at all, so can easily help localise an issue.
Last edited by acid_kewpie; 02-16-2011 at 04:58 PM.
Thanks a lot, that pointed me exactly where I needed.
A bit of trial and error, some research, and I got it working.
The problem was that I had not specified a rootbinddn (despite some articles saying it is not required). My previous attempts to add a rootbinddn had failed because I had left out the ou=Users part of the dn, or at one point because I had reset the ldif file entries without setting the password.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.