LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-18-2013, 03:35 PM   #1
AllenMcw
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Rep: Reputation: Disabled
Linux pam_cracklib not seeing OLD password


Hello,

I'm hoping someone can help me out here.

I have enabled Linux PAM (version 1.1.4) and cracklib (version 2.8.22) and most things are working fine. All password complexity specified via the PAM configuration file are being adhered to (upper/lower case, digits, etc) but the 'difok' is NOT being adhered to. No matter what I set this option to, pam_cracklib will let any password through (provided it meets the other complexity requirements I've specified).

Long story short I had to modify the Linux PAM cracklib to add some debug and quickly found out that pam_cracklib FAILS to be able to retrieve the OLD password. It thinks the string is NULL so naturally there is nothing to compare the new password to.

Yet when the user changes their own password, it IS CORRECTLY authenticating the current (what will become the OLD) password so pam_unix is correctly seeing the old password. By the time it gets down to the pam_cracklib line of the PAM configuration the password appears to have been wiped out somehow.

I'm pulling my hair out trying to figure out how/where/why this is happening.

Here are the relevant password lines in my PAM configuration file:

password requisite pam_cracklib.so debug reject_username\
minlen=6 ucredit=-1 lcredit=-1 difok=4 maxrepeat=2
password required pam_unix.so debug md5 shadow

BY THE WAY: this is all being done programatically through a front end application. This is NOT something which can be done interactively in this environment.

ALSO, in the PAM conversation function I print out the messages sent by the PAM library asking for information and it gets called 4 times but only once it asks for the OLD password. All other times it is asking for some variation of the new password.

The application is calling functions in the following sequence:

pam_start with pointer to the application PAM conversation function.

pam_authenticate - this DOES work correctly and validates the user password prior to allowing the change password to go forward.

pam_acct_mgmt

pam_chauthtok

I figured that either pam_chauthtok would either retrieve password from prior module or ask for it again via the PAM conversation function but neither one happens and when it gets to cracklib it sees the OLD password as NULL.

Does anyone have any ideas on this?

Thanks much
Allen

P.S. Hopefully I posted this in the correct place. Please let me know if I didn't.
 
Old 07-19-2013, 10:35 AM   #2
AllenMcw
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Problem Solved

Hello everyone,

I have solved this problem with a patch to Linux pam_cracklib.c. Just before 'pam_get_item' is called to retrieve the OLD password (PAM_OLDAUTHTOK) in function 'pam_sm_chauthtok' I inserted a call to 'pam_prompt' so that the conversation module on the application side is consulted again which sends the old password fresh back to Linux PAM.

This resolves the problem but I am really blown away by this because this should not have been necessary in my opinion. Is there something else I am missing or is this truly a bug in pam_cracklib which no one but me appears to have reported after all this time?

Any insight would be appreciated.

Thanks
Allen
 
Old 01-20-2016, 05:03 AM   #3
Dedalus2000
LQ Newbie
 
Registered: Jan 2016
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by AllenMcw View Post
Hello everyone,

I have solved this problem with a patch to Linux pam_cracklib.c. Just before 'pam_get_item' is called to retrieve the OLD password (PAM_OLDAUTHTOK) in function 'pam_sm_chauthtok' I inserted a call to 'pam_prompt' so that the conversation module on the application side is consulted again which sends the old password fresh back to Linux PAM.

I know, I'm quite late, but I have exactly the same problem just now on a old server and I'm heavily patching pam_cracklib.

Could you please post your solution? Just the line with pam_get_item, it should be enough.

I'm using debian wheezy.

It sound strange to me that nobody else had this problem.
I'm frustrated because I can't nothing about this, this is the first post I see!

Thanks
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL5 - pam_cracklib.so danpd Linux - Newbie 2 02-09-2012 06:07 AM
[SOLVED] pam_cracklib and pam_unix rosect Linux - Security 1 11-07-2011 07:14 PM
pam_cracklib not locking user after 3 bad password attempts legcard Linux - Security 3 06-25-2007 12:28 PM
pam_cracklib password history not working Kyle Harris Linux - Security 1 03-16-2007 11:40 AM
pam_cracklib settings gpm.sei Linux - Security 0 05-18-2006 01:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:06 AM.

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