Sun Java System Directory Server Enterprise Edition 6.3 Administration Guide

Managing Specialized Password Policies

Specialized password policies are defined in a pwdPolicy(5dsoc) entry. A policy can be defined anywhere in the directory tree, typically in a subtree that is replicated with the accounts that the policy governs. The policy has a DN of the form cn=policy name,subtree.

After defining the password policy, you assign the password policy by setting the pwdPolicySubentry(5dsat) attribute in the desired user entry.

This section covers these topics:

Which Password Policy Applies

Directory Server allows you to configure multiple password policies. This section explains default password policies and specialized password policies. This section also explains which policy is enforced when multiple password policies could apply to a given account.

When you first create a Directory Server instance, that instance has a default password policy. That default password policy is expressed in the configuration entry cn=PasswordPolicy,cn=config. The default password policy applies to all accounts in the directory except for the Directory Manager.

As in all Directory Server password policies, cn=PasswordPolicy,cn=config has object class pwdPolicy(5dsoc) and object class sunPwdPolicy(5dsoc).


Note –

When you create a Directory Server instance, password policy attributes remain in Directory Server 5 compatible mode to facilitate upgrading from earlier versions. In Directory Server 5 compatible mode, Directory Server also handles password policy entries that have object class passwordPolicy(5dsoc).

After your upgrade is complete, you use the new password policy in fully featured mode, as described in Sun Java System Directory Server Enterprise Edition 6.3 Migration Guide. The administrative move is transparent to directory applications.

This chapter covers password policy configuration using the new password policy features.


You can change the default password policy to override the default settings. You can use the dsconf(1M) command to set the server properties for default password policy. Such server property names typically start with the pwd- prefix. When changing settings for such properties, you override the default password policy for the instance. Replication does not, however, copy the changes to replicas. The changes that you make to the default password policy are part of the configuration for the instance, not part of the directory data.

In addition to configuring the default password policy, you can also configure specialized password policies. A specialized password policy is defined by an entry in the directory tree. The specialized password policy entry has the same object class, pwdPolicy(5dsoc), as the default password policy, and therefore takes the same policy attributes. Because specialized password policies are regular directory entries, policy entries are replicated in the same manner as regular directory entries.

A user entry references a specialized password policy through the value of the operational attribute pwdPolicySubentry(5dsat). When referenced by a user entry, a specialized password policy overrides the default password policy for the instance. In many deployments, you assign users roles. You can configure roles to work with class of service (CoS) to determine the password policies that apply to user accounts, by setting the pwdPolicySubentry value. To override the password policy set by a role, change the pwdPolicySubentry value on that user's entry directly.

To summarize this section, initially the default password policy applies. You can change the default password policy to override the defaults. You can then create specialized password policy entries to override the default password policy. When you assign password policy with roles and CoS, you can override the CoS-assigned policy by specifying a password policy for an individual entry.

ProcedureTo Create a Password Policy

You create and modify specialized password policies in the same way that you create and modify any other directory entry. The following procedure demonstrates use of a text editor to write the password policy entry in LDIF. Then you use the ldapmodify command with the -a option to add the password policy entry to the directory.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

Before You Begin

Example data as shown here is from Example.ldif unless stated otherwise.

  1. Complete a password policy worksheet for the policy you want to create.

    See Worksheet for Defining Password Policy for a sample.

  2. Write a password policy entry, in LDIF, that is based on the worksheet.

    For example, the following policy entry specifies a password policy for temporary employees at Example.com, whose subtree root is 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

    In addition to the default password policy settings, the policy as shown here specifies additional behaviors. Password quality checks are enforced. Accounts are locked for five minutes, 300 seconds, after three consecutive bind failures. Passwords must be changed after the passwords are reset. After the policy is assigned to user accounts, the settings explicitly specified here override the default password policy.

  3. Add the password policy entry to the directory.

    For example, the following command adds the password policy for temporary employees at Example.com under dc=example,dc=com. The password policy has been saved in a file named 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
    $

    As shown in Example.ldif, kvaughan is an Human Resources manager who has access to modify dc=example,dc=com entries. Vaughan's bind password, as shown in Example.ldif, is bribery.

See Also

To define which user accounts are governed by the policies you define, see To Assign a Password Policy to an Individual Account or To Assign a Password Policy Using Roles and CoS.

ProcedureTo Assign a Password Policy to an Individual Account

This procedure assigns an existing password policy to a single user account.


Note –

To complete this procedure, you must have a specialized password policy to assign. See To Create a Password Policy.


You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

Example data shown here is from Example.ldif unless stated otherwise.

  1. Add the password policy DN to the values of the pwdPolicySubentry attribute of the user entry.

    For example, the following commands assign the password policy that is defined in To Create a Password Policy to David Miller's entry, whose DN is 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
    $

    As shown in Example.ldif, kvaughan is a Human Resources manager who has access to modify dc=example,dc=com entries. Vaughan's bind password, as shown in Example.ldif, is bribery.

ProcedureTo Assign a Password Policy Using Roles and CoS

This procedure assigns an existing specialized password policy to a set of users by applying roles and class of service (CoS). See Chapter 10, Directory Server Groups, Roles, and CoS for more information about roles and CoS.


Note –

To complete this procedure, you must have a specialized password policy to assign. See To Create a Password Policy.


You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

Example data shown here is from Example.ldif unless stated otherwise.

  1. Create a role for the entries to be governed by the password policy.

    For example, the following commands create a filtered role for temporary employees at 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
    
    $

    As shown in Example.ldif, kvaughan is a Human Resources manager who has access to modify dc=example,dc=com entries. Vaughan's bind password, as shown in Example.ldif, is bribery.

  2. Create a class of service to generate the DN of the password policy entry.

    The DN is the value of the pwdPolicySubentry attribute of users who have the role that you created.

    For example, the following commands create a filtered role for temporary employees at Example.com. The commands assign cn=TempPolicy,dc=example,dc=com to users who have the role.


    $ 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
    
    $

    Users whose status is contractor now become subject to the password policy cn=TempPolicy,dc=example,dc=com.

ProcedureTo Set Up a First Login Password Policy

In many deployments, the password policy to apply for new accounts differs from the password policy to apply for established accounts. This section demonstrates a first login password policy. The policy gives users three days to use a newly created account, and set their new passwords before that account is locked. The policy is designed to work in the same way for users whose passwords have been reset.

You cannot use DSCC to perform this task. Use the command line, as described in this procedure.

  1. Create a specialized password policy for newly created accounts.

    For example, add a password policy entry that sets expiration time to three days, which is 259,200 seconds. This password policy also has pwdMustChange(5dsat) set to TRUE, meaning the users much change their passwords when they first bind.


    $ 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. Create a role that includes all newly created accounts.

    In creating this role, set up some way to distinguish newly created accounts from established accounts.

    1. Define new accounts as accounts that have a pwdReset(5dsat) attribute set to TRUE.

      When a user's password is changed by another user, such as a password administrator, pwdReset is set to TRUE.

    2. Create the role that identifies new accounts.

      For example, the following commands create a role for accounts whose passwords have been reset.


      $ 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. Assign the password policy for newly created accounts with class of service.


    $ 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
    
    $

Example 8–1 Checking Password Policy Assignment

Add a new user that fits the role that you have added. You add the user to verify that new users are subject to the new password policy, but existing users are not.


$ 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
$ 

Notice that Barbara Jensen's existing account is governed by the default password policy. Quentin Cubbins's new account is governed, however, by the password policy that you defined.