Sun Java System Directory Server Enterprise Edition 6.3 管理指南

管理专用密码策略

专用密码策略是在 pwdPolicy(5dsoc) 条目中定义的。可以在目录树中的任意位置定义策略,通常在使用策略所管理的帐户复制的子树中定义。策略的 DN 采用 cn=policy name,subtree 格式。

定义密码策略之后,可以通过在所需的用户条目中设置 pwdPolicySubentry(5dsat) 属性来指定该密码策略。

本部分包含以下主题:

应用哪个密码策略

目录服务器允许您配置多个密码策略。本部分介绍默认密码策略和专用密码策略。本部分还介绍当多个密码策略可应用于给定帐户时应执行哪个策略。

首次创建目录服务器实例时,该实例有一个默认密码策略。默认密码策略在配置条目 cn=PasswordPolicy,cn=config 中表示。默认密码策略将应用于目录中除目录管理员之外的所有帐户。

与所有目录服务器密码策略一样,cn=PasswordPolicy,cn=config 包含对象类 pwdPolicy(5dsoc) 和对象类 sunPwdPolicy(5dsoc)


注 –

创建目录服务器实例时,密码策略属性仍处于 Directory Server 5 兼容模式,以便从早期版本进行升级。在 Directory Server 5 兼容模式下,目录服务器还会处理具有对象类 passwordPolicy(5dsoc) 的密码策略条目。

在升级完成后,可以在完整功能模式下使用新的密码策略,如《Sun Java System Directory Server Enterprise Edition 6.3 Migration Guide》中所述。管理上的变化对目录应用程序没有任何影响。

本章介绍使用新密码策略功能的密码策略配置。


可以更改默认密码策略以覆盖默认设置。可以使用 dsconf(1M) 命令设置默认密码策略的服务器属性。通常,此类服务器属性的名称都以 pwd- 前缀开头。更改此类属性的设置时,将覆盖实例的默认密码策略。但是,复制操作不会复制对副本所做的更改。对默认密码策略所做的更改是实例配置的一部分,而不是目录数据的一部分。

除了配置默认密码策略以外,还可以配置专用密码策略。专用密码策略是由目录树中的条目定义的。专用密码策略条目与默认密码策略具有相同的对象类 pwdPolicy(5dsoc),因此将使用相同的策略属性。由于专用密码策略是常规的目录条目,因此策略条目的复制方式与常规目录条目的复制方式相同。

用户条目可通过操作属性 pwdPolicySubentry(5dsat) 的值来引用专用密码策略。用户条目引用专用密码策略时,该专用密码策略将覆盖实例的默认密码策略。在许多部署中,您需要指定用户角色。通过设置 pwdPolicySubentry 值,可以将角色配置为与服务类 (Class of Service, CoS) 一起使用,以确定应用于用户帐户的密码策略。要覆盖由角色设置的密码策略,请直接在该用户的条目上更改 pwdPolicySubentry 值。

下面对本部分内容进行一下总结:最初将应用默认密码策略。 您可以更改默认密码策略以覆盖默认值。然后,您可以创建专用密码策略条目以覆盖默认密码策略。使用角色和 CoS 指定密码策略时,可以通过为单个条目指定密码策略来覆盖 CoS 指定的策略。

Procedure创建密码策略

可以使用与创建和修改其他目录条目相同的方式来创建和修改专用密码策略。以下过程说明如何使用文本编辑器在 LDIF 中编写密码策略条目。接下来,可以在 ldapmodify 命令中使用 -a 选项将该密码策略条目添加到目录。

可使用 DSCC 执行此任务。有关信息,请参见目录服务控制中心界面和 DSCC 联机帮助。

开始之前

