4.3. Password Policy
The Password Policy for LDAP Directories is a RFC draft that has been designed for the very first version in 1999, and the latest version is from 2009. Although it's still a draft, and it's currently noted as inactive, it has been implemented by many existing LDAP servers.
ApacheDS implements most of the draft.
What is a password policy ?
As explained on wikipedia:
A password policy is a set of rules designed to enhance computer security by encouraging users to employ strong passwords and use them properly.
Basically, the system, once activated, will enforce some rules and check the password strength. We will list the various options in this chapter.
There are different aspects to consider:
- The password check when it's added or modified
- The password management when the user bind, in other words, it's life cycle
- The password protection against attacks
Those aspects are exposed in the following paragraphs.
How do we configure it ?
The Password Policy can be configured in two ways. First of all, it's important to know that it's activated by default. Let's see the default configuration first.
There is an entry containing all the default configuration values for the Password Policy, under the DN "ou=passwordPolicies, ads-interceptorId=authenticationInterceptor, ou=interceptors, ads-directoryServiceId=<default>, ou=config", which corresponds to the following hierarchy:
* ou=config * ads-directoryServiceId=<default> * ou=interceptors * ads-interceptorId=authenticationInterceptor * ou=passwordPolicies
This entry contains the following values:
|ads-pwdAllowUserChange||TRUE||Tells if the user can change its password|
|ads-pwdCheckQuality||1||The kind of quality we want for the password (0, 1, or 2)|
|ads-pwdFailureCountInterval||30||The duration of failure logs we keep in the entry|
|ads-pwdInHistory||5||The number of passwords we keep in the password history|
|ads-pwdLockout||TRUE||Tells if the password should be locked or not on failures|
|ads-pwdLockoutDuration||0||The delay in seconds we wait before allowing a new attempt when the password hs been locked|
|ads-pwdMaxDelay||0||The maximum we wait before sending the BindResponse|
|ads-pwdMaxFailure||5||The maximum number of failure we accept before locking the password|
|ads-pwdMinAge||0||The delay between two password changes|
|ads-pwdMinDelay||0||The minimum we wait before sending the BindResponse|
Here is the entry in LDIF format:
dn: ads-pwdId=default,ou=passwordPolicies,ads-interceptorId=authenticationIn terceptor,ou=interceptors,ads-directoryServiceId=default,ou=config objectclass: top objectclass: ads-base objectclass: ads-passwordPolicy ads-pwdAttribute: userPassword ads-pwdId: default ads-enabled: TRUE ads-pwdAllowUserChange: TRUE ads-pwdCheckQuality: 1 ads-pwdExpireWarning: 600 ads-pwdFailureCountInterval: 30 ads-pwdGraceAuthnLimit: 5 ads-pwdGraceExpire: 0 ads-pwdInHistory: 5 ads-pwdLockout: TRUE ads-pwdLockoutDuration: 0 ads-pwdMaxAge: 0 ads-pwdMaxDelay: 0 ads-pwdMaxFailure: 5 ads-pwdMaxIdle: 0 ads-pwdMaxLength: 0 ads-pwdMinAge: 0 ads-pwdMinDelay: 0 ads-pwdMinLength: 5 ads-pwdMustChange: FALSE ads-pwdSafeModify: FALSE
In the draft, it is said that the passwordPolicy can apply to one user or to many. It's also suggested that some Administrative Area could be used for that purpose : the users present in such an area will be constrained but the associated PasswordPolicy. At the moment, ApacheDS does not implement such a mechanism, and will rely on either the global configuration, stored in the ou=config partition, or we can define a specific Password Policy for a user. In this case, we will store in each user the reference to the Password Policy to use into the pwdPolicySubentry attribute (it contains a reference -a DN - to an entry storing the specific configuration).
This specific configuration is stored into an entry having the pwdPolicy Auxiliary ObjectClass, which description is :
( 22.214.171.124.126.96.36.199.188.8.131.52 NAME 'pwdPolicy' SUP top AUXILIARY MUST ( pwdAttribute ) MAY ( pwdMinAge $ pwdMaxAge $ pwdInHistory $ pwdCheckQuality $ pwdMinLength $ pwdMaxLength $ pwdExpireWarning $ pwdGraceAuthNLimit $ pwdGraceExpiry $ pwdLockout $ pwdLockoutDuration $ pwdMaxFailure $ pwdFailureCountInterval $ pwdMustChange $ pwdAllowUserChange $ pwdSafeModify $ pwdMinDelay $ pwdMaxDelay $ pwdMaxIdle ) )
Enabling/Disabling the PasswordPolicy
The PasswordPolicy is enabled by default. It's possible to disable it by setting the ads-enabled value to FALSE, with a server restart.
This part is exposing the various techniques the system uses to protect your password from an attack.
Password guessing limit
The idea is to protect the password against multiple guess attempts. The following rules are applied:
- a counter tracks the failed attempts, and blocks when it's reached
- an incremental delay is added after a failure before a new attempt can be done
- a global delay for all the failed attempt is used, when reached, the account is locked
When the account is locked, it can remain locked, or be unlocked after a grace period.
Each failed attempt will be logged in the entry, in the ads-pwdFailureTime Attribute (it will contain the date and time of the attempt). When the attribute contains more values than the maximum number of failed attempts, the entry will be locked (the ads-pwdAccountLockedTime Attribute will contain the date and time the entry has been locked).
The following table expose the various possible cases, with three failed attempts:
|date1, date2||-||No||Failure 2|
|date1, date2, date3||date3||Yes||Failure 3: account locked|
|date1, date2||-||No||Failure 2|
|date1, date2, date3||-||No||Failure 3|
As we can see, the account is locked only when we reach the number of failure, and the ads-pwdLockout flag is TRUE. If the ads-pwdLockoutDuration flag is set, then the password will remain locked for the delay stored in this attribute.
When we have reached a number of failed attempt, the account will be locked. We can set another attribute to tell the server that the locked out account can be unlocked after a delay: the ads-pwdLockoutDuration Attribute stores this delay.
When the account is locked, no further attempt will succeed, even if the correct password is sent. After the delay, the user will be unlocked.
As we store all the failures within the entry, at some point we may want to purge those failures. This is done either because we have successfully logged, or because the ads-pwdFailureCountInterval value has expired. In this last case, all the failures older than the current time minus the set interval will be removed.
Password checks and strength enforcement
Those rules are used to enforce some constraints on the password, so that weak passwords can't be used.
Quality Check policy
Default value: 1
The system can be enabled or disabled, and when enabled, two different level of checks can be done: relaxed or strict. We use a parameter to specify the kind of check we do on the password: ads-pwdCheckQuality, which can take three values:
- 0: The password is not checked
- 1: We check the password when we can, i.e. when it's not hashed. When the password is hashed, or in a form that does not allow us to apply the checks, then we ignore the errors
- 2: The password is checked, and if it's hashed or in a form that does not allow the checks to be done, then the changes are rejected.
The server can keep a backlog of passwords, so that a user can't keep a password for ever. When requested to do so the user will have to change his/her password, and the old password will be stored in the user's entry password history.
We can specify the number of passwords we keep in the password history by configuring the ads-pwdInHistory attribute.
Minimum delay between modifications
When the password history is activated, some users may change their passwords many times to get their old password out of the history, and add it as their password again. Setting a delay between two password changes may protect the password against such action.
The ads-pwdMinAge attribute is used for this purpose, and it keeps a value in seconds.
Password length constraint
You can control the minimum and maximum length for a password by setting the ads-pwdMinLength and ads-pwdMaxLength attributes.
Password lifecycle management
We now have to expose the rules that apply to the password during it's life.
Password max age
A password may have a limited life expectation, and when this age is reached, the password will be invalidated. This is configured through the ads-pwdMaxAge parameter, which contains the number of second a password will last.
This password invalidation can be overruled by the two next parameters.
Password grace auth N limit
When the password has expired, this parameter (ads-pwdGraceAuthNLimit) tells how many times a user will still be allowed to bind before the password is definitively locked. Each attempt will decrement the associated counter.
Password grace Expire
Another option when the password has expired is to give the user the possibility to log in during a certain period of time. This is mainly useful when the ads-pwdGraceAuthNLimit is set: not only there is a limited number of attempts, but those attempts must be done in a limited period of time, ortherwise the password will be locked.
If the configuration of the ads-pwdGraceAuthNLimit is 0, the ads-pwdGraceExpire value is simply added to the ads-pwdMaxAge value.
You can set a maximum inactivity delay for a password, before this password expires. This is set using the ads-pwdMaxIdle parameter
The ads-pwdExpireWarning parameter will be used to send back a warning if the password if the password is going to expire in a given delay. This is convenient as soon as the client sends the PasswordPolicy control to the server, and as soon as the client reads the response's control.
Allow user changes
The ads-pwdAllowUserChange parameter can be used to allow - or forbid - a user to change his/her own password. When this parameter is set to TRUE, the user can't change his/her password.
Not supported parameters
A few parameters are described in the specification, but aren't supported. Here is the list :
- ads-pwdMinDelay : The minimal delay the server waits before sending back a response.
- ads-pwdMaxDelay : The maximal delay the server waits before sending back a response.