LDAP(slapd)创build用户访问特定的树

我正在用Virtualmin和Postfix设置一个CentOS服务器,我正在尝试使用LDAP来存储unix用户,组,Postfix别名和虚拟域。 我遵循Webmin网站的指示 。

我创build了一个LDAP域,并configuration了Postfix来从LDAP中获取别名和虚拟域,但是为了这样做,我必须configurationpostfix以使用主LDAP帐户cn=Manager,dc=mydomain,dc=com进行authentication。 这似乎是一个可怕的想法,因为该帐户有权访问用户和组,后缀不需要访问。

如何为Postfix创build一个新的LDAP帐户,这个帐户只能访问Postfix需要的LDAP树?

你需要做两件事情:

  1. 在Postfix可以绑定的LDAP目录中创build一个对象(连接到)
  2. 在OpenLDAP的configuration中写一个ACL,允许这个用户绑定,并根据需要search树

要为Postfix添加一个简单的条目,可以使用graphics化的LDAP浏览器(例如Apache Directory Studio) ,也可以使用命令行工具ldapadd添加一个如下所示的对象:

 dn: cn=postfix,ou=Applications,dc=mydomain,dc=com cn: postfix objectClass: simpleSecurityObject objectClass: organizationalRole userPassword: {SSHA}n+aYhO/TOitWkyMp9v/fe5ndtOhY0/3U 

最后一行是您要使用的密码的哈希值,通过slappasswd实用程序生成:

 $ slappasswd -s secret {SSHA}n+aYhO/TOitWkyMp9v/fe5ndtOhY0/3U 

完成此操作后,将一些ACL添加到您的slapd.conf中,如下所示:

 access to dn.sub="dc=mydomain,dc=com" attrs=userPassword by anonymous auth access to dn.sub="ou=people,dc=mydomain,dc=com" by dn.exact="cn=postfix,ou=Applications,dc=mydomain,dc=com" read 

有关访问控制的更多详细信息,请参阅OpenLDAPpipe理指南一章 。 注意他们的订单,这很重要!

“火箭科学家的LDAP”的这一部分解释了如何为LDAP服务器树的部分设置ACL。