系统管理指南:安全性服务

口令加密

强口令加密可提供较早的攻击防线。Solaris 软件提供了四种口令加密算法。与 UNIX 算法相比,其中的两种 MD5 算法和 Blowfish 算法可提供更为强大的口令加密。

口令算法标识符

可以在 /etc/security/policy.conf 文件中指定站点的算法配置。在 policy.conf 文件中,算法以其标识符命名,如下表所示。

表 2–1 口令加密算法

标识符 

说明 

算法手册页 

1

与 BSD 和 Linux 系统上的 MD5 算法兼容的 MD5 算法。

crypt_bsdmd5(5)

2a

与 BSD 系统上的 Blowfish 算法兼容的 Blowfish 算法。

crypt_bsdbf(5)

md5

Sun MD5 算法,此算法被视为比 BSD 和 Linux 版本的 MD5 更为强大。

crypt_sunmd5(5)

__unix__

传统的 UNIX 加密算法。此算法是 policy.conf 文件中的缺省模块。

crypt_unix(5)

policy.conf 文件中的算法配置

以下说明了 policy.conf 文件中的缺省算法配置:


#

…

# crypt(3c) Algorithms Configuration

#

# CRYPT_ALGORITHMS_ALLOW specifies the algorithms that are allowed to

# be used for new passwords.  This is enforced only in crypt_gensalt(3c).

#

CRYPT_ALGORITHMS_ALLOW=1,2a,md5



# To deprecate use of the traditional unix algorithm, uncomment below

# and change CRYPT_DEFAULT= to another algorithm.  For example,

# CRYPT_DEFAULT=1 for BSD/Linux MD5.

#

#CRYPT_ALGORITHMS_DEPRECATE=__unix__



# The Solaris default is the traditional UNIX algorithm.  This is not

# listed in crypt.conf(4) since it is internal to libc.  The reserved

# name __unix__ is used to refer to it.

#

CRYPT_DEFAULT=__unix__

…

更改 CRYPT_DEFAULT 的值之后,将使用与新值关联的算法对新用户的口令进行加密。当前用户更改其口令之后,其旧口令的加密方式会影响加密新口令所用的算法。

例如,假设 CRYPT_ALGORITHMS_ALLOW=1,2a,md5CRYPT_DEFAULT=1。下表说明了将使用何种算法来生成加密口令。

标识符=口令算法 

说明 

初始口令 

更改后的口令 

1 = crypt_bsdmd5

使用同一算法 

1 标识符也是 CRYPT_DEFAULT 的值。继续使用 crypt_bsdmd5 算法对用户口令进行加密。

2a = crypt_bsdbf

使用同一算法 

2a 标识符位于 CRYPT_ALGORITHMS_ALLOW 列表中。因此,使用 crypt_bsbdf 算法对新口令进行加密。

md5 = crypt_md5

使用同一算法 

md5 标识符位于 CRYPT_ALGORITHMS_ALLOW 列表中。因此,使用 crypt_md5 算法对新口令进行加密。

__unix__ = crypt_unix

使用 crypt_bsdmd5 算法

__unix__ 标识符不在 CRYPT_ALGORITHMS_ALLOW 列表中。因此,不能使用 crypt_unix 算法。将使用 CRYPT_DEFAULT 算法对新口令进行加密。

有关配置算法选择的更多信息,请参见 policy.conf(4) 手册页。要指定口令加密算法,请参见更改口令算法(任务列表)