Net-ldap and OpenSSL

I am having trouble making an SSL connection to an LDAP server. After
setting my object to use simple_tls I get the following error when
trying to
connect to port 636 on the LDAP (AD) server:

OpenSSL::SSL::SSLError

Nothing more useful than that. I get a brief stack trace but it isn’t
all
that useful either.


“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)

I am having trouble making an SSL connection to an LDAP server.

This works for me (from linux to AD server):

  @con = Net::LDAP.new(:host => ldap_server,
                      :port => 636,
                      :base => base_dn,
                      :encryption => :simple_tls)

Hope this helped,

Vlad

Attempting this by hand yields the same results, which makes me think it
isn’t necessarily a problem with net/ldap.

I get the same useless error when attempting the connection by hand:

@sslcon = TCPsocket.new(“datadc1”, 636)
@context = OpenSSL::SSL::SSLContext.new
@context.verify_mode = OpenSSL::SSL::VERIFY_NONE
@sslcon = OpenSSL::SSL::SSLSocket.new(@sslcon, @context)
@sslcon.connect

then I get OpenSSL::SSL::SSLError

On Mon, Mar 3, 2008 at 9:41 AM, Glen H. [email protected]
wrote:


“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)

I get the same useless error when attempting the connection by hand:

Wild guess, it is possible that it is trying (and failing) to validate
SSL certificate…

Vlad

Thanks again Vlad. I think I figured it out late last night. There is
something strange about SSL on port 636 on that machine. When
connecting to
another domain controller (different domain) on the SSL port it works
fine.

An actual error message would be completely awesome though.

On Tue, Mar 4, 2008 at 7:04 AM, Vladimir K. [email protected]
wrote:

I get the same useless error when attempting the connection by hand:

Wild guess, it is possible that it is trying (and failing) to validate
SSL certificate…

Vlad


“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)

Thanks for the response Vlad. However I still get the
OpenSSL::SSL::SSLError. I’m getting the feeling that the OpenSSL
library
doesn’t work right in Windows. I’m also having trouble finding good
documentation for the module that is written in English.

On Mon, Mar 3, 2008 at 10:24 AM, Vladimir K. [email protected]
wrote:

Vlad


“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)

Vladimir K. wrote in post #641046:

I am having trouble making an SSL connection to an LDAP server.

This works for me (from linux to AD server):

  @con = Net::LDAP.new(:host => ldap_server,
                      :port => 636,
                      :base => base_dn,
                      :encryption => :simple_tls)

Hope this helped,

Vlad

Ok…So, we don’t have to write

ldap2 = Net::LDAPS.new(:host => “ldaps://<ldap_server_name>”, :port =>
636, :base => base_dn, :encryption => :simple_tls)