problems using ruby-ldap to connect with windows AD

Discussion in 'Ruby' started by kang cao, Apr 14, 2011.

  1. kang cao

    kang cao Guest

    hi:
    I am using ruby-ldap to connect with windows AD. but when I bind,it
    alway gives me "Cann't contact LDAP Server". my code is:
    require 'rubygems'
    require 'ldap'
    begin
    ldap_host = '172.17.20.191'
    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 = "cn=altirisadmin,ou=Golden-Altiris,dc=autonavi,dc=com"
    password_dn = "Altirisadmin"
    ldap_conn.bind(bind_dn,password_dn){ ldap_conn.perror("bind")}
    puts "trace 4 ldap_conn: #{ldap_conn.class}"
    rescue
    puts "trace 5 oops, #{$!}"
    end

    I have alreay tried ldapsearch. it does work but ruby-ldap doesn't.
    my system is centos 5.4 x64. ruby is "ruby 1.8.7 (2011-02-18 patchlevel
    334) [x86_64-linux]". openldap was installed by yum and the version is
    0.9.11.
    I also tried to install openldap by downloadng source code and
    compilering them. but it still gives me same answer.

    --
    Posted via http://www.ruby-forum.com/.
    kang cao, Apr 14, 2011
    #1
    1. Advertising

  2. kang cao

    kang cao Guest

    I have figured out the problem. MY windows AD is listening on 389, not
    on 636.
    ldapsearch command works only when I don't put -p in the command line.
    sorry to bother you all

    --
    Posted via http://www.ruby-forum.com/.
    kang cao, Apr 14, 2011
    #2
    1. Advertising

  3. kang cao

    Nick Klauer Guest

    [Note: parts of this message were removed to make it a legal post.]

    Is 636 a standard for OpenLDAP? I'm so used to AD that I didn't think that
    it would be anything else...


    -Nick Klauer


    On Thu, Apr 14, 2011 at 09:53, kang cao <> wrote:

    > I have figured out the problem. MY windows AD is listening on 389, not
    > on 636.
    > ldapsearch command works only when I don't put -p in the command line.
    > sorry to bother you all
    >
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
    Nick Klauer, Apr 14, 2011
    #3
  4. On Thu, Apr 14, 2011 at 8:20 PM, Nick Klauer <> wrote:
    > Is 636 a standard for OpenLDAP? =A0I'm so used to AD that I didn't think =

    that
    > it would be anything else...


    According to IANA <http://www.iana.org/assignments/port-numbers>:

    ldaps 636/tcp ldap protocol over TLS/SSL (was sldap)
    ldaps 636/udp ldap protocol over TLS/SSL (was sldap)

    --=20
    Phillip Gawlowski

    Though the folk I have met,
    (Ah, how soon!) they forget
    When I've moved on to some other place,
    There may be one or two,
    When I've played and passed through,
    Who'll remember my song or my face.
    Phillip Gawlowski, Apr 14, 2011
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Wold

    using LDAP Controls in ruby-ldap

    Jason Wold, Nov 4, 2004, in forum: Ruby
    Replies:
    5
    Views:
    240
  2. Ian Macdonald
    Replies:
    0
    Views:
    215
    Ian Macdonald
    Mar 15, 2005
  3. James Hughes
    Replies:
    4
    Views:
    324
    James Hughes
    Dec 13, 2005
  4. Replies:
    1
    Views:
    203
    Austin Ziegler
    Oct 11, 2006
  5. dacat

    Net::LDAP vs ruby/ldap

    dacat, Apr 27, 2007, in forum: Ruby
    Replies:
    3
    Views:
    294
    Ian Macdonald
    May 18, 2007
Loading...

Share This Page