0

我正在使用https://github.com/ruby-ldap/ruby-net-ldap gem 连接/绑定到 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)

我觉得这与多个证书有关,但不确定。

4

1 回答 1

0

对我有用的是

  1. 如果需要在网络上,请确保您已连接到 VPN
  2. 请按照此处的说明进行操作,特别是有关重新散列的部分c_rehash

  3. 我的用户名之前也丢失uid=了导致绑定失败

  4. Stackoverflow也有帮助,但我改用Figaro Gem
于 2015-11-20T22:03:12.903 回答