金鳞

目标->软件测试架构师

Solaris在/etc/security/policy.conf中提供了4种不同的密码方案,查看该policy.conf,注意以下行:

    CRYPT_ALGORITHMS_ALLOW=1,2a,md5
    #CRYPT_ALGORITHMS_DEPRECATE=__unix__
    CRYPT_DEFAULT=__unix__

上述提供的算法中除了__unix__是不太让人不放心的crypt_unix,其他几个都在/etc/security/crypt.conf中有相应的描述:

1 (crypt_bsdmd5.so): One-way password hashing module for use with crypt(3C) that uses the MD5 message hash algorithm. The output is compatible with md5crypt on BSD and Linux systems. Password Limit: 255 chars
2a (crypt_bsdbf.so): One-way password hashing module for use with crypt(3C) that uses the Blowfish cryptographic algorithm. Password Limit: 255 chars
md5 (crypt_sunmd5.so): One-way password hashing module for use with crypt(3C) that uses the MD5 message hash algorithm. This module is designed to make it difficult to crack passwords that use brute force attacks based on high speed MD5 implementations that use code inlining, unrolled loops, and table lookup. Password Limit: 255 chars

要想获得更好的密码安全性,只需要修改/etc/securiry/policy.conf中的两行:取消CRYPT_ALGORITHMS_DEPRECATE前面的注释符,并修改CRYPT_DEFAULT行为你希望使用的密码算法。

     CRYPT_ALGORITHMS_DEPRECATE=__unix__
     CRYPT_DEFAULT=2a

现在你就可以使用passwd修改密码,即使是crypt_unix已经作废的密码仍然是可以被接受的。你可以通过在/etc/shadow的密码前面加上$type$来告知使用何种密码格式。例如:



  • moqZuc0PXJ/gw: Traditional UNIX password
  • $1$AR11mcp5$5wP5t99.kiHBiJ3qrg9jW1: Linux/BSD Compatible MD5
  • $2a$04$Q4m1iCDQWCl9l6h6yDFcC.agmbB21YXJxhrB1bmfnVOcrZwBBZUsm: Blowfish password
  • $md5$3UqYqndY$$6P.aaWOoucxxq.l00SS9k0: Sun MD5 password

我必须提醒大家,如果密码算法没有作废,那么修改的密码仍将使用已存在的密码格式。也就是说如果你使用Sun MD5作为缺省的密码格式,创建一个用户,设定密码,接着你又改变了缺省密码格式,然后又修改密码,因为你并没有将原密码算法作废,所以修改的密码仍将使用已存在的Sun MD5格式。所以这里的关键就是,如果你想把所有用户的密码从一种格式转换的另一种格式,请确保废弃掉那些你不再想使用的密码格式,以获得所期望的效果。
转自:http://bbs.chinaunix.net/viewthread.php?tid=987710&highlight=yuhuohu
posted on 2010-07-15 09:48 金鳞 阅读(3077) 评论(0)  编辑 收藏 引用 所属分类: Linux
只有注册用户登录后才能发表评论。