2015-11-16 47 views
0

我使用https://github.com/ruby-ldap/ruby-net-ldap寶石綁定連接/到LDAP綁定到具有多個證書的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)

我有一種感覺它是與多個證書,但不知道。

回答

0

什麼工作對我來說是

  1. 請確保您連接到VPN,如果需要在網絡上
  2. 遵循有關與c_rehash

  3. 我的用戶名換湯不換藥的instruction here專門的部分也失蹤uid=之前導致失敗綁定

  4. Stackoverflow也幫助但我用Figaro Gem代替