AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 809177
Accepted
Reapbooster
Reapbooster
Asked: 2016-10-15 17:46:49 +0800 CST2016-10-15 17:46:49 +0800 CST 2016-10-15 17:46:49 +0800 CST

LDAPS 握手失败 errno 21 是目录 - 遇到文件结尾

  • 772

我已经设置了一个CentOS 7 openLDAP passthrough 身份验证服务器。

它将通过 LDAP 在 Microsoft Active Directory 上托管的数据库上对用户进行身份验证。

如果我使用 LDAP://,我可以获得成功的查询响应

但是,LDAPS:// 会给出证书握手错误。

我正在使用从 GoDaddy 购买的 PFX 格式的证书。

我找到了一些可能的解决方案,但到目前为止没有任何效果。

我努力了:

  1. 禁用 SELinux 进行测试
  2. 将 PFX 证书转换为 PEM 和 DER
  3. 使用此处解释的 certutil 来制作 MozNSS DB: http ://www.openldap.org/faq/data/cache/1514.html

    pk12util -d /path/to/certdb -i /path/to/file.p12

我找到了这个页面https://stackoverflow.com/questions/13732826/convert-pem-to-crt-and-key 但我不知道使用什么命令来获取 openLDAP 的正确格式证书。

我试过这些:

openssl x509 -outform der -in certificate.pem -out certificate.der
openssl x509 -outform der -in certificate.pem -out certificate.crt

当我运行 ldapsearch 时:

ldapsearch -H ldaps://192.168.1.69 -b "OU=Administration,DC=domain,DC=com" -v -LLL -D "CN=ServiceLDAP,OU=Administration,DC=domain,DC=com" "(samaccountname=someuser)" -w secretpass -d1

这些是我得到的错误:

ldap_url_parse_ext(ldaps://192.168.1.32)
ldap_initialize( ldaps://192.168.1.32:636/??base )
ldap_create
ldap_url_parse_ext(ldaps://192.168.1.32:636/??base)
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP 192.168.1.32:636
ldap_new_socket: 4
ldap_prepare_socket: 4
ldap_connect_to_host: Trying 192.168.1.32:636
ldap_pvt_connect: fd: 4 tm: -1 async: 0
attempting to connect:
connect success
TLS: certdb config: configDir='/etc/openldap/certs' tokenDescription='ldap(0)' certPrefix='' keyPrefix='' flags=readOnly
TLS: using moznss security dir /etc/openldap/certs prefix .
TLS: error: tlsm_PR_Recv returned 0 - error 21:Is a directory
TLS: error: connect - force handshake failure: errno 21 - 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)
centos openldap tls
  • 1 1 个回答
  • 1842 Views

1 个回答

  • Voted
  1. Best Answer
    Reapbooster
    2016-10-19T09:25:30+08:002016-10-19T09:25:30+08:00

    我能够解决这个问题。

    证书和密钥的正确格式:

    openssl pkcs12 -in ./ACertFromGoDaddy.pfx -nocerts -out privatekey.pem -nodes
    openssl pkcs12 -in ./ACertFromGoDaddy.pfx -nokeys -out publiccert.pem -nodes
    

    我将这些证书放在 ./openldap/certs 中,我可以通过制作一个 ldif 文件并使用 slapadd 加载它来配置 slapd 以从那里读取它们:

    slapadd -n0 -F /etc/openldap/slapd.d/ -l ./mod_ssl.ldif

    我的 mod_ssl.ldif 文件的内容是:

    dn: cn=config
    changetype: modify
    add: olcTLSCACertificateFile
    olcTLSCACertificateFile: /etc/openldap/certs/publiccert.pem
    -
    add: olcTLSCertificateFile
    olcTLSCertificateFile: /etc/openldap/certs/publiccert.pem
    -
    add: olcTLSCertificateKeyFile
    olcTLSCertificateKeyFile: /etc/openldap/certs/privatekey.pem
    

    然后我能够在本地和远程执行 ldap 搜索:

    ldapsearch -H ldaps://192.168.1.69 -b "OU=Administration,DC=domain,DC=com" -v -LLL -D "CN=ServiceLDAP,OU=Administration,DC=domain,DC=com" "(samaccountname=someuser)" -w secretpass -d1
    
    • 0

相关问题

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 使用 crontab 和 /etc/cron.hourly,daily,weekly 的区别

  • 持续监控许多服务器运行状况的简单方法?

  • Hudson 无法在 tomcat5 中启动

  • CentOS 的依赖挑战

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve