使用多个证书绑定到 LDAP。在 ruby

Binding to LDAP with multiple certs. in ruby

我正在使用 https://github.com/ruby-ldap/ruby-net-ldap gem 到 connect/bind 到 LDAP

treebase = "ou=xxxxxx,dc=xxxxx,dc=xx"
credentials = {             
                :username => "myusername,ou=xxxxxx,dc=xxxxx,dc=xx",
                :password => "password"
}
encryption = {
                :method => :simple_tls,
                :tls_options => { :ca_path => "folder/Chain/pem_folder"}
}
# pem_folder = folder that contains multiple pem files

ldap = Net::LDAP.new :host => "hostname.example.com",
     :port => 636,
     :encryption => encryption,
     :base => treebase,
     :auth => credentials

ldap.bind

以上代码的结果是 ruby-2.2.2/gems/net-ldap-0.12.1/lib/net/ldap/connection.rb:47:in open_connection': SSL_connect returned=1 errno=0 state=error: certificate verify failed (Net::LDAP::Error)

我感觉它与多个证书有关但不确定。

对我有用的是

  1. 如果需要在网络上,请确保您已连接到 VPN
  2. 特别关注 instruction here 关于与 c_rehash

  3. 重新散列的部分
  4. 我的用户名也丢失了 uid= 之前导致绑定失败

  5. Whosebug also helped but I used Figaro Gem 而不是