$ cat ldap2.rb
require ‘rubygems’
require ‘net/ldap’
ldap = Net::LDAP.new :host => “10.1.5.7”,
:port => 1636,
:auth => {
:method => :simple_tls,
:username =>
“uid=sysldapq,ou=People,dc=mnet,dc=example,dc=com”,
:password => “June2008”
}
filter = Net::LDAP::Filter.eq( “uid”, “iqbala*” )
treebase = “ou=People,dc=mnet,dc=example,dc=com”
ldap.search( :base => treebase, :filter => filter ) do |entry|
puts “DN: #{entry.dn}”
entry.each do |attribute, values|
puts " #{attribute}:"
values.each do |value|
puts " —>#{value}"
end
end
end
p ldap.get_operation_result
This is failing
$ ruby ldap2.rb
/var/lib/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1097:in
bind': invalid binding information (Net::LDAP::LdapError) from /var/lib/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:639:in
search’
from ldap2.rb:15
However this works!
$ ldapsearch -LLL -x -y .ldap-pass uid=username
$ cat .ldaprc
BINDDN uid=sysldapq,ou=people,dc=mnet,dc=example,dc=com
$ cat /etc/ldap/ldap.conf
LDAP Defaults
See ldap.conf(5) for details
This file should be world readable but not world writable.
BASE ou=People,dc=mnet,dc=example,dc=com
URI ldaps://10.1.5.7:1636 ldaps://10.6.18.247:1636
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
TLS_CACERT /etc/ssl/certs/exampleca.cer
TLS_REQCERT never
Any help would be appreciated