# Problems with SSL LDAP connection on Windows

**URL:** <https://www.ruby-forum.com/t/problems-with-ssl-ldap-connection-on-windows/113969>\
**Category:** Ruby\
**Created:** [September 6, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/problems-with-ssl-ldap-connection-on-windows/113969 "2007-09-06T19:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [September 6, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/problems-with-ssl-ldap-connection-on-windows/113969/1 "2007-09-06T19:11:44Z")

</div>

I’m trying to make an Net::LDAP connection over SSL to Active Directory  
so  
that I can change/set account passwords. I was originally using adsi  
via  
Win32OLE but that is unbearably slow. When I try to connect on port 636  
with encryption set to :simple\_tls

This is what happens:

OpenSSL::SSL::SSLError:  
from  
C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1059:in  
‘connect’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1059:in  
‘setup\_encryption’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1025:in  
‘initialize’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:700:in  
‘new’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:700:in  
‘bind’

It would appear to be a problem with OpenSSL. This is running on  
Windows  
(no choice there), I have OpenSSL installed on the machine but beyond  
that  
I’m not sure what’s going on.

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [September 6, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/problems-with-ssl-ldap-connection-on-windows/113969/2 "2007-09-06T19:33:48Z")

</div>

Here is the code I used to create said problem:

ldap = Net::LDAP.new

ldap.host = ‘hostname’  
ldap.port = 636  
ldap.encryption :simple\_tls  
ldap.auth “username”,“password”  
ldap.bind

On 9/6/07, Glen H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /lib/net/ldap.rb:1059:in  
> from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4  
> so loud, I can’t hear a word you’re saying."
> 
> -Greg Graffin (Bad Religion)

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [September 6, 2007, 9:11pm UTC](https://www.ruby-forum.com/t/problems-with-ssl-ldap-connection-on-windows/113969/3 "2007-09-06T21:11:03Z")

</div>

Let’s change the focus of my inquiry.

When I do the following:

connection = TCPSocket.new(“hostname”, 636)  
context = OpenSSL::SSL::SSLContext.new  
connection = OpenSSL::SSL::SSLSocket.new(connection, context)  
connection.connect

I get OpenSSL::SSL::SSLError: in ‘connect’. No more details just the  
SSL  
error. Should the SSL library give useful error messages, in other  
words  
could something else be breaking and SSL isn’t passing the error message  
all  
the way back out?

On 9/6/07, Glen H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4
> > 
> > ```
> > 
> > I’m not sure what’s going on.
> 
> –  
> “Hey brother Christian with your high and mighty errand, Your actions  
> speak  
> so loud, I can’t hear a word you’re saying.”
> 
> -Greg Graffin (Bad Religion)

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)
