LDAP Admin から pwdAccountLockedTime を設定してユーザを無効化する
OpenLDAP で ppolicy overray を有効化し、パスワードポリシーを制御出来る状態にしてあれば、ユーザに pwdAccountLockedTime 属性を 000001010000Z という値で設定することにより、該当アカウントを無効化出来るそうです。 但し、LDAP Admin 標準では pwdAccountLockedTime 属性を操作することが出来ません。 そこで LDAP Admin に SSH の公開鍵を追加するテンプレートを追加するの場合と同様、テンプレートを追加することで LDAP Admin 上から pwdAccountLockedTime を設定出来るようにします。
pwdAccountLockedTime に設定する値
man slapo-ppolicy を確認すると pwdAccountLockedTime について以下のように書かれていました。 この属性に 000001010000Z という値を設定すると永久にユーザはロックされるそうです。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | pwdAccountLockedTime
This attribute contains the time that the user's account was locked.
If the account has been locked, the password may no longer be used to
authenticate the user to the directory. If pwdAccountLockedTime is set
to 000001010000Z, the user's account has been permanently locked and
may only be unlocked by an administrator. Note that account locking
only takes effect when the pwdLockout password policy attribute is set
to "TRUE".
( 1.3.6.1.4.1.42.2.27.8.1.17
NAME 'pwdAccountLockedTime'
DESC 'The time an user account was locked'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
EQUALITY generalizedTimeMatch
ORDERING generalizedTimeOrderingMatch
SINGLE-VALUE
NO-USER-MODIFICATION
USAGE directoryOperation)
|
テンプレートを用意する
以下の内容でテンプレートを用意します。 今回は account-lock.ltf というファイル名にし、LDAP Admin の実行ファイルと同じディレクトリに保存しました。 テンプレートの作成が完了したら LDAP Admin を再起動してテンプレートを読み込ませておきます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 | <template>
<name>AccountLock</name>
<description>Account Lock Attribute (pwdAccountLockedTime)</description>
<author>sig9</author>
<version>1.0</version>
<email>sig9@sig9.org</email>
<rdn>cn</rdn>
<extends>user</extends>
<attribute>
<name>objectclass</name>
<value>top</value>
<value>pwdPolicy</value>
</attribute>
<attribute>
<name>pwdAttribute</name>
<value>userPassword</value>
</attribute>
<attribute type="text">
<name>pwdAccountLockedTime</name>
<description>This attribute holds the time that the user's account was locked.</description>
<control type="combolist">
<items>
<item>
<value>000001010000Z</value>
<caption>Lock</caption>
</item>
</items>
</control>
</attribute>
</template>
|
LDAP Admin からユーザのプロパティを開くと Account proterties に AccountLock というチェックボックスが増えています。 これにチェックを入れると AccountLock というタブが増えるので、このタブをを選択します。

表示されたコンボリストから Lock を選択すると選択しているユーザの pwdAccountLockedTime 属性に 000001010000Z という値が設定されます。

但し、一度 GUI から設定してしまうと、この値は削除出来ないようです。
CLI から pwdAccountLockedTime 属性を削除する
pwdAccountLockedTime 属性を削除するには OpenLDAP サーバ上で以下のような .ldif ファイルを新規作成します。 今回は delete-pwdAccountLockedTime.ldif というファイル名にしました。
| dn: cn=unnecessary-user,ou=Users,dc=example,dc=com
changetype: modify
delete: pwdAccountLockedTime
|
ldapmodify を使ってこの .ldif を反映することで pwdAccountLockedTime 属性を削除出来ます。
| ldapmodify -D cn=Manager,dc=example,dc=com -W -f ./delete-pwdAccountLockedTime.ldif
|