SASL LDAP 身份验证失败

SASL LDAP authentication failure

正在尝试使用 SASLLDAPRedHat Linux 中的用户进行身份验证。到目前为止,我已经设置了 saslauthd 服务及其启动和 运行。我的 /etc/saslauthd.conf 如下所示:

ldap_servers: ldaps://test.ldap.server:1234
ldap_use_sasl: yes
ldap_mech: DIGEST-MD5
ldap_auth_method: fastbind
ldap_search_base: Ou=PeopleAuthSrch,DC=abc,DC=com

我的 /etc/sasl2/smtpd.conf 如下所示:

pwcheck_method: saslauthd
mech_list: plain login

现在,当我尝试使用以下命令测试身份验证时:

testsaslauthd -u username -p password -f /var/run/saslauthd/mux

我得到0: NO "authentication failed"

当我查看日志时,它说:

Retrying authentication
do_auth   :auth failure: [user:myuser]  [service=imap] [realm=] [mech=ldap] [reason=unknown]

我在这里错过了什么?提前致谢!!

更新:

已安装 OpenLdap 以使用以下命令进行搜索:

ldapsearch -x -h ldaps://my.ldap.server:port -d8

为了使 ldapsearch 命令正常工作,我修改了 /etc/openldap/ldap.conf 文件,如下所示:

tls_reqcert allow
TLS_CACERTDIR /home/myuser/cacertss
LDAPTLS_CACERT /home/myuser/cacertss

它 returns 所有条目,但我仍然无法使用

进行身份验证

testsaslauthd -u username -p password -f /var/run/saslauthd/mux

我需要在这里做什么才能通过身份验证?

我在 RedHat Linux 7.2 上完成了使用 OpenLDAP 和 TLS 设置 SASL 设置的练习,我设法得到了类似的工作正常。

正如我在之前的 post 中提到的,确保您安装了 cyrus-sasl-md5 软件包。

我会首先尝试在没有 SSL 的情况下让一切正常工作。只有在您的设置在没有 SSL 的情况下工作后才能移动到 SSL 部分。

  • 您需要确保saslauthd接受的CA证书 LDAP 服务器使用的证书。特别是,
    ldap_tls_cacert_file /etc/saslauthd.conf 中的选项是你的朋友
  • 如果您启用了 SELinux,请确保 saslauthd 可以访问证书文件。如果您不确定,请跟踪 /var/log/audit/audit.log 文件并查找带有 "denied" 关键字的条目。我发现 audit2allow 工具是启用之前被拒绝的访问的好方法。您也可以使用 setenforce Permissive 命令
  • 暂时禁用 SELinux

经过 5 天的努力,我发现我使用的设置是 Active directory,而我应该使用 LDAP 的设置如下:

ldap_servers: ldaps://test.ldap.server:1234
ldap_search_base: Ou=PeopleAuthSrch,DC=abc,DC=com
ldap_filters: (uid=%u)
ldap_tls_cacert_file: /path/to/my/certificate

我确实像 Bertold Kolics 提到的那样安装了 cyrus-sasl-md5,我不确定这是否对验证用户起到了作用。