我已经将OpenLDAP设置为AD代理,根据:https://wiki.samba.org/index.php/OpenLDAP_作为_代理_至_广告
对于使用完整dn:属性的标准bindDN (例如cn=jdoe,ou=users,dc=example,dc=com)的客户端,一切都很正常。
有些客户端使用userPrincipalName作为bindDN,AD完全可以,但OpenLDAP代理则不行,后者在连接时抛出一个错误:
conn=1002 op=1 do_bind: invalid dn (jdoe@example.com)
send_ldap_result: conn=1002 op=1 p=3
send_ldap_result: err=34 matched="" text="invalid DN"
send_ldap_response: msgid=2 tag=97 err=34
conn=1002 op=1 RESULT tag=97 err=34 text=invalid DN我尝试使用rwm -重写规则重写bindDN of userPrincipalName。虽然它适用于标准绑定dn(例如,cn=jdoe,ou=users,dc=example,dc=com),但没有工作。
这不管用:
rwm-rewriteRule "(.+,)@example.com$" "cn=$1,ou=users,dc=example,dc=com" ":"这样做是可行的:
rewritin ou=users for ou=employees as a test:rwm-重写规则(.+,)?ou=users,dc=example,dc=com$“$1ou=employees,dc=example,dc=com”:
有没有办法把bindDN of jdoe@example.com改写成bindDN of cn=jdoe,ou=users,dc=example,dc=com?
下面是我当前的配置:
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/misc.schema
include /etc/openldap/schema/nis.schema
modulepath /usr/lib64/openldap/
moduleload back_ldap
moduleload rwm
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
database ldap
readonly yes
protocol-version 3
rebind-as-user yes
uri "ldap://X.X.X.X:389"
suffix "dc=example,dc=com"
overlay rwm
rwm-rewriteEngine on
rwm-rewriteRule "(.+,)@example.com$" "cn=$1,ou=users,dc=example,dc=com" ":"
logfile /var/log/slapd/slapd.log
loglevel -1
TLSCACertificatePath /etc/openldap/certs
TLSCertificateFile "OpenLDAP Server"
TLSCertificateKeyFile /etc/openldap/certs/password 发布于 2019-02-05 18:36:20
可以用slapo重写bind是对的,但它们必须是DNs。
因此,即使通过使用filter uid=user@example.com搜索条目,也可以将简短的DN uid=user,dc=example,dc=com重写为(attr=user@example.com)。
但是要重写的短表单必须是在RFC 4514中定义的有效的DN字符串表示形式,而不是像MS那样仅仅是用户主体名称user@example.com。
参见slapo-rwm(5)中的示例。
https://serverfault.com/questions/949699
复制相似问题