pam_ldap,过滤器在哪里设置?

pam_ldap,过滤器在哪里设置?

不久前我已经问过一个关于这个问题的问题(CentOS 上的 Cyrus 使用 sasl / pam / ldap),我又前进了一步。绑定 DN 不再为空;LDAP 适用于除 imap 之外的所有应用程序。

每当我尝试使用 imtest 登录时:

[root@testserv ~]# imtest -u [email protected] -a [email protected]

我在 slapd.log 中收到此消息:

Oct 17 01:22:06 testserv slapd[1745]: conn=2627 op=2 SRCH base="o=mydomain,c=com" scope=2 deref=0 filter="(&(objectClass=posixAccount)([email protected]))" 

我不明白的是,过滤器“(&(objectClass = posixAccount)([电子邮件保护])”从何而来?我没有把它放在任何配置文件中;过滤器必须在邮件上,但无论我改变什么,这就是我得到的。

我的 /etc/pam.d/imap:

auth       sufficient   /lib64/security/pam_unix.so debug likeauth nullok
auth       sufficient   /lib64/security/pam_ldap.so debug use_first_pass
auth       required     /lib64/security/pam_deny.so
account    sufficient   /lib64/security/pam_unix.so
account    sufficient   /lib64/security/pam_ldap.so

我的 /etc/saslauthd.conf:

ldap_servers: ldap://127.0.0.1/
ldap_search_base: dc=%d,o=mydomain,c=com
ldap_bind_dn: cn=Manager,o=mydomain,c=com
ldap_password: ***********
ldap_auth_method: bind 
ldap_filter: (|(uid=%u)((&(mail=%u@%d)(accountStatus=active))) 
ldap_debug: 1 
ldap_version: 3

在 /etc/sysconfig/saslauthd 中:

# Directory in which to place saslauthd's listening socket, pid file, and so
# on.  This directory must already exist.
SOCKETDIR=/var/run/saslauthd

# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
MECH=pam

# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
# for the list of accepted flags.
FLAGS="-c -r -O /etc/saslauthd.conf"

/etc/imap.conf 中的一些值:

sasl_mech_list: PLAIN LOGIN
sasl_pwcheck_method: saslauthd

在 /etc/ldap.conf 中我设置了以下内容:

# The user ID attribute (defaults to uid)
pam_login_attribute mail

正如我所说,其他应用程序确实可以使用 LDAP,因此我认为它与 PAM/SASL 有关... 而我陷入了困境 :-S

答案1

# myuser, accounts, testserv.mydomain.com, mydomain, com

dn: uid=myuser,ou=accounts,dc=testserv.mydomain.com,o=mydomain,c=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uidNumber: 16
uid: myuser
gidNumber: 5
givenName: My
sn: Name
mail: [email protected]
cn: My Name
userPassword:: dYN5ebB0fXhNRn1pZllhRnJX7Uk=
shadowLastChange: 15176
homeDirectory: /dev/null 

怎么样:

ldap_filter: mail=%u

相关内容