# Ruby LDAP SSL thingy won't go

**URL:** <https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134>\
**Category:** Ruby\
**Created:** [May 29, 2009, 11:13pm UTC](https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134 "2009-05-29T23:13:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [May 29, 2009, 11:13pm UTC](https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134/1 "2009-05-29T23:13:34Z")

</div>

#!/usr/bin/ruby

# 

require ‘ldap’

begin  
ldap\_host = ‘[corp.com](http://corp.com)’  
ldap\_port = 636  
ldap\_conn = LDAP::SSLConn.new(ldap\_host,ldap\_port)  
puts “trace 2 ldap\_conn: #{ldap\_conn.class}”  
ldap\_conn.set\_option( LDAP::LDAP\_OPT\_PROTOCOL\_VERSION, 3 )  
puts “trace 3 ldap\_conn: #{ldap\_conn.class}”  
bind\_dn =  
“uid=#{ARGV[0]},ou=People,ou=Corporate,dc=real,dc=com”  
password\_dn = “#{ARGV[1]}”  
ldap\_conn.bind(bind\_dn,password\_dn)  
puts “trace 4 ldap\_conn: #{ldap\_conn.class}”  
rescue  
puts “trace 5 oops, #{$!}”  
end

# end of test

I have a coworker who got this to work on his server, but on my Ubuntu  
Servers  
it won’t go. We seem to have the configurations all correct. Is there  
a  
special configuration aspect or activity needed on Ubuntu servers for  
things  
like this? Changing the port to 389 and the SSLConn to Conn makes it go  
fine  
too, if that is any kind of a hint. Here is what the failures look  
like:  
$ ./t7.rb un ‘pw’  
trace 2 ldap\_conn: LDAP::SSLConn  
trace 3 ldap\_conn: LDAP::SSLConn  
trace 5 oops, Can’t contact LDAP server  
$ ./t4.rb un ‘pw’  
trace 2 ldap\_conn: LDAP::Conn  
trace 3 ldap\_conn: LDAP::Conn  
trace 4 ldap\_conn: LDAP::Conn  
$  
----snip—  
where t4 is with just Conn/389 and t7 is with SSLConn and 636 as in my  
code  
above. Again, a coworker go the t7.rb running just like the t4 on his  
server,  
but mine don’t take. We cannot find the config problem and the  
/etc/ldap  
directories seem to coincide for things that seem important.

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [May 30, 2009, 1:50am UTC](https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134/2 "2009-05-30T01:50:22Z")

</div>

Xeno C. wrote:

I just filed this bug in regard to my question:

> **[Bug #381791 " LDAP::SSLConn from ruby fails, probably from not s... : Bugs :...](https://bugs.launchpad.net/ubuntu/+source/libldap-ruby/+bug/381791)**
>
> I am unable to execute a simple script to authenticate users using LDAP::SSLConn in Ruby. The following two scripts and output explain the situation:
> 
> I have the following working with cleartext LDAP:
> 
> \#!/usr/bin/ruby
> \#
> 
> require 'ldap'
> 
> begin
> ...

I am very anxious to get this figured out, otherwise we may be forced to  
use  
CentOS for this service rather than Ubuntu Server.

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [May 30, 2009, 9:55am UTC](https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134/3 "2009-05-30T09:55:09Z")

</div>

You asked the same question once before at  
[http://www.ruby-forum.com/topic/187912](http://www.ruby-forum.com/topic/187912)

I gave you some suggestions to try to narrow down the problem. You  
either ignored them, or didn’t bother to post the results which would  
have helped identify the problem.

However you didn’t say before that you were running Ubuntu. If you are  
using the stock Ubuntu ruby package, did you remember to install the  
libopenssl-ruby package? (Ubuntu breaks out this part of Ruby into a  
separate package)

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 1, 2009, 6:26am UTC](https://www.ruby-forum.com/t/ruby-ldap-ssl-thingy-wont-go/169134/4 "2009-06-01T06:26:22Z")

</div>

Brian C. wrote:

> separate package)  
> Thank you Brian. I am at home now. I will try this first thing  
> tomorrow  
> morning. I’m sorry I didn’t see it before. Perhaps that’s all it is.
