Samba + LDAP acl – 匿名绑定?

我有一个工作Samba PDC使用OpenLDAP作为后端。 我即将build立一个samba代理用户,并在编写正确的安全ACL时遇到问题。

我用这个acl:

{0}to * by group.exact="cn=ldap.admins,ou=groups,dc=example,dc=com" write by * break {1}to dn.one="dc=example,dc=com" filter=(objectClass=sambaDomain) by group.exact="cn=samba.admins,ou=groups,dc=example,dc=com" write by * break {2}to attrs=@sambaSamAccount,userPassword by group.exact="cn=samba.admins,ou=groups,dc=example,dc=com" write by * break {3}to dn.subtree="ou=people,dc=example,dc=com" attrs=userPassword by self write by * break {4}to attrs=userPassword,shadowLastChange,sambaNTPassword,sambaLMPassword,sambaPwdLastSet,sambaPwdMustChange by self read by anonymous auth by * none {5}to * by users read 

(在这里find: http : //blogger.ziesemer.com/2011/01/ldap-authentication-for-samba.html )

和Windows窗体我无法login(Windows说不正确的密码或用户名。

当我插入一个新的olcAccess行作为规则0号,一切都是完美的:

 olcAccess: {0}to * by * read 

认为 ,这种行为是由于身份validation过程中samba重新连接到OpenLDAP的事实造成的:使用代理用户的samba连接被丢弃,并启动匿名绑定。

在日志中你看到这样的线条:

 Jul 6 12:06:06 ubuserver slapd[1088]: conn=1110 fd=48 ACCEPT from PATH=/var/run/slapd/ldapi (PATH=/var/run/slapd/ldapi) Jul 6 12:06:06 ubuserver slapd[1088]: conn=1110 op=0 BIND dn="" method=128 Jul 6 12:06:06 ubuserver slapd[1088]: conn=1110 op=0 RESULT tag=97 err=0 text= Jul 6 12:06:06 ubuserver slapd[1088]: conn=1110 op=1 SRCH base="dc=example,dc=com" scope=2 deref=0 filter="(&(objectClass=posixAccount)(uid=suser2))" Jul 6 12:06:06 ubuserver slapd[1088]: conn=1110 op=1 SRCH attr=uid userPassword uidNumber gidNumber cn homeDirectory loginShell gecos description objectClass Jul 6 12:06:06 ubuserver slapd[1088]: => access_allowed: search access to "dc=itthon,dc=cucc" "entry" requested Jul 6 12:06:06 ubuserver slapd[1088]: => acl_get: [1] attr entry Jul 6 12:06:06 ubuserver slapd[1088]: => acl_mask: access to entry "dc=example,dc=com", attr "entry" requested Jul 6 12:06:06 ubuserver slapd[1088]: => acl_mask: to all values by "", (=0) Jul 6 12:06:06 ubuserver slapd[1088]: <= check a_dn_pat: * Jul 6 12:06:06 ubuserver slapd[1088]: <= acl_mask: [2] applying +0 (break) Jul 6 12:06:06 ubuserver slapd[1088]: <= acl_mask: [2] mask: =0 Jul 6 12:06:06 ubuserver slapd[1088]: => dn: [2] dc=example,dc=com Jul 6 12:06:06 ubuserver slapd[1088]: => dn: [4] ou=people,dc=example,dc=com Jul 6 12:06:06 ubuserver slapd[1088]: => acl_get: [6] attr entry Jul 6 12:06:06 ubuserver slapd[1088]: => acl_mask: access to entry "dc=example,dc=com", attr "entry" requested Jul 6 12:06:06 ubuserver slapd[1088]: => acl_mask: to all values by "", (=0) Jul 6 12:06:06 ubuserver slapd[1088]: <= check a_dn_pat: users Jul 6 12:06:06 ubuserver slapd[1088]: <= acl_mask: no more <who> clauses, returning =0 (stop) 

问题:

  1. 我是否理解问题是由匿名重新绑定造成的?
  2. 有没有办法告诉Samba总是与代理用户(在smb.conf中的ldap admin dn中指定的用户)绑定?
  3. 如果没有,那么有没有办法设置安全的ACL,即不给每个人读取权限?

(系统是Ubuntu 12.04)

这个问题是桑巴把这个工作交给了PAM,而在/etc/ldap.conf中,我忘记了填写绑定用户并绑定了pw。 所以PAM以匿名forms绑定到LDAP,并且没有权限读取这些属性。