On 6/9/11 2:48 AM, Graham Glass wrote:
> I can do a plain bind fine, but when I attempt to do a bind_as using
> Ruby LDAP using port 636, it throws a "no bind result" exception
> (shown below).
>
> Does anyone have any idea what's going on?
I think it tries to bind in plain text instead of over SSL.
This works for me on SSL:
ldap_args = {}
ldap_args[:host] = host
ldap_args[:base] = base_dn
ldap_args[:encryption] = :simple_tls
ldap_args[:port] = port
auth = {}
auth[:username] = bind_dn
auth[:password] = password
auth[:method] = :simple
ldap_args[:auth] = auth
ldap = Net::LDAP.new(ldap_args)
--
Regards, Lars Tobias
On 6/9/11 8:16 PM, Graham Glass wrote:
> I notice that you're setting "simple_tls", which is different from LDAP over SSL.
How is it different?
TLS is the successor of SSL(v2|v3), OpenLDAP supports it through
OpenSSL. You may also use the StartTLS protocol with Net::LDAP to
communicate securely with OpenLDAP on port 389. That will be {:method =>
:start_tls}.
If you leave ldap_args[:encryption] = nil, then
Net::LDAP::Connection#new will not try to use an encrypted connection,
but if it is other than nil, you may specify {:method => :simple_tls} or
{:method => :start_tls}. Net::LDAP does not automatically choose one or
the other based on the port you are using, so you'll have to specify it
if you want to use SSL/TLS.
http://en.wikipedia.org/wiki/Transport_Layer_Security#Simple_TLS_handshake
--
Regards, Lars Tobias