Sponsored Content
Full Discussion: Password hardening using pam
Operating Systems Linux Password hardening using pam Post 302927144 by rbatte1 on Monday 1st of December 2014 07:23:09 AM
Old 12-01-2014
A while back we had a god at this. We got as far as this before other business pressures took over. I'm not sure if it actually works, but it might provide a pointer:-
Quote:
In /etc/pam.d/system-auth-ac and /etc/pam.d/password-auth-ac files contains the following in the password statements:-
Code:
    password [success=1 default=ignore] pam_succeed_if.so user notingroup privgrp
    password requisite pam_cracklib.so try_first_pass dcredit=0 ucredit=0 ocredit=0 lcredit=0 minclass=3 minlen=12 retry=3 difok=2

    password [success=1 default=ignore] pam_succeed_if.so user ingroup privgrp
    password requisite pam_cracklib.so try_first_pass dcredit=0 ucredit=0 ocredit=0 lcredit=0 minclass=3 minlen=8 retry=3 difok=2

    password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=24
    password required pam_deny.so

The plan then was to move people into the group privgrp if they had elevated privileges which mainly was considered as people with sudo rules for anything except where tied into the application, so those who could reset passwords, those who could become the superuser account etc. The limits are set for minimum of 8 for normal users and 12 for privileged, but I'm sure you can adjust that. We also require passwords to contain a mixture of upper & lower case, numerics and punctuation. We've had a few issues on some servers with characters #, £ and @ so bear that in mind when publishing guidelines. Worst affected for us on HP-UX, but it's a known limitation.


I hope that this gives you a pointer. I don't think it was actually fully implemented so I can't be sure it actually has any effect. Please test it thoroughly before committing to it. It would be worth having multiple sessions as a superuser before saving the files so you have a chance to undo them if they cause a problem.



I hope that this is useful, or prompts someone else to chip in, perhaps proving me wrong. I'm always happy to learn. Smilie



Regards,
Robin
 

10 More Discussions You Might Find Interesting

1. Solaris

Hardening Solaris 10

So I've just done my first install of Solaris. I installed it on an x86 system and am now in the processing of figuring out what I need to do to 'harden' it. I've got the Security kit downloaded (jass) but I am not sure what to do with the .tar file. I can't seem to find any easy steps to... (6 Replies)
Discussion started by: flood
6 Replies

2. Solaris

Hardening Solaris

What do we need to do to harden a freshly installed solaris OS? like disable telnet, no ftp for root etc...What all services you need to stop? How to check what ports are open? etc etc....please provide all tips that come to your mind...thanks:) (5 Replies)
Discussion started by: rcmrulzz
5 Replies

3. Solaris

PAM, Solaris, Openssh and Forcing a password change

Here's the issue. Currently when I run passwd -f "username" on any account, when I try to login with said account I don't get prompted to change my password I just keep getting prompted to input a password. (Of course this works just fine with telnet)Is there something i need to add to... (7 Replies)
Discussion started by: woodson2
7 Replies

4. Solaris

Pam Module sending a cannot get password enry after certain period in /var/adm/messag

Pam Module sending a cannot get password enry after certain period in /var/adm/message. pam_login_limit(auth): Cannot get Password entry for user 'dbsnmp' What is dbsnmp? Also if account is locked does pam module checks for this locked account at regular interval and keeps on posting... (2 Replies)
Discussion started by: student2009
2 Replies

5. UNIX for Dummies Questions & Answers

Using PAM to log password changes?

Hi, on a lab computer another user (who is a sudoer) changed my password without my permission. I'm pretty positive it was her, though I can't conclusively prove it. I had my friend, who is another sudoer on the machine, fix it and make me a sudoer now too. So everything is fine, but I want... (0 Replies)
Discussion started by: declannalced
0 Replies

6. Linux

password hardening & FTP access

I am dealing with an FTP server and I have implemented password hardening on the server. The thing is that, it applies to SSH connection. I forcefully expired password of a user so that he can change password at next login. But the user logged in to the server through FTP and he wasn't asked to... (4 Replies)
Discussion started by: parth_buch
4 Replies

7. UNIX for Advanced & Expert Users

SuSe Linux Hardening

