Is it possible to connect to eDirectory with python ldap3?

782 Views Asked by At

I am trying to connect to eDirectory using python. It is not as easy as connecting to active directory using python so I am wondering if this is even possible. I am currently running python3.4

1

There are 1 best solutions below

0
On BEST ANSWER

I'm the author of ldap3, I use eDirectory for testing the library.

just try the following code:

from ldap3 import Server, Connection, ALL, SUBTREE
server = Server('your_server_name', get_info=ALL)  # don't user get_info if you don't need info on the server and the schema
connection = Connection(server, 'your_user_name_dn', 'your_password')
connection.bind()
if connection.search('your_search_base','(objectClass=*)', SUBTREE, attributes = ['cn', 'objectClass', 'your_attribute'])
    for entry in connection.entries:
        print(entry.entry_get_dn())
        print(entry.cn, entry.objectClass, entry.your_attribute)
connection.unbind()

If you need a secure connection just change the server definition to:

server = Server('your_server_name', get_info=ALL, use_tls=True)  # default tls configuration on port 636

Also, any example in the docs at https://ldap3.readthedocs.org/en/latest/quicktour.html should work with eDirectory.

Bye, Giovanni