[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[linux-security] Re: md5,des etc..



On Wed, Nov 17, 1999 at 09:02:52PM -0500, Arni Raghu wrote:
> Hoping that this is not OT..
> 
> Hi
> I want to write a simple perl script to see if my system supports des or md5
> as the password encryption scheme..what is the easiest way..
> 
> one of course is to look at the /etc/shadow file and then parsing the passwd
> field, any better way..??

The easy way :

$ perl -e 'print "DES : " . crypt("password","12") . "\n"'
DES : 12CsGd8FRcMSM
$ perl -e 'print "MD5 : " . crypt("password","\$1\$12") . "\n"'
MD5 : $1$12$VbEDUlCp8WzvSdX6Ahhdl0

If you have the same results then your system supports MD5. If the second
one gives you some thing like "MD5 : $1Oyx5r9mdGZ2" then it doesn't supports
MD5.

How to activate it by default ?

 - without pam : check the value of "MD5_CRYPT_ENAB" in /etc/login.defs
 - with pam : check the word md5 on the line beginning by :
	"password   required     /lib/security/pam_pwdb.so use_authtok nullok"
   in /etc/pam.d/passwd

Denis Ducamp.

-- 
   |\      _,,,---,,_                  Denis Ducamp <Denis Ducamp hsc fr>
Zz /,`.-'`'    -.  ;-;;,_                       Hervé Schauer Consultants
  |,4-  ) )-,_.,,\ (  `'-'                             http://www.hsc.fr/
 '---''(_/--'  `-'\_)Isn't there always a cat on whatever you're reading?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]