We've got a FTP server that's open to the public network and its running on Suse SUSE Linux Enterprise Server 11 (x86_64) SP2 Now, since it's an FTP server I can't disable that service, but how else do I harden this server from attacks from outside? I am thinking of disabling the firewall and... (3 Replies)
Discussion started by: hedkandi
3 Replies

8. Solaris

Solaris and PAM Password policy

Hello All, I have Sun DSEE7 (11g) on Solaris 10. I have run idsconfig and initialized ldap client with profile created using idsconfig. My ldap authentication works. Here is my pam.conf # Authentication management # # login service (explicit because of pam_dial_auth) # login ... (3 Replies)
Discussion started by: pandu345
3 Replies

9. SuSE

PAM password change failed, pam error 20

Hi, I use a software which can create account on many system or application. One of resource which is managed by this soft his a server SUSE Linux Enterprise Server 10 (x86_64). patch level 3. This application which is an IBM application use ssh to launch command to create account in... (3 Replies)
Discussion started by: scabarrus
3 Replies

10. Cybersecurity

C-ICAP Hardening

Does anyone have any experience hardening the c-icap.conf file? Here is the default config file, it has a lot of options; sorry about how long it is. I have removed some entries that were not needed as well, but it is still so long :D. Any help is much appreciated as I have never dealt with ICAP. ... (0 Replies)
Discussion started by: savigabi
0 Replies
PAM_CRACKLIB(8)                                                  Linux-PAM Manual                                                  PAM_CRACKLIB(8)

NAME
pam_cracklib - PAM module to check the password against dictionary words SYNOPSIS
pam_cracklib.so [...] DESCRIPTION
This module can be plugged into the password stack of a given application to provide some plug-in strength-checking for passwords. The action of this module is to prompt the user for a password and check its strength against a system dictionary and a set of rules for identifying poor choices. The first action is to prompt for a single password, check its strength and then, if it is considered strong, prompt for the password a second time (to verify that it was typed correctly on the first occasion). All being well, the password is passed on to subsequent modules to be installed as the new authentication token. The strength checks works in the following manner: at first the Cracklib routine is called to check if the password is part of a dictionary; if this is not the case an additional set of strength checks is done. These checks are: Palindrome Is the new password a palindrome? Case Change Only Is the new password the the old one with only a change of case? Similar Is the new password too much like the old one? This is primarily controlled by one argument, difok which is a number of characters that if different between the old and new are enough to accept the new password, this defaults to 10 or 1/2 the size of the new password whichever is smaller. To avoid the lockup associated with trying to change a long and complicated password, difignore is available. This argument can be used to specify the minimum length a new password needs to be before the difok value is ignored. The default value for difignore is 23. Simple Is the new password too small? This is controlled by 5 arguments minlen, dcredit, ucredit, lcredit, and ocredit. See the section on the arguments for the details of how these work and there defaults. Rotated Is the new password a rotated version of the old password? Same consecutive characters Optional check for same consecutive characters. Contains user name Optional check whether the password contains the user's name in some form. This module with no arguments will work well for standard unix password encryption. With md5 encryption, passwords can be longer than 8 characters and the default settings for this module can make it hard for the user to choose a satisfactory new password. Notably, the requirement that the new password contain no more than 1/2 of the characters in the old password becomes a non-trivial constraint. For example, an old password of the form "the quick brown fox jumped over the lazy dogs" would be difficult to change... In addition, the default action is to allow passwords as small as 5 characters in length. For a md5 systems it can be a good idea to increase the required minimum size of a password. One can then allow more credit for different kinds of characters but accept that the new password may share most of these characters with the old password. OPTIONS
debug This option makes the module write information to syslog(3) indicating the behavior of the module (this option does not write password information to the log file). authtok_type=XXX The default action is for the module to use the following prompts when requesting passwords: "New UNIX password: " and "Retype UNIX password: ". The example word UNIX can be replaced with this option, by default it is empty. retry=N Prompt user at most N times before returning with error. The default is 1. difok=N This argument will change the default of 5 for the number of characters in the new password that must not be present in the old password. In addition, if 1/2 of the characters in the new password are different then the new password will be accepted anyway. difignore=N How many characters should the password have before difok will be ignored. The default is 23. minlen=N The minimum acceptable size for the new password (plus one if credits are not disabled which is the default). In addition to the number of characters in the new password, credit (of +1 in length) is given for each different kind of character (other, upper, lower and digit). The default for this parameter is 9 which is good for a old style UNIX password all of the same type of character but may be too low to exploit the added security of a md5 system. Note that there is a pair of length limits in Cracklib itself, a "way too short" limit of 4 which is hard coded in and a defined limit (6) that will be checked without reference to minlen. If you want to allow passwords as short as 5 characters you should not use this module. dcredit=N (N >= 0) This is the maximum credit for having digits in the new password. If you have less than or N digits, each digit will count +1 towards meeting the current minlen value. The default for dcredit is 1 which is the recommended value for minlen less than 10. (N < 0) This is the minimum number of digits that must be met for a new password. ucredit=N (N >= 0) This is the maximum credit for having upper case letters in the new password. If you have less than or N upper case letters each letter will count +1 towards meeting the current minlen value. The default for ucredit is 1 which is the recommended value for minlen less than 10. (N < 0) This is the minimum number of upper case letters that must be met for a new password. lcredit=N (N >= 0) This is the maximum credit for having lower case letters in the new password. If you have less than or N lower case letters, each letter will count +1 towards meeting the current minlen value. The default for lcredit is 1 which is the recommended value for minlen less than 10. (N < 0) This is the minimum number of lower case letters that must be met for a new password. ocredit=N (N >= 0) This is the maximum credit for having other characters in the new password. If you have less than or N other characters, each character will count +1 towards meeting the current minlen value. The default for ocredit is 1 which is the recommended value for minlen less than 10. (N < 0) This is the minimum number of other characters that must be met for a new password. minclass=N The minimum number of required classes of characters for the new password. The default number is zero. The four classes are digits, upper and lower letters and other characters. The difference to the credit check is that a specific class if of characters is not required. Instead N out of four of the classes are required. maxrepeat=N Reject passwords which contain more than N same consecutive characters. The default is 0 which means that this check is disabled. reject_username Check whether the name of the user in straight or reversed form is contained in the new password. If it is found the new password is rejected. use_authtok This argument is used to force the module to not prompt the user for a new password but use the one provided by the previously stacked password module. dictpath=/path/to/dict Path to the cracklib dictionaries. MODULE TYPES PROVIDED
Only the password module type is provided. RETURN VALUES
PAM_SUCCESS The new password passes all checks. PAM_AUTHTOK_ERR No new password was entered, the username could not be determined or the new password fails the strength checks. PAM_AUTHTOK_RECOVERY_ERR The old password was not supplied by a previous stacked module or got not requested from the user. The first error can happen if use_authtok is specified. PAM_SERVICE_ERR A internal error occurred. EXAMPLES
For an example of the use of this module, we show how it may be stacked with the password component of pam_unix(8) # # These lines stack two password type modules. In this example the # user is given 3 opportunities to enter a strong password. The # "use_authtok" argument ensures that the pam_unix module does not # prompt for a password, but instead uses the one provided by # pam_cracklib. # passwd password required pam_cracklib.so retry=3 passwd password required pam_unix.so use_authtok Another example (in the /etc/pam.d/passwd format) is for the case that you want to use md5 password encryption: #%PAM-1.0 # # These lines allow a md5 systems to support passwords of at least 14 # bytes with extra credit of 2 for digits and 2 for others the new # password must have at least three bytes that are not present in the # old password # password required pam_cracklib.so difok=3 minlen=15 dcredit= 2 ocredit=2 password required pam_unix.so use_authtok nullok md5 And here is another example in case you don't want to use credits: #%PAM-1.0 # # These lines require the user to select a password with a minimum # length of 8 and with at least 1 digit number, 1 upper case letter, # and 1 other character # password required pam_cracklib.so dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8 password required pam_unix.so use_authtok nullok md5 SEE ALSO
pam.conf(5), pam.d(5), pam(7) AUTHOR
pam_cracklib was written by Cristian Gafton <gafton@redhat.com> Linux-PAM Manual 06/04/2011 PAM_CRACKLIB(8)
All times are GMT -4. The time now is 01:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy