# Ruby net ldap bind issue

**URL:** <https://www.ruby-forum.com/t/ruby-net-ldap-bind-issue/171132>\
**Category:** Ruby\
**Created:** [June 26, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/ruby-net-ldap-bind-issue/171132 "2009-06-26T21:15:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asif\_Iqbal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c0e974/32.png) [@Asif\_Iqbal](https://www.ruby-forum.com/u/Asif_Iqbal)\
**Post date:** [June 26, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/ruby-net-ldap-bind-issue/171132/1 "2009-06-26T21:15:12Z")

</div>

$ 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

---

<div class="post-metadata">

**Author:** ![Asif\_Iqbal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c0e974/32.png) [@Asif\_Iqbal](https://www.ruby-forum.com/u/Asif_Iqbal)\
**Post date:** [June 29, 2009, 6:59pm UTC](https://www.ruby-forum.com/t/ruby-net-ldap-bind-issue/171132/2 "2009-06-29T18:59:52Z")

</div>

still need help with the ldaps