如果没有特殊说明,此处显示的示例数据均来自 Example.ldif

  1. 完成要创建的策略的密码策略工作单。

    用于定义密码策略的工作单中提供了样例。

  2. 根据工作单,在 LDIF 中编写密码策略条目。

    例如,以下策略条目将为 Example.com 的临时员工指定密码策略,Example.com 的子树根为 dc=example,dc=com

    dn: cn=TempPolicy,dc=example,dc=com
    objectClass: top
    objectClass: pwdPolicy
    objectClass: sunPwdPolicy
    objectClass: LDAPsubentry
    cn: TempPolicy
    pwdAttribute: userPassword
    pwdCheckQuality: 2
    pwdLockout: TRUE
    pwdLockoutDuration: 300
    pwdMaxFailure: 3
    pwdMustChange: TRUE

    除了默认密码策略设置之外,此处显示的策略还指定其他行为。系统将执行密码质量检查。连续出现三次失败绑定之后,帐户将被锁定五分钟(300 秒)。重置密码后必须更改密码。为用户帐户指定策略后,此处明确指定的设置将覆盖默认密码策略。

  3. 将密码策略条目添加到目录。

    例如,以下命令将为 dc=example,dc=com 下的 Example.com 临时员工添加密码策略。该密码策略已保存到名为 pwp.ldif 的文件中。


    $ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f pwp.ldif
    Enter bind password: 
    adding new entry cn=TempPolicy,dc=example,dc=com
    
    $ ldapsearch -D uid=kvaughan,ou=people,dc=example,dc=com -w --b dc=example,dc=com \
    "(&(objectclass=ldapsubentry)(cn=temppolicy))"
    Enter bind password:
    version: 1
    dn: cn=TempPolicy,dc=example,dc=com
    objectClass: top
    objectClass: pwdPolicy
    objectClass: LDAPsubentry
    cn: TempPolicy
    pwdCheckQuality: 2
    pwdLockout: TRUE
    pwdLockoutDuration: 300
    pwdMaxFailure: 3
    pwdMustChange: TRUE
    $

    Example.ldif 中所示,kvaughan 是具有 dc=example,dc=com 条目修改权限的人力资源经理。Vaughan 的绑定密码(如 Example.ldif 中所示)为 bribery

另请参见

要指定您所定义的策略将要管理的用户帐户,请参见为单个帐户指定密码策略使用角色和 CoS 指定密码策略

Procedure为单个帐户指定密码策略

此过程将为单个用户帐户指定现有的密码策略。


注 –

要完成此过程,您必须具有要指定的专用密码策略。请参见创建密码策略


可使用 DSCC 执行此任务。有关信息,请参见目录服务控制中心界面和 DSCC 联机帮助。

如果没有特殊说明,此处显示的示例数据均来自 Example.ldif

  1. 将密码策略 DN 添加到用户条目的 pwdPolicySubentry 属性值。

    例如,以下命令将创建密码策略中定义的密码策略指定给 David Miller 条目(其 DN 为 uid=dmiller,ou=people,dc=example,dc=com):


    $ cat pwp.ldif 
    dn: uid=dmiller,ou=people,dc=example,dc=com
    changetype: modify
    add: pwdPolicySubentry
    pwdPolicySubentry: cn=TempPolicy,dc=example,dc=com
    
    $ ldapmodify -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f pwp.ldif 
    Enter bind password: 
    modifying entry uid=dmiller,ou=people,dc=example,dc=com
    
    $ ldapsearch -D uid=kvaughan,ou=people,dc=example,dc=com -w - -b dc=example,dc=com \
    "(uid=dmiller)" pwdPolicySubentry
    Enter bind password:
    version: 1
    dn: uid=dmiller, ou=People, dc=example,dc=com
    pwdPolicySubentry: cn=TempPolicy,dc=example,dc=com
    $

    Example.ldif 中所示,kvaughan 是具有 dc=example,dc=com 条目修改权限的人力资源经理。Vaughan 的绑定密码(如 Example.ldif 中所示)为 bribery

Procedure使用角色和 CoS 指定密码策略

此过程通过应用角色和服务类 (Class of Service, CoS) 为一组用户指定现有的专用密码策略。有关角色和 CoS 的详细信息,请参见第 10 章,目录服务器组、角色和 CoS


注 –

