openldap: TLS: error: tlsm_PR_Recv returned 0 - error 22:Invalid argument

openldap: TLS: error: tlsm_PR_Recv returned 0 - error 22:Invalid argument

我们遇到了 openldap 问题。 好像 2 天前证书过期了。于是又产生了新的。 他们看起来不错。

当我执行 ldapsearch 时,我得到以下信息:

[root@xxx certs]# ldapsearch -H ldaps://xxx -D "cn=xxx,dc=xxx,dc=xxx" -W -b "ou=people,dc=xxx,dc=xxx" -d255 -v -x
ldap_url_parse_ext(ldaps://xxx)
ldap_initialize( ldaps://xxx:636/??base )
ldap_create
ldap_url_parse_ext(ldaps://xxx:636/??base)
Enter LDAP Password:
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP xxx:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying xxx:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
TLS: loaded CA certificate file /etc/pki/tls/certs/xxx.pem.
tls_write: want=157, written=157
  0000:  16 03 01 00 98 01 00 00  94 03 01 fd bf cb 8f 48   ...............H
  0010:  0b ef 1e c6 6e f3 b6 50  87 74 9e 2e 21 74 2d b6   ....n..P.t..!t-.
  0020:  a2 e9 49 90 72 56 1a a8  58 54 24 00 00 54 c0 0a   ..I.rV..XT$..T..
  0030:  c0 09 c0 13 c0 14 c0 08  c0 12 c0 07 c0 11 00 33   ...............3
  0040:  00 32 00 45 00 44 00 39  00 38 00 88 00 87 00 16   .2.E.D.9.8......
  0050:  00 13 00 66 c0 04 c0 0e  c0 05 c0 0f c0 03 c0 0d   ...f............
  0060:  c0 02 c0 0c 00 2f 00 41  00 35 00 84 00 96 00 0a   ...../.A.5......
  0070:  00 05 00 04 00 15 00 12  00 09 00 64 00 62 00 03   ...........d.b..
  0080:  00 06 01 00 00 17 ff 01  00 01 00 00 0a 00 08 00   ................
  0090:  06 00 17 00 18 00 19 00  0b 00 02 01 00            .............
tls_read: want=5, got=0

TLS: error: tlsm_PR_Recv returned 0 - error 22:Invalid argument
TLS: error: connect - force handshake failure: errno 22 - moznss error -5938
TLS: can't connect: TLS error -5938:Encountered end of file.
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

我相信配置是正确的。 cacert pem 文件保持不变,cert 和 key pem 文件已添加到同一目录中,并且 slapd.conf 和 ldap.conf 已更新为指向这些文件。

不确定使用 openssl s_client -connect 是否应该打开 SSL 连接。似乎根本没有返回任何 SSL 证书。 我还尝试将配置更改回原始配置(因此使用了旧证书)但显示了相同的行为(这些已过期,因此在这种情况下可能会解释)。 根据我在文档中看到的内容,需要有效的服务器证书。

请注意,这是同步 ldap 设置。

调试已达到最大程度,唯一似乎相关的是 connection_read(13): TLS 接受失败错误=-1 id=1055,正在关闭 ... conn=1055 fd=13 关闭(TLS 协商失败)

在此先感谢您的帮助!

所以在花了太多时间尝试之后,然后发布然后思考: 可能还有其他地方配置了这个证书.

我进入 /etc/openldap 并寻找 pem 的出现。 slap.d 中也有匹配项(我以前从未使用过 ldap,所以我认为这是您可以在 1 个配置中配置的东西,而不是 5 个具有相同值的不同位置)。 编辑所有事件并重新启动 slapd 服务...现在可以工作(在缓存过期后)。

这是我见过的最糟糕的错误消息之一。在调试时日志中没有任何具体内容。

希望对其他人有所帮助!