use*_*145 5 ssl openldap ldap ssl-certificate
G'day,我配置了在端口 636 上运行的 openldap-server 机器。我也可以从另一台 openldap-client 机器 telnet 到这个端口。为了保护连接,我使用此链接在服务器上创建了一个自签名证书,在此处输入链接描述 ,然后将证书文件复制到客户端。
我已经确保在两台机器上都禁用了 SELinux,并且客户端 /etc/openldap/ldap.conf 文件具有选项 TLS_REQCERT allow
客户端机器的详细配置为:
# cat ldap.conf
URI ldap://ad.dfsi.dev:636
BASE dc=dfsi,dc=dev
TLS_CACERTDIR /etc/openldap/cacerts
TLS_REQCERT allow
Run Code Online (Sandbox Code Playgroud)
和 nslcd 文件:
# cat /etc/nslcd.conf
tls_reqcert allow
ssl start_tls
tls_cacertdir /etc/openldap/cacerts
tls_reqcert allow
Run Code Online (Sandbox Code Playgroud)
如果我不使用 SSL,则 ldap 客户端可以访问所有 ldap 用户。但是,当我通过 authconfig-tui、ldaps://ad.xx.dev:636 更改配置以使用 TLS 时,它会失败。
日志说客户端成功连接到服务器,但随后服务器断开连接,如下所示:
ldapsearch -x -d 1
ldap_create
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP ad.dfsi.dev:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying xx.xx.xx.xx:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_scanf fmt ({i) ber:
ber_flush2: 14 bytes to sd 3
ldap_result ld 0x7f8f75e1d150 msgid 1
wait4msg ld 0x7f8f75e1d150 msgid 1 (infinite timeout)
wait4msg continue ld 0x7f8f75e1d150 msgid 1 all 1
** ld 0x7f8f75e1d150 Connections:
* host: ad.dfsi.dev port: 636 (default)
refcnt: 2 status: Connected
last used: Tue Nov 29 15:01:28 2016
** ld 0x7f8f75e1d150 Outstanding Requests:
* msgid 1, origid 1, status InProgress
outstanding referrals 0, parent count 0
ld 0x7f8f75e1d150 request count 1 (abandoned 0)
** ld 0x7f8f75e1d150 Response Queue:
Empty
ld 0x7f8f75e1d150 response count 0
ldap_chkResponseList ld 0x7f8f75e1d150 msgid 1 all 1
ldap_chkResponseList returns ld 0x7f8f75e1d150 NULL
ldap_int_select
read1msg: ld 0x7f8f75e1d150 msgid 1 all 1
ber_get_next
ldap_err2string
ldap_result: Can't contact LDAP server (-1)
ldap_free_request (origid 1, msgid 1)
ldap_free_connection 1 1
ldap_free_connection: actually freed
Run Code Online (Sandbox Code Playgroud)
运行 openssl 显示客户端在服务器上找不到任何证书,这是不合理的,因为我在那里修复了所有内容:
# openssl s_client -showcerts -connect ad.dfsi.dev:636
CONNECTED(00000003)
140330386184096:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:184:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 247 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---
Run Code Online (Sandbox Code Playgroud)
nss-pam authconfg-tui 每次都会生成新的 CACERTDIR,它会覆盖之前的配置。因此,我也将证书文件放在了 /etc/openldap/cacerts 文件夹中。
我的客户端机器是 CentOS7,服务器是 Redhat ec2 实例。
谁能给我一些提示来解决这个问题?
STARTTLS表示“显式 TLS”,即在常规端口上建立连接,然后发送STARTTLS命令以启动SSL握手并切换到保护模式。
要连接尝试添加-Z或-ZZ切换到ldapsearch:
ldapsearch -x -d 1 -ZZ
Run Code Online (Sandbox Code Playgroud)
是让客户端使用starttls
恐怕 OpenSSL 现在不支持 LDAP 协议的 starttls(请参阅man s_client有关-starttls参数的手册页)
需要澄清的是:您是否在 OpenLDAP 服务器中配置了 TLS 使用?
您仍然需要设置一些参数。如需参考,请查看http://www.openldap.org/doc/admin24/tls.html#Server%20Configuration
据我了解,您的客户端连接到 LDAP 计算机,但 LDAP 计算机不知道将哪个证书传递给客户端。
您能验证还是证伪我的猜测吗?
| 归档时间: |
|
| 查看次数: |
38164 次 |
| 最近记录: |