LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-14-2017, 04:30 AM   #1
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Rep: Reputation: Disabled
LDAP user expired


I have configured LDAP server on rhel7.2 3-4 months ago and that time it was working fine. URL which i used for configration is http://www.learnitguide.net/2016/01/...-on-rhel7.html.

I have created 3-4 ldapuser users namely ldapuser1,2,3,4 when i created the server.That time i was able to login on ldap clients.

But now i am unable to login in ldap client with these users.While logging in with ldapuser,after entering password it gives error as "Server unexpectly closed Network connection"

I have also changed ldap user password but still no vain.

If i create new LDAP users,i can login in LDAP client with that user.

I have tried this in all LDAP clients.In all clients ,i can login with new user created but cannot login with existing old ldap users.


Then on checking further,I came to know on seeing logs that "ldapuser1" has expired and is locked.

Date LDAPClient unix_chkpwd[10173]: password check failed for user (ldapuser1)
Date LDAPClient sshd[10160]: pam_unix(sshd:account): account ldapuser1 has expired (failed to change password)

Date LDAPClient sshd[10160]: pam_ldap(sshd:account): password expired 176 days ago, account locked 146 days ago; user=ldapuser1

Date LDAPClient sshd[10160]: Failed password for ldapuser1 from IPport 58854 ssh2

Date LDAPClient sshd[10160]: fatal: Access denied for user ldapuser1 by PAM account configuration [preauth]

Date LDAPClient sshd[10160]: PAM 1 more authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=IP user=ldapuser1


My Question is as below.

1. Besides logs,How to check if my ldap user is expired or not or going to expire.???is there any command for the same.
2. How to fix current issue.
 
Old 12-14-2017, 06:31 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
My Question is as below.

1. Besides logs,How to check if my ldap user is expired or not or going to expire.???is there any command for the same.
2. How to fix current issue.
1. Use ldapsearch to find the accounts that have expired, using pwdChangedTime.
Code:
ldapsearch -D "admin DN" -w "admin password" -b "ou=People,dc=Domain,dc=com" '(&(uid=*)(pwdChangedTime>=XXXX'))
where XXXX is the number of pwdMaxAge.
And you can use XXXX=pwdMaxAge-86400 for example, in order to find users 1 day before their password expires.


2. Use ldappasswd to give user a new password:
Code:
ldappasswd -D "admin DN" -w "admin password" -s "new password for expired user" "user DN"
 
Old 12-14-2017, 08:28 AM   #3
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Original Poster
Rep: Reputation: Disabled
Thanks for the reply

For Point 1,i have executed beloow command on LDAP server but i didnt get any required output

[LDAPSrvr]# ldapsearch -D "cn=Manager,dc=domain,dc=com" -w <LDAPpasswd> -b "ou=People,dc=domain,dc=com" '(&(uid=*)(pwdChangedTime>=3024000))'
# extended LDIF
#
# LDAPv3
# base <ou=People,dc=domain,dc=com> with scope subtree
# filter: (&(uid=*)(pwdChangedTime>=3024000))
# requesting: ALL
#

# search result
search: 2
result: 0 Success

# numResponses: 1


This may be because i do not have "pwdChangedTime" parameter in my password policy.My current password policy is as belw.

[root@LDAPSrvr LDAPfiles]# cat passwordpolicy.ldif
dn: cn=default,ou=policies,dc=domain,dc=com
cn: default
objectClass: pwdPolicy
objectClass: device
objectClass: top
pwdAttribute: userPassword
pwdMaxAge: 3024000
pwdExpireWarning: 1814400
pwdInHistory: 4
pwdCheckQuality: 1
pwdMinLength: 9
pwdMaxFailure: 4
pwdLockout: TRUE
pwdLockoutDuration: 600
pwdGraceAuthNLimit: 0
pwdFailureCountInterval: 0
pwdMustChange: TRUE
pwdAllowUserChange: TRUE
pwdSafeModify: FALSE


Do i need to add "pwdChangedTime" parameter to this policy.And if yes,please let me know how

For Point 2,I have executed below command on LDAP server

[root@LDAPSrvr LDAPfiles]# ldappasswd -D "cn=Manager,dc=domain,dc=com" -w <LDAPpasswd> "uid=ldapuser1,ou=People,dc=domain,dc=com"
New password: lV4cDWqc


when i am logging in LDAP client with password as " lV4cDWqc" ,it is still giving me error message as ""Server unexpectly closed Network connection"

Please find logs below

Dec 14 19:51:18 LDAPClient unix_chkpwd[39254]: password check failed for user (ldapuser1)
Dec 14 19:51:18 LDAPClient sshd[39239]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.21.148.75 user=ldapuser1
Dec 14 19:51:18 LDAPClient sshd[39239]: pam_unix(sshd:account): account ldapuser1 has expired (failed to change password)
Dec 14 19:51:18 LDAPClient sshd[39239]: pam_ldap(sshd:account): password expired 182 days ago, account locked 152 days ago; user=ldapuser1
Dec 14 19:51:18 LDAPClient sshd[39239]: Failed password for ldapuser1 from 10.21.148.75 port 52546 ssh2
Dec 14 19:51:18 LDAPClient sshd[39239]: fatal: Access denied for user ldapuser1 by PAM account configuration [preauth]


Kindly help
 
Old 12-14-2017, 12:27 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
1.
Quote:
This may be because i do not have "pwdChangedTime" parameter in my password policy.My current password policy is as belw.
This attribute is auto-created when the user changes his password.
Since I don't use ppolicy, I had to read that the format is: YYYYMMDDhhmmssZ, so I guess you have to write a script that do the math to find which accounts are about or have expired. You may try this, or adapt it to your needs.


2.
Quote:
For Point 2,I have executed below command on LDAP server

[root@LDAPSrvr LDAPfiles]# ldappasswd -D "cn=Manager,dc=domain,dc=com" -w <LDAPpasswd> "uid=ldapuser1,ou=People,dc=domain,dc=com"
New password: lV4cDWqc
when i am logging in LDAP client with password as " lV4cDWqc" ,it is still giving me error message as ""Server unexpectly closed Network connection"
Then read case 2 here.
 
Old 12-18-2017, 08:46 AM   #5
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Original Poster
Rep: Reputation: Disabled
Thanks for the reply!!!

For Point no 2,do i have to add "pwdReset" attribute in ppolicy???is that correct???

if yes please share link for updating password policy and what will be "pwdReset" value in ppolicy true or false.???

Last edited by Ankushkalra; 12-18-2017 at 08:49 AM.
 
Old 12-18-2017, 11:36 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Ankushkalra View Post
Thanks for the reply!!!

For Point no 2,do i have to add "pwdReset" attribute in ppolicy???is that correct???

if yes please share link for updating password policy and what will be "pwdReset" value in ppolicy true or false.???
According to the link above you need to set the pwdReset value to TRUE, so use ldapmodify with the next ldif file:
Code:
uid=ldapuser1,ou=People,dc=domain,dc=com
changetype: modify
add: pwdReset
pwdReset: TRUE
 
Old 12-20-2017, 06:42 AM   #7
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Original Poster
Rep: Reputation: Disabled
Thanks for the reply!!!

I have successfully added "pwdReset" attribute on ldap user "ldapuser1".Please find below command.


# ldapsearch -x -D cn=Manager,dc=domain,dc=com -w <LDAP_password> -b "ou=People,dc=domain,dc=com" -s sub -h `hostname` pwdReset

# extended LDIF
#
# LDAPv3
# base <ou=People,dc=domain,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: pwdReset
#

# People, domain.com
dn: ou=People,dc=domain,dc=com

# ldapuser1, People, domain.com
dn: uid=ldapuser1,ou=People,dc=domain,dc=com
pwdReset: TRUE


Kindly let me know what next i have to do to resolve the issue.
 
Old 12-20-2017, 08:06 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Kindly let me know what next i have to do to resolve the issue.
Huh, I guess that since pwdReset is TRUE, next time the user tries to login, he will be prompted to change his password.
 
Old 12-20-2017, 08:50 AM   #9
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Original Poster
Rep: Reputation: Disabled
when i login with that user,after entering password it is giving me error as ""Server unexpectly closed Network connection"
 
Old 12-20-2017, 08:51 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
Quote:
Originally Posted by bathory View Post
Huh, I guess that since pwdReset is TRUE, next time the user tries to login, he will be prompted to change his password.
These are strictly-speaking attributes of the LDAP dictionary-entry so be sure that you spell them exactly as required by whatever piece of system software will be referencing it.
 
Old 12-20-2017, 12:06 PM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Ankushkalra View Post
when i login with that user,after entering password it is giving me error as ""Server unexpectly closed Network connection"
Are you sure the password is correct? Perhaps you have exceeded the max times of failed logins.
Anyway check the server logs (probably /var/log/secure) to get some hints
 
Old 12-21-2017, 03:12 AM   #12
Ankushkalra
Member
 
Registered: Jan 2017
Posts: 48

Original Poster
Rep: Reputation: Disabled
I am giving correct password.Please find log file as attachment at the time of incident(when i logged in to ldap client and got error message)

Please note :I can successfully login to ldap client using "su".


[<LDAP_client]# su - ldapuser1
Creating home directory for ldapuser1.
Last login: Wed Dec 13 20:23:53 IST 2017 on pts/1
Last failed login: Thu Dec 21 13:18:18 IST 2017 from 10.21.148.75 on ssh:notty
There were 51 failed login attempts since the last successful login.
Attached Files
File Type: txt logs_login_expired_linuxquestion.txt (8.5 KB, 82 views)
 
Old 12-21-2017, 05:17 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Please note :I can successfully login to ldap client using "su".
As I've told you I don't use ppolicy. Also I'm running Slackware that is PAM-free, so I cannot help you further.

But since you can use su to the user in question, run "passwd" to try to change his password and see what you get.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba Ldap smbldap-tools password expired Aghast Linux - Server 10 02-24-2010 11:16 PM
user account got expired. Sunheer Linux - Newbie 6 02-21-2010 10:28 PM
Expired user account? lt_wentoncha SUSE / openSUSE 2 04-26-2007 11:34 PM
User expired Chemeh Mandriva 2 12-16-2005 09:59 AM
user account expired ??? rahimzai Red Hat 3 10-10-2005 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration