作者 主題: openldap tls 無法使用  (閱讀 6986 次)

0 會員 與 1 訪客 正在閱讀本文。

Yanny

  • 憂鬱的高中生
  • ***
  • 文章數: 177
    • 檢視個人資料
openldap tls 無法使用
« 於: 2015-07-29 12:05 »
各位學長,小弟有一個openldap over tls的問題想請教,我的系統是centos 6.6

我在設定檔slapd.conf 上設定了tls憑證,然後slaptest -f slapd.conf -F /etc/openldap/slapd.d轉成openldap設定檔
TLSCACertificateFile /etc/openldap/certs/ca.crt
TLSCertificateFile /etc/openldap/certs/server.crt
TLSCertificateKeyFile /etc/openldap/certs/server.key
TLSVerifyClient never
假如不走TLS加密,Client是可以正常連線和查詢,但走TLS加密,client會回報說找不到伺服器
我用ldapsearch -H ldaps://192.168.22.218:636 -D "uid=root,cn=users,dc=yanny-test,dc=com" -w1234567 -d7,他會回報以下錯誤

TLS: error: tlsm_PR_Recv returned 0 - error 2:No such file or directory
TLS: error: connect - force handshake failure: errno 2 - 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)
搜尋Google都找不到問題點,想請教問各位學長有沒有遇到類似的問題,謝謝.

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: openldap tls 無法使用
« 回覆 #1 於: 2015-07-29 13:36 »
如果您有用CA去簽署, 確定雙方用的cacert.pem是相同的。
要不,把server的public key來檔cacert也行...

前不久玩過:
http://phorum.study-area.org/index.php/topic,70824.msg341961.html#msg341961
« 上次編輯: 2015-07-29 13:38 由 netman »

Yanny

  • 憂鬱的高中生
  • ***
  • 文章數: 177
    • 檢視個人資料
Re: openldap tls 無法使用
« 回覆 #2 於: 2015-07-29 14:22 »
竟然能讓netman來回答這問題,這是太感謝了.

請問一下,我在ldap server上面也需要設定/etc/ldap.conf嗎?假如不設定會造成什麼問題嗎?謝謝.

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: openldap tls 無法使用
« 回覆 #3 於: 2015-07-29 14:41 »
如果你的server本身也要查ldap就要,例如跑ldapxxxx這類命令,如果只是單純跑slapxxxx就不需要。

Yanny

  • 憂鬱的高中生
  • ***
  • 文章數: 177
    • 檢視個人資料
Re: openldap tls 無法使用
« 回覆 #4 於: 2015-07-29 15:09 »
謝謝netman的幫助,我問題已經排除了.

我以為TLS設定是在/etc/openldap/slapd.d/cn=config.ldif,結果是/etc/openldap/slapd.d/cn=config/olcDatabase={0}config.ldif

再次謝謝netman,果然還是要把酷學員的LDAP文章重新學習一次,謝謝.