【问题标题】:Active directory and linux nslcd binding without extending the AD schemaActive Directory 和 linux nslcd 绑定,无需扩展 AD 架构
【发布时间】:2015-08-23 21:43:12
【问题描述】:

我需要将 linux 客户端绑定到 Windows Server 2012 Active Directory。我有一个测试环境,我使用 samba-winbind-kerberos 和 nslcd 都成功地做到了这一点,并使用用户进行身份验证。但是,当使用 samba-winbind-kerberos 时,我能够在不扩展 AD 架构以包含 UNIX 属性(UID/GID、主目录、shell)的情况下实现这一点,因为 smb.conf 有一个 idmap 选项,指定起始范围

idmap config *:range = 11000-20000

这将处理 AD 用户的 UID/GID 的 unix 映射。

如果我没有在 AD 中启用 UNIX 属性,我会在 nslcd 调试日志中得到一个错误,上面写着

uidNumber: missing

有没有办法在 nslcd/libnss_ldap 中使用相同的功能,这样我就不必在 Windows server 2012 上扩展 AD 架构了?我不喜欢在生产环境中使用 samba,因为它存在远程代码执行漏洞。

【问题讨论】:

    标签: linux windows active-directory windows-server-2012 openldap


    【解决方案1】:

    目前这是不可能的。根据他们的文档,nslcd 没有可用的 id 映射,这需要扩展您的 AD 架构以具有 unix 属性。

    【讨论】:

      【解决方案2】:

      使用 CentOS Linux 版本 7.4.1708(核心)和 nslcd 版本 0.8.13 对抗 Windows 2016 AD,没有任何架构扩展,我今天能够配置它并让它正常工作。

      我主要关注的是 Serverfault 文章“LDAP authentication on CentOS 7”,并且不得不在/etc/nslcd.conf 部分使用Alternative mappings for Active Directoryreplace the SIDs in the objectSid mappings with the value for your domain

      对于“Get SID by its objectSid using ldapsearch”,我使用了linked script

      其他映射被设置为

      filter passwd (&(objectClass=user)(objectClass=person)(!(objectClass=computer)))
      map    passwd uid           sAMAccountName
      map    passwd uidNumber     objectSid:<yourValue>
      map    passwd gidNumber     primaryGroupID
      map    passwd homeDirectory "/home/$sAMAccountName"
      map    passwd gecos         displayName
      map    passwd loginShell    "/bin/bash"
      map     group gidNumber      primaryGroupID
      

      【讨论】:

      • 谢谢@U880D。我不确定 Windows 2016,但对于 Windows Server 2012 版本,默认架构不附带 map group gidNumber primaryGroupID 中提到的 primaryGroupID。
      • 根据 MS 文档Primary-Group-ID attribute 它应该在那里。但是,您也可以尝试map passwd gidNumber objectSid:&lt;yourValue&gt; map group gidNumber objectSid:&lt;yourValue&gt;,因为这也适用于我的设置。
      • 确实,objectSid 方法适用于 Debian 9 Stretch,如下所示:map passwd uid sAMAccountName map passwd uidNumber objectSid:S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx map passwd gidNumber primaryGroupID map passwd gecos displayName map group gidNumber objectSid:S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx map group cn sAMAccountName
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-24
      相关资源
      最近更新 更多