使用 Oracle® Solaris 11.2 目录和命名服务:LDAP

退出打印视图

更新时间: 2014 年 7 月
 
 

配置目录服务器以启用帐户管理

可以为使用 pam_ldap 的客户机和使用 pam_unix_* 模块的客户机实施帐户管理。


Caution

注意  -  不要在同一个 LDAP 命名域中同时使用 pam_ldappam_unix_* 模块。要么所有客户机都使用 pam_ldap 模块,要么所有客户机都使用 pam_unix_* 模块。因为存在这种限制,您可能需要专用的 LDAP 服务器。


使用 pam_ldap 模块的客户机的帐户管理

为了让 pam_ldap 能够正常工作,必须在服务器上正确配置口令和帐户锁定策略。您可以使用 Directory Server Console 或 ldapmodify 为 LDAP 目录配置帐户管理策略。有关具体过程和更多信息,请参见您所用 Oracle Directory Server Enterprise Edition 版本的管理指南中的“用户帐户管理”一章。


注 -  以前在使用 pam_ldap 帐户管理时,所有用户在每次登录系统时都必须提供登录口令以进行验证。因此,使用 ssh 等工具进行非基于口令的登录将失败。

在用户登录时,您现在可以在不向目录服务器进行验证的情况下执行帐户管理并检索用户的帐户状态。

目录服务器上的新控制为 1.3.6.1.4.1.42.2.27.9.5.8。缺省情况下,此控制处于启用状态。要修改缺省控制配置,请在目录服务器上添加访问控制指令 (access control instruction, ACI)。例如:

dn: oid=1.3.6.1.4.1.42.2.27.9.5.8,cn=features,cn=config
objectClass: top
objectClass: directoryServerFeature
oid:1.3.6.1.4.1.42.2.27.9.5.8
cn:Password Policy Account Usable Request Control
aci: (targetattr != "aci")(version 3.0; acl "Account Usable";
allow (read, search, compare, proxy)
(groupdn = "ldap:///cn=Administrators,cn=config");)
creatorsName: cn=server,cn=plugins,cn=config
modifiersName: cn=server,cn=plugins,cn=config

绝不应当允许 proxy 用户的口令过期。如果代理口令过期,使用 proxy 凭证级别的客户机将无法从服务器检索命名服务信息。为了确保代理用户的口令不过期,请使用以下脚本修改代理帐户:

# ldapmodify -h ldapserver -D administrator_DN \
-w administrator-password <<EOF
dn: proxy-user-DN
DNchangetype: modify
replace: passwordexpirationtime
passwordexpirationtime: 20380119031407Z
EOF

注 -  pam_ldap 帐户管理依赖 Oracle Directory Server Enterprise Edition 为用户维护和提供口令生命期与帐户过期信息。目录服务器不对来自影子条目的对应数据进行解释以验证用户帐户。不过,pam_unix_* 模块会检查影子数据以确定帐户是否被锁定或口令是否已老化。因为影子数据未由 LDAP 命名服务或目录服务器保持为最新状态,所以这些模块不应当基于影子数据授予访问权限。影子数据是使用 proxy 标识检索的。因此,请不要允许 proxy 用户对 userPassword 属性具有读取访问权限。拒绝 proxy 用户对 userPassword 的读取访问权限可防止 PAM 服务进行无效的帐户验证。

使用 pam_unix_* 模块的客户机的帐户管理

要使 LDAP 客户机能够使用 pam_unix_* 模块进行帐户管理,必须对服务器进行设置以启用影子数据的更新。与 pam_ldap 帐户管理不同,pam_unix_* 模块不要求执行额外的配置步骤。所有配置均可运行 idsconfig 实用程序来执行。

下面的示例显示了两个 idsconfig 运行的输出。

第一个 idsconfig 运行使用现有的客户机配置文件。

# /usr/lib/ldap/idsconfig

It is strongly recommended that you BACKUP the directory server
before running idsconfig.

Hit Ctrl-C at any time before the final confirmation to exit.

Do you wish to continue with server setup (y/n/h)? [n] y
Enter the JES Directory Server's  hostname to setup: myserver
Enter the port number for DSEE (h=help): [389]
Enter the directory manager DN: [cn=Directory Manager]
Enter passwd for cn=Directory Manager :
Enter the domainname to be served (h=help): [west.example.com]
Enter LDAP Base DN (h=help): [dc=west,dc=example,dc=com]
Checking LDAP Base DN ...
Validating LDAP Base DN and Suffix ...
sasl/GSSAPI is not supported by this LDAP server

Enter the profile name (h=help): [default] WestUserProfile

Profile 'WestUserProfile' already exists, it is possible to enable
shadow update now. idsconfig will exit after shadow update
is enabled. You can also continue to overwrite the profile
or create a new one and be given the chance to enable
shadow update later.
Just enable shadow update (y/n/h)? [n] y
Add the administrator identity (y/n/h)? [y]
Enter DN for the administrator: [cn=admin,ou=profile,dc=west,dc=example,dc=com]
Enter passwd for the administrator:
Re-enter passwd:
ADDED: Administrator identity cn=admin,ou=profile,dc=west,dc=example,dc=com.
Proxy ACI LDAP_Naming_Services_proxy_password_read does not
exist for dc=west,dc=example,dc=com.
ACI SET: Give cn=admin,ou=profile,dc=west,dc=example,dc=com read/write access
to shadow data.
ACI SET: Non-Admin access to shadow data denied.

Shadow update has been enabled.

第二个 idsconfig 运行创建了新的配置文件供以后使用。这里显示的只是部分输出。

# /usr/lib/ldap/idsconfig

It is strongly recommended that you BACKUP the directory server
before running idsconfig.

Hit Ctrl-C at any time before the final confirmation to exit.

Do you wish to continue with server setup (y/n/h)? [n] y
Enter the JES Directory Server's  hostname to setup: myserver
Enter the port number for DSEE (h=help): [389]
Enter the directory manager DN: [cn=Directory Manager]
Enter passwd for cn=Directory Manager :
Enter the domainname to be served (h=help): [west.example.com]
Enter LDAP Base DN (h=help): [dc=west,dc=example,dc=com]
Checking LDAP Base DN ...
Validating LDAP Base DN and Suffix ...
sasl/GSSAPI is not supported by this LDAP server

Enter the profile name (h=help): [default] WestUserProfile-new
Default server list (h=help): [192.168.0.1]
.
.
.
Do you want to enable shadow update (y/n/h)? [n] y
              Summary of Configuration

1  Domain to serve               : west.example.com
2  Base DN to setup              : dc=west,dc=example,dc=com
Suffix to create          : dc=west,dc=example,dc=com
3  Profile name to create        : WestUserProfile-new
.
.
.
19  Enable shadow update          : TRUE
.
.
.
Enter DN for the administrator: [cn=admin,ou=profile,dc=west,dc=example,dc=com]
Enter passwd for the administrator:
Re-enter passwd:


WARNING: About to start committing changes. (y=continue, n=EXIT) y

1. Changed timelimit to -1 in cn=config.
2. Changed sizelimit to -1 in cn=config.
.
.
.
11. ACI for dc=test1,dc=mpklab,dc=sfbay,dc=sun,dc=com modified to
disable self modify.
.
.
.
15. Give cn=admin,ou=profile,dc=west,dc=example,dc=com write permission for shadow.
...