LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-08-2013, 04:17 AM   #1
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Rep: Reputation: Disabled
Display unsuccessful login attempts via pam_lastlog module not working in CentOS5.6


Hello,

I am trying to setup PAM on CentOS 5.6 to accomplish the following -
- help enforce password strength
- control account locking
- print out to SSH users how many unsuccessful logins they have had since their last login

Following is my /etc/pam.d/cs-auth file that I modified to achieve the above -

Code:
#%PAM-1.0
auth required pam_env.so
auth required pam_tally2.so deny=5 onerr=fail unlock_time=900
auth sufficient pam_unix.so  try_first_pass
auth required pam_deny.so

account required pam_access.so
account required pam_tally2.so

password required pam_cracklib.so retry=3 minlen=5 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1
password sufficient pam_unix.so use_authtok md5 remember=4
password required pam_deny.so

session optional pam_lastlog.so showfailed nowtmp
session required pam_limits.so
The account locking after 5 attempts, unlocking after 900 seconds works fine. The issue I am facing is number of unsuccessful login attempts is not working.

Am I missing some piece of configuration? I don't have a choice of installing any additional software for this, have to make it work with PAM.

Thanks
Bhushan
 
Old 11-10-2013, 04:40 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Maybe try:
Code:
session required pam_lastlog.so noupdate showfailed
 
Old 11-11-2013, 02:49 AM   #3
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
Unfortunately, that did not work either. Any other ideas folks?
 
Old 11-11-2013, 02:55 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hang on, what logins is /etc/pam.d/cs-auth supposed to apply to?
 
Old 11-11-2013, 06:24 AM   #5
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
The cs-auth file comes from a custom PAM implementation for challenge-response based authentication for remote SSH access.

Last edited by BhushanPathak; 11-11-2013 at 06:25 AM. Reason: updated the reply
 
Old 11-11-2013, 03:40 PM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Could you try moving the pam_lastlog line out of cs-auth and into /etc/pam.d/login ?
 
Old 11-12-2013, 03:27 AM   #7
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
I removed the line from cs-auth & added it /etc/pam.d/login, but it did not solve the issue. Infact, it used to print last successful login date/time & IP address earlier. Now it does not even print that.

I tried enabling pam debug by following the link -
http://publib.boulder.ibm.com/infoce...ling_debug.htm

That started printing some logs, but no debug logs from PAM, only sshd debug logs.

Thanks
Bhushan
 
Old 11-14-2013, 05:05 AM   #8
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 85

Original Poster
Rep: Reputation: Disabled
If I am to uninstall the custom PAM module, where would I put in the configuration changes for the requirement described above?
 
  


Reply



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
Problem with showing failed login attempts using pam_lastlog.so Ronayn Linux - General 6 02-03-2015 02:43 AM
account lock after 3 unsuccessful attempts not happening deep27ak Linux - Newbie 13 10-17-2012 08:13 AM
invalid login attempts not refused using deny hosts and conf of denyhost not working tkmsr Linux - Security 1 10-28-2010 08:00 AM
how can I see firewall (iptables) logging? (e.g. unsuccessful incoming attempts) callagga Linux - Networking 7 06-28-2009 06:31 AM
how do i deny login after a certain no of unsuccessful attempts in fedora core2 darshan032002 Fedora 1 09-30-2004 01:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:21 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