Ubuntu 14.04,OpenLDAP TLS 问题

Ubuntu 14.04,OpenLDAP TLS 问题

我已经使用以下方式设置了 openldap 服务器本指南在这里。它工作正常。但由于我想使用 sssd,因此还需要 TLS 才能为 LDAP 工作。我查看并遵循了TLS指南的一部分。

我没有收到任何错误并且 slapd 再次正常启动。

但是。当我尝试使用 LDAP over TLS 时,它似乎不起作用。

root@server:~# ldapsearch -x -ZZ -H ldap://83.209.243.253 -b dc=daladevelop,dc=se
ldap_start_tls: Protocol error (2)
    additional info: unsupported extended operation

提高调试级别可以返回更多信息:

root@server:~# ldapsearch -x -ZZ -H ldap://83.209.243.253 -b dc=daladevelop,dc=se -d 5
ldap_url_parse_ext(ldap://83.209.243.253)
ldap_create
ldap_url_parse_ext(ldap://83.209.243.253:389/??base)
ldap_extended_operation_s
ldap_extended_operation
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP 83.209.243.253:389
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 83.209.243.253:389
ldap_pvt_connect: fd: 3 tm: -1 async: 0
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_scanf fmt ({) ber:
ber_flush2: 31 bytes to sd 3
ldap_result ld 0x7f25df51e220 msgid 1
wait4msg ld 0x7f25df51e220 msgid 1 (infinite timeout)
wait4msg continue ld 0x7f25df51e220 msgid 1 all 1
** ld 0x7f25df51e220 Connections:
* host: 83.209.243.253  port: 389  (default)
  refcnt: 2  status: Connected
  last used: Fri Jun  6 08:52:16 2014


** ld 0x7f25df51e220 Outstanding Requests:
 * msgid 1,  origid 1, status InProgress
   outstanding referrals 0, parent count 0
  ld 0x7f25df51e220 request count 1 (abandoned 0)
** ld 0x7f25df51e220 Response Queue:
   Empty
  ld 0x7f25df51e220 response count 0
ldap_chkResponseList ld 0x7f25df51e220 msgid 1 all 1
ldap_chkResponseList returns ld 0x7f25df51e220 NULL
ldap_int_select
read1msg: ld 0x7f25df51e220 msgid 1 all 1
ber_get_next
ber_get_next: tag 0x30 len 42 contents:
read1msg: ld 0x7f25df51e220 msgid 1 message type extended-result
ber_scanf fmt ({eAA) ber:
read1msg: ld 0x7f25df51e220 0 new referrals
read1msg:  mark request completed, ld 0x7f25df51e220 msgid 1
request done: ld 0x7f25df51e220 msgid 1
res_errno: 2, res_error: <unsupported extended operation>, res_matched: <>
ldap_free_request (origid 1, msgid 1)
ldap_parse_extended_result
ber_scanf fmt ({eAA) ber:
ldap_parse_result
ber_scanf fmt ({iAA) ber:
ber_scanf fmt (}) ber:
ldap_msgfree
ldap_err2string
ldap_start_tls: Protocol error (2)
        additional info: unsupported extended operation
ldap_free_connection 1 1
ldap_send_unbind
ber_flush2: 7 bytes to sd 3
ldap_free_connection: actually freed

所以那里也没有有用的信息。

在 /var/log/syslog 中我得到:

Jun  6 08:55:42 master slapd[21383]: conn=1008 fd=23 ACCEPT from IP=83.209.243.253:56440 (IP=0.0.0.0:389)
Jun  6 08:55:42 master slapd[21383]: conn=1008 op=0 EXT oid=1.3.6.1.4.1.1466.20037
Jun  6 08:55:42 master slapd[21383]: conn=1008 op=0 do_extended: unsupported operation "1.3.6.1.4.1.1466.20037"
Jun  6 08:55:42 master slapd[21383]: conn=1008 op=0 RESULT tag=120 err=2 text=unsupported extended operation
Jun  6 08:55:42 master slapd[21383]: conn=1008 op=1 UNBIND
Jun  6 08:55:42 master slapd[21383]: conn=1008 fd=23 closed

如果我对主机进行端口扫描,我会得到以下信息:

Starting Nmap 6.40 ( http://nmap.org ) at 2014-06-06 08:56 CEST
Nmap scan report for h83-209-243-253.static.se.alltele.net (83.209.243.253)
Host is up (0.0072s latency).
Not shown: 996 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
389/tcp open  ldap
636/tcp open  ldapssl

但当我检查证书时

root@master:~# openssl s_client -connect daladevelop.se:636 -showcerts -state
CONNECTED(00000003)
SSL_connect:before/connect initialization
SSL_connect:unknown state
140244859233952:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 317 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

我感觉自己显然陷入了困境,完全不知道接下来该怎么做。如果能提供任何提示,告诉我该怎么做或者如何获得更好的调试日志,我将不胜感激。

编辑:这是我从 cn=config 截取的配置并且没有提及任何有关 TLS 的内容。

我已插入我的 certinfo.ldif:

root@master:~# cat certinfo.ldif 
dn: cn=config

add: olcTLSCACertificateFile
olcTLSCACertificateFile: /etc/ssl/certs/cacert.pem
-
add: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ssl/certs/daladevelop_slapd_cert.pem
-
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ssl/private/daladevelop_slapd_key.pem

当我这样做的时候,我只得到了这个答案。

root@master:~# sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f certinfo.ldif 
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "cn=config"

所以还是没有变得更明智。

答案1

答案2

TLS 似乎要求机器的本地主机名与证书中的名称相关联。对于 ldaps 来说,这似乎没有必要,如果在使用 ldap 服务器地址的域请求时返回证书,则很高兴。

由于罗杰的博客已经下线,我在这里发布了建议的解决方案,适用于使用自动更新 LetsEncrypt 证书的用户。

相关内容