要完成此过程,您必须具有要指定的专用密码策略。请参见创建密码策略


可使用 DSCC 执行此任务。有关信息,请参见目录服务控制中心界面和 DSCC 联机帮助。

如果没有特殊说明,此处显示的示例数据均来自 Example.ldif

  1. 为要由密码策略管理的条目创建角色。

    例如,以下命令将为 Example.com 的临时员工创建过滤角色。


    $ cat tmp.ldif
    dn: cn=TempFilter,ou=people,dc=example,dc=com
    objectclass: top
    objectclass: LDAPsubentry
    objectclass: nsRoleDefinition
    objectclass: nsComplexRoleDefinition
    objectclass: nsFilteredRoleDefinition
    cn: TempFilter
    nsRoleFilter: (&(objectclass=person)(status=contractor))
    description: filtered role for temporary employees
    
    $ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f tmp.ldif
    Enter bind password: 
    modifying entry cn=TempFilter,ou=people,dc=example,dc=com
    
    $

    Example.ldif 中所示,kvaughan 是具有 dc=example,dc=com 条目修改权限的人力资源经理。Vaughan 的绑定密码(如 Example.ldif 中所示)为 bribery

  2. 创建用于生成密码策略条目 DN 的服务类。

    此 DN 是用户(具有您所创建的角色)的 pwdPolicySubentry 属性值。

    例如,以下命令将为 Example.com 的临时员工创建过滤角色。这些命令为具有角色的用户指定 cn=TempPolicy,dc=example,dc=com


    $ cat cos.ldif
    dn: cn=PolTempl,dc=example,dc=com
    objectclass: top
    objectclass: nsContainer
    
    dn: cn="cn=TempFilter,ou=people,dc=example,dc=com",
     cn=PolTempl,dc=example,dc=com
    objectclass: top
    objectclass: extensibleObject
    objectclass: LDAPsubentry
    objectclass: costemplate
    cosPriority: 1
    pwdPolicySubentry: cn=TempPolicy,dc=example,dc=com
    
    dn: cn=PolCoS,dc=example,dc=com
    objectclass: top
    objectclass: LDAPsubentry
    objectclass: cosSuperDefinition
    objectclass: cosClassicDefinition
    cosTemplateDN: cn=PolTempl,dc=example,dc=com
    cosSpecifier: nsRole
    cosAttribute: pwdPolicySubentry operational
    
    $ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f cos.ldif
    Enter bind password: 
    modifying entry cn=TempFilter,ou=people,dc=example,dc=com
    
    $

    状态为 contractor 的用户现在要遵循密码策略 cn=TempPolicy,dc=example,dc=com

Procedure设置首次登录密码策略

在许多部署中,应用于新帐户的密码策略与应用于已建帐户的密码策略不同。本部分介绍首次登录密码策略。此策略为用户提供三天时间使用新建帐户并设置新密码,之后将锁定该帐户。对于已重置密码的用户而言,此策略的工作方式相同。

无法使用 DSCC 执行此任务。请使用命令行,如以下过程所述。

  1. 为新建帐户创建专用密码策略。

    例如, 添加一个将过期时间设置为三天(259,200 秒)的密码策略条目。此密码策略还将 pwdMustChange(5dsat) 设置为 TRUE,这意味着用户在首次绑定时必须更改其密码。


    $ cat firstLogin.ldif
    dn: cn=First Login,dc=example,dc=com
    objectClass: top
    objectClass: LDAPsubentry
    objectClass: pwdPolicy
    objectClass: sunPwdPolicy
    cn: First Login
    passwordStorageScheme: SSHA
    pwdAttribute: userPassword
    pwdInHistory: 0
    pwdExpireWarning: 86400
    pwdLockout: TRUE
    pwdMinLength: 6
    pwdMaxFailure: 3
    pwdMaxAge: 259200
    pwdFailureCountInterval: 600
    pwdAllowUserChange: TRUE
    pwdLockoutDuration: 3600
    pwdMinAge: 0
    pwdCheckQuality: 2
    pwdMustChange: TRUE
    
    $ ldapmodify -a -D cn=admin,cn=Administrators,cn=config -w - -f firstLogin.ldif
    Enter bind password: 
    adding new entry cn=First Login,dc=example,dc=com
    
    $
  2. 创建包含所有新建帐户的角色。

    创建此角色时,将设置用于区分新建帐户和已建帐户的方法。

    1. 将新帐户定义为 pwdReset(5dsat) 属性设置为 TRUE 的帐户。

      当其他用户(如密码管理员)更改该用户的密码时,pwdReset 将被设置为 TRUE

    2. 创建用于标识新帐户的角色。

      例如,以下命令将为已重置密码的帐户创建角色。


      $ cat newRole.ldif 
      dn: cn=First Login Role,ou=people,dc=example,dc=com
      objectclass: top
      objectclass: LDAPsubentry
      objectclass: nsRoleDefinition
      objectclass: nsComplexRoleDefinition
      objectclass: nsFilteredRoleDefinition
      cn: First Login Role
      nsRoleFilter: (pwdReset=TRUE)
      description: Role to assign password policy for new and reset accounts
      
      $ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f newRole.ldif
      Enter bind password: 
      adding new entry cn=First Login Role,ou=people,dc=example,dc=com
      
      $ 
  3. 使用服务类为新建帐户指定密码策略。


    $ cat newCoS.ldif 
    dn: cn=First Login Template,dc=example,dc=com
    objectClass: top
    objectClass: nsContainer
    
    dn: cn="cn=First Login Role,ou=people,dc=example,dc=com",
     cn=First Login Template,dc=example,dc=com
    objectClass: top
    objectClass: extensibleObject
    objectClass: LDAPSubEntry
    objectClass: CoSTemplate
    cosPriority: 1
    pwdPolicySubentry: cn=First Login,dc=example,dc=com
    
    dn: cn=First Login CoS,dc=example,dc=com
    objectClass: top
    objectClass: LDAPSubEntry
    objectClass: CoSSuperDefinition
    objectClass: CoSClassicDefinition
    cosTemplateDN: cn=First Login Template,dc=example,dc=com
    cosSpecifier: nsRole
    cosAttribute: pwdPolicySubentry operational
    
    $ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -f newCoS.ldif
    Enter bind password: 
    adding new entry cn=First Login Template,dc=example,dc=com
    
    adding new entry cn="cn=First Login Role,ou=people,dc=example,dc=com",
     cn=First Login Template,dc=example,dc=com
    
    adding new entry cn=First Login CoS,dc=example,dc=com
    
    $

示例 8–1 检查密码策略指定

请添加与所添加的角色相符的新用户。添加用户是为了验证新用户是否遵循新的密码策略,而现有用户不会遵循该策略。


$ cat quentin.ldif
dn: uid=qcubbins,ou=People,dc=example,dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: qcubbins
givenName: Quentin
sn: Cubbins
cn: Quentin Cubbins
mail: quentin.cubbins@example.com
userPassword: ch4ngeM3!
description: New account

$ ldapmodify -a -D uid=kvaughan,ou=people,dc=example,dc=com -w - -f quentin.ldif
Enter bind password: 
adding new entry uid=qcubbins,ou=People,dc=example,dc=com

$ ldapsearch -D uid=kvaughan,ou=people,dc=example,dc=com -w - \
-b dc=example,dc=com uid=qcubbins nsrole pwdPolicySubentry
Enter bind password:
version: 1
dn: uid=qcubbins,ou=People,dc=example,dc=com
nsrole: cn=first login role,ou=people,dc=example,dc=com
pwdPolicySubentry: cn=First Login,dc=example,dc=com
$ ldapsearch -b dc=example,dc=com uid=bjensen nsrole pwdPolicySubentry
version: 1
dn: uid=bjensen, ou=People, dc=example,dc=com
$ 

请注意,Barbara Jensen 的现有帐户由默认密码策略管理。但是,Quentin Cubbins 的新帐户将由您定义的密码策略管理。