Samba 4 OpenLDAP身份validation问题

到目前为止我所做的

  • 为客户端的本地networking安装DHCP服务器和bind9(服务器应充当网关)
  • 从源代码构buildSamba4,将bind9_dlz作为dns后端
  • 使用apt-get install slapd ldap-utils安装OpenLDAP
  • 由于桑巴阻挡了390,637所以将slapd端口改为389,636
  • 导入了samba ldapscheme,最初设置了ldap目录并configuration了域
  • 为ldap身份validation安装了libnss-ldapdgetent passwd正确输出LDAP用户)
  • 给sambapipe理员密码到我的ldap目录( smbpasswd -w xxx

问题

我join了Windows 7客户端,并尝试login到使用smbldap-useradd创build的用户。 我从Windows收到一个错误的密码消息,但绝对没有从桑巴的错误/警告。 我的testing用户确实存在于LDAP中(使用phpldapadmin进行检查),所以我假定samba不能正确地与ldap交谈。 我困在这一点,需要一些帮助!

我注意到了什么

我已经设置了passdb backend = ldapsam:ldap://testsrv.alfr.local:390/这不会出现在testparm的输出中(见下方)。

我正在使用的软件

  • Ubuntu服务器12.04最新
  • Samba 4.1.6从源代码(官方的仓库)
  • 绑定9.8.1
  • slapd 2.4.28
  • isc-dhcp-server 4.1

configuration和输出

  • 服务器主机名: testsrv
  • 域名: alfr.local
  • 2个networking接口,eth0 = DHCP,外部广域网,eth1 = 192.168.25.1 (服务器充当该networking的DHCP,范围从25.50到25.254)

testparm输出

 root@testsrv:~# testparm Load smb config files from /usr/local/samba/etc/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[profiles]" Processing section "[netlogon]" Processing section "[sysvol]" Processing section "[homes]" Loaded services file OK. Server role: ROLE_ACTIVE_DIRECTORY_DC Press enter to see a dump of your service definitions [global] workgroup = ALFR realm = alfr.local server role = active directory domain controller passdb backend = samba_dsdb add user script = /usr/sbin/smbldap-useradd -m '%u' -t 1 rename user script = /usr/sbin/smbldap-usermod -r '%unew' '%uold' delete user script = /usr/sbin/smbldap-userdel '%u' add group script = /usr/sbin/smbldap-groupadd -p '%g' delete group script = /usr/sbin/smbldap-groupdel '%g' add user to group script = /usr/sbin/smbldap-groupmod -m '%u' '%g' delete user from group script = /usr/sbin/smbldap-groupmod -x '%u' '%g' add machine script = /usr/sbin/smbldap-useradd -w '%u' -t 1 domain logons = Yes os level = 10 preferred master = Yes domain master = Yes dns proxy = No wins support = Yes ldap admin dn = cn=admin,dc=alfr,dc=local ldap group suffix = ou=Groups ldap idmap suffix = ou=Idmap ldap machine suffix = ou=Computers ldap suffix = dc=alfr,dc=local ldap ssl = no ldap user suffix = ou=Users server services = rpc, nbt, wrepl, cldap, ldap, kdc, drepl, winbind, ntp_signd, kcc, dnsupdate, smb dcerpc endpoint servers = epmapper, wkssvc, rpcecho, samr, netlogon, lsarpc, spoolss, drsuapi, dssetup, unixinfo, browser, eventlog6, backupkey, dnsserver, winreg, srvsvc rpc_server:tcpip = no rpc_daemon:spoolssd = embedded rpc_server:spoolss = embedded rpc_server:winreg = embedded rpc_server:ntsvcs = embedded rpc_server:eventlog = embedded rpc_server:srvsvc = embedded rpc_server:svcctl = embedded rpc_server:default = external idmap config * : backend = tdb map archive = No map readonly = no store dos attributes = Yes vfs objects = dfs_samba4, acl_xattr [profiles] path = /srv/samba/profiles read only = No create mask = 0611 directory mask = 0700 profile acls = Yes map hidden = Yes map system = Yes browseable = No csc policy = disable [netlogon] path = /usr/local/samba/var/locks/sysvol/alfr.local/scripts read only = No [sysvol] path = /usr/local/samba/var/locks/sysvol read only = No [homes] comment = Eigener Ordner path = /srv/samba/homes/%S read only = No create mask = 0611 directory mask = 0711 browseable = No vfs objects = acl_xattr, full_audit full_audit:failure = connect opendir disconnect unlink mkdir rmdir open rename full_audit:success = connect opendir disconnect unlink mkdir rmdir open rename 

ps aux输出(剪掉不重要的东西)

 root@testsrv:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 699 0.0 0.0 7272 608 ? Ss 08:08 0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -1 eth bind 827 0.0 2.8 502280 58392 ? Ssl 08:08 0:01 /usr/sbin/named -u bind dhcpd 833 0.0 0.2 14552 4476 ? Ss 08:08 0:00 /usr/sbin/dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/ltsp/dhcpd.conf openldap 1024 0.0 0.3 722000 6524 ? Ssl 08:08 0:00 /usr/sbin/slapd -h ldap://127.0.0.1:390/ ldaps://127.0.0.1:637/ ldapi://%2fvar%2frun%2fslapd%2fldapi/?? root 1051 0.0 0.0 693092 1172 ? Ssl 08:08 0:00 /usr/sbin/nscd nslcd 1075 0.0 0.0 443600 1376 ? Ssl 08:08 0:00 /usr/sbin/nslcd ntp 1279 0.0 0.0 25960 1836 ? Ss 08:08 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 107:114 root 1595 0.0 2.2 534364 46152 ? Ss 09:52 0:00 samba start root 1597 0.0 1.8 538976 38532 ? S 09:52 0:00 samba start root 1598 0.0 1.7 539772 35624 ? S 09:52 0:00 samba start root 1599 0.0 1.6 536876 33716 ? S 09:52 0:00 samba start root 1600 0.0 1.6 534364 34568 ? S 09:52 0:00 samba start root 1601 0.0 1.8 534804 37568 ? S 09:52 0:00 samba start root 1602 0.0 1.8 538516 37212 ? S 09:52 0:00 samba start root 1603 0.0 1.6 534364 34328 ? S 09:52 0:00 samba start root 1604 0.0 1.6 537192 33928 ? S 09:52 0:00 samba start root 1605 0.0 1.5 534364 32716 ? S 09:52 0:00 samba start root 1606 0.0 2.0 534364 41264 ? S 09:52 0:00 samba start root 1607 0.0 1.6 534364 33884 ? S 09:52 0:00 samba start root 1608 0.0 1.6 534364 33360 ? S 09:52 0:00 samba start 

/etc/nsswitch.conf

 root@testsrv:~# cat /etc/nsswitch.conf # /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. # pre_auth-client-config # passwd: compat passwd: files ldap # pre_auth-client-config # group: compat group: files ldap # pre_auth-client-config # shadow: compat shadow: files ldap hosts: files dns networks: files protocols: db files services: db files ethers: db files rpc: db files # pre_auth-client-config # netgroup: nis netgroup: nis 

我没有看到您的configuration文件中的任何安全指令。 我假设你想要安全=广告。 我上个月花费在尝试做同样的事情 – 使用OpenLDAP作为用户login信息的主要数据库。

我testing了几种方法:

  1. Samba 4 AD现在还不能信任(Samba Team将在发布的时候很快发布Samba 4.2),所以你不能使用信任机制。

  2. 据我所知,AD中的Samba 4不能基于OpenLDAP,因为缺lessActive Directory所需的模式。

  3. 我已经厌倦了使用名为LSC的软件,它基本上允许您在AD和OpenLDAP之间同步用户和组。 这里也没有运气。 LSC文档和示例已过时,与当前版本不兼容。 我终于设法让用户同步工作,但是有很less的错误(至less在我已经厌倦了的LSC v2.0中),当你在OpenLDAP中更新密码时,LSC将无法捕捉到它。 您必须以纯文本forms存储密码才能使其正常工作。

目前没有Samba AD控制器,OpenLDAP作为后端。 我打算一旦Samba支持信任就坚持经典的NT域控制器,那么我想委托一个方向的信任(从Samba4 NT DC到Samba4 AD),并在AD域控制器上使用位于OpenLDAP的用户信息。

如果有人能在这里发现任何错误,我会非常乐意听到它。 😉

更新 :根据Samba 4.3中的Francesco Malvezzi信息,现在支持信任:

https://www.samba.org/samba/history/samba-4.3.0.html

改进对受信任域的支持(如AD DC)

对受信任的域/森林的支持有了很大的提高。

samba-tool有“域名信任”子命令来pipe理信任:

create – 创build一个域或森林信任。

delete – 删除域信任。

list – 列出域信任。

namespaces – pipe理森林信任名称空间。

show – 显示信任域的详细信息。

validate – validation域信任。

各个域之间的外部信任以两种方式工作(入站和出站)。 这同样适用于森林信任的根域。 传递到其他林中的传递路由function对Kerberos完全有效,但尚不支持NTLMSSP。

虽然很多事情都很好,但是目前还有一些限制:

  • 信任双方需要充分相互信任!
  • 根本不应用SID过滤规则!
  • 这意味着域A的DC可以在域B中授予域pipe理员权限
  • 将受信任域的用户/组添加到域组是不可能的。

configuration示例: https : //www.samba.org/samba/history/samba-4.3.0.html

build立信任关系,可以使用winbind进行检查:

wbinfo -u – >获取本地用户列表

wbinfo -u --domain=trusted.domain.tld – >获取受信任的域用户列表(短域也可以使用)

也可以使用--local-dc-username--local-dc-password开关进行validation:

samba-tool domain trust validate trusted.domain.tld \ --local-dc-password=trustedAdminPass \ --local-dc-username=administrator \ -U administrator at trusted.domain.tld

使用Samba的内部DNS使得DNS查询转发透明(使用我想要检查的几个工具)。

为了能够使用B.domain.tld中的用户在machine.A.domain.tld上进行连接,您必须为RDP授权的人员“authentication用户”特殊组。

我仍然在等待,直到在发行版的官方频道(debian 8-9)中可用。

你有明确的需要使用ldap吗?

我使用samba活动目录已经有一年多了,唯一的问题就是使用了timecew。 你应该仔细检查,特别是当你使用虚拟机。

我一直在使用SAMBA制作LDAP服务器。 我遇到的SAMBA问题,可能会让你感到困扰,是SAMBA不同版本之间的configuration。 你确定你使用适合你的版本的桑巴configuration? 如果您复制.bash_history,这将是非常有帮助的,所以我可以查找任何错误configuration,甚至在机器上testing它。