如何让 FreeNAS 与 LDAP 身份验证一起工作?

如何让 FreeNAS 与 LDAP 身份验证一起工作?

我正在尝试设置具有 LDAP 身份验证的 CIFS 共享的 FreeNAS 9.1.1 服务器。

我已经设置了一个 OpenLDAP 服务器,在其中填充了smbldap-populate,为自己添加了一个用户帐户,并在 FreeNAS 上配置了 LDAP 客户端以利用该目录。在我看来,FreeNAS 可以很好地检索用户和组,因为getent passwdgetent group输出列出了我在 OpenLDAP 服务器上设置的实体。

到目前为止一切顺利。我现在创建了一个新的 ZFS 卷,并将其设置为由我的 LDAP 用户帐户拥有,并且域管理员团体。

当我现在尝试使用共享时,通过net use \\freenas\zfs0-share在 Windows 命令行上发出,我得到以下结果:

System error 59 has occured.
An unexpected network error occurred.

在我的 FreeNAS 控制台中,我得到以下输出:

freenas smbd: auth/check_samsec.c:491(check_sam_security)
check_sam_security: make_server_info_sam() failed with NT_STATUS_UNSUCCESSFUL

此错误表示什么?我该如何解决?

答案1

为了找到该问题的原因,我首先以较高的调试级别在交互模式下启动 Samba,以查看输出中是否有任何有帮助的消息:

/usr/local/sbin/smbd --interactive --debuglevel=3

现在我得到了比以前更多有用的输出:

check_ntlm_password:  Checking password for unmapped user [WORKGROUP]\[osalzburg]@[LDAP] with the new password interface
check_ntlm_password:  mapped user is: [FREENAS]\[osalzburg]@[LDAP]
init_sam_from_ldap: Entry found for user: osalzburg
Primary group S-1-5-21-1400563477-347728745-2499486669-512 for user osalzburg is a UNKNOWN and not a domain group
Forcing Primary Group to 'Domain Users' for osalzburg
The primary group domain sid(S-1-5-21-1134279832-878937066-538846017-513) does not match the domain sid(S-1-5-21-1400563477-347728745-2499486669) for osalzburg(S-1-5-21-1400563477-347728745-2499486669-3002)
check_sam_security: make_server_info_sam() failed with 'NT_STATUS_UNSUCCESSFUL'
check_ntlm_password:  Authentication for user [osalzburg] -> [osalzburg] FAILED with error NT_STATUS_UNSUCCESSFUL
error packet at smbd/sesssetup.c(124) cmd=115 (SMBsesssetupX) NT_STATUS_UNSUCCESSFUL
Server exit (failed to receive smb request)
Terminated: 15

这里的关键是部分:

The primary group domain sid
  (S-1-5-21-1134279832-878937066-538846017-513) does not match the domain sid
  (S-1-5-21-1400563477-347728745-2499486669) for osalzburg(S-1-5-21-1400563477-347728745-2499486669-3002)

为了解决不匹配问题,我将sambaSID我的FREENAS sambaDomainName条目更改S-1-5-21-1400563477-347728745-2499486669此错误报告评论

我不确定我到底在哪里搞砸了我的设置,但运行带有调试输出的 Samba 是找到问题原因的关键。

相关内容