20.2. 使用命令行配置 RootDN 访问控制插件
默认情况下,RootDN Access Control
插件被禁用。要限制 Directory Manager 帐户的权限,请启用并配置插件。
流程
启用
RootDN Access Control
插件:dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn enable
# dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn enable
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置绑定规则。例如,要允许 Directory Manager 帐户仅从 IP 地址为
192.0.2.1
的主机登录 6am 和 9pm,请输入:dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn set --open-time=0600 --close-time=2100 --allow-ip="192.0.2.1"
# dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn set --open-time=0600 --close-time=2100 --allow-ip="192.0.2.1"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 有关您可以设置的参数及其描述的完整列表,请输入:
dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn set --help
# dsconf -D "cn=Directory Manager" ldap://server.example.com plugin root-dn set --help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重启实例:
dsctl instance_name restart
# dsctl instance_name restartdsctl instance_name restartdsctl instance_name restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
从不允许或者超过允许的时间范围的主机执行来自
cn=Directory Manager
的查询:[user@192.0.2.2]$ ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b "dc=example,dc=com" Enter LDAP Password: ldap_bind: Server is unwilling to perform (53) additional info: RootDN access control violation
[user@192.0.2.2]$ ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b "dc=example,dc=com" Enter LDAP Password: ldap_bind: Server is unwilling to perform (53) additional info: RootDN access control violation
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果 Directory Server 拒绝访问,则插件可以正常工作。