How do I list root DN's using python ldap?

Wayne Werner

I am using python3-ldap which connects to an LDAP just fine. However, I'm not sure and can't find any documentation to list all the root DNs.

Is there a command on the Server or Connection or anywhere that will let me list the DNs?

cannatag

You must perform a search using an empty value for the base and then specifying in the filter the class of objects you want get back (or * if you want all). You should use a single level scope to get only the first-level object in the ldap tree.

For example:

from ldap3 import Server, Connection, SEARCH_SCOPE_SINGLE_LEVEL

    s = Server('your_server')
    c = connection(s, user='your_user_dn', password='your_password', auto_bind=True)
    c.search('', '(objectClass=*)', search_scope=SEARCH_SCOPE_SINGLE_LEVEL)
    print(c.response)

you should get all the objects in the first level of the tree, if you want you can specify a filter with the object classes you need:

    c.search('', '(!(objectClass=organization)(objectClass=organizationalUnit))', search_scope=SEARCH_SCOPE_SINGLE_LEVEL)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I find an LDAP user's DN in JSP?

From Dev

How do I force Python LDAP to validate/verify an SSL certificate when using .start_tls_s()

From Dev

How do you filter on an LDAP attribute that uses the dn syntax using the ColdFusion CFLDAP tag?

From Dev

How do I make one list from multiple columns using Python's Pandas?

From Dev

How do I make one list from multiple columns using Python's Pandas?

From Dev

Matching substring within LDAP DN using Awk

From Dev

Java LDAP get Group DN by using CN

From Dev

How do I define root for tkinter in Python 3? I'm using an online Python editor

From Java

How do I print the list of files and folders in a root directory in linux using java

From Dev

How do I print the list of files and folders in a root directory in linux using java

From Dev

How do I get the SSL certificate for an LDAP server using StartTLS?

From Dev

How do I run a ldap query using R?

From Dev

How do I modify a Boolean LDAP Active Directory attribute using Net::LDAP?

From Dev

How do I delete specific attributes in LDAP using ldap-utils command-line?

From Dev

How do I delete specific attributes in LDAP using ldap-utils command-line?

From Dev

How do I show a list of processes for the current user using python?

From Dev

Using Python, how do I add only distinct messages to a list?

From Dev

How do I declare list in python using for loop in one line?

From Dev

how do I redraw an image using python's matplotlib?

From Dev

UnboundID LDAP Java SDK - need to list descendants of a given parent DN

From Dev

UnboundID LDAP Java SDK - need to list descendants of a given parent DN

From Dev

How do I search for a string in an list, using a tokenized list as the query's base?

From Java

How do I expand the root's volume size?

From Dev

How do I reset mysql's root password?

From Dev

Using "pub serve", how do I serve a root resource?

From Dev

How do I run GUI applications as root by using pkexec?

From Dev

Is LDAP DN case insensitive?

From Dev

how do I choose specific items from a list using python and save in a new list

From Dev

how do i create list of list permutation with n elements using recursive function? | python

Related Related

  1. 1

    How can I find an LDAP user's DN in JSP?

  2. 2

    How do I force Python LDAP to validate/verify an SSL certificate when using .start_tls_s()

  3. 3

    How do you filter on an LDAP attribute that uses the dn syntax using the ColdFusion CFLDAP tag?

  4. 4

    How do I make one list from multiple columns using Python's Pandas?

  5. 5

    How do I make one list from multiple columns using Python's Pandas?

  6. 6

    Matching substring within LDAP DN using Awk

  7. 7

    Java LDAP get Group DN by using CN

  8. 8

    How do I define root for tkinter in Python 3? I'm using an online Python editor

  9. 9

    How do I print the list of files and folders in a root directory in linux using java

  10. 10

    How do I print the list of files and folders in a root directory in linux using java

  11. 11

    How do I get the SSL certificate for an LDAP server using StartTLS?

  12. 12

    How do I run a ldap query using R?

  13. 13

    How do I modify a Boolean LDAP Active Directory attribute using Net::LDAP?

  14. 14

    How do I delete specific attributes in LDAP using ldap-utils command-line?

  15. 15

    How do I delete specific attributes in LDAP using ldap-utils command-line?

  16. 16

    How do I show a list of processes for the current user using python?

  17. 17

    Using Python, how do I add only distinct messages to a list?

  18. 18

    How do I declare list in python using for loop in one line?

  19. 19

    how do I redraw an image using python's matplotlib?

  20. 20

    UnboundID LDAP Java SDK - need to list descendants of a given parent DN

  21. 21

    UnboundID LDAP Java SDK - need to list descendants of a given parent DN

  22. 22

    How do I search for a string in an list, using a tokenized list as the query's base?

  23. 23

    How do I expand the root's volume size?

  24. 24

    How do I reset mysql's root password?

  25. 25

    Using "pub serve", how do I serve a root resource?

  26. 26

    How do I run GUI applications as root by using pkexec?

  27. 27

    Is LDAP DN case insensitive?

  28. 28

    how do I choose specific items from a list using python and save in a new list

  29. 29

    how do i create list of list permutation with n elements using recursive function? | python

HotTag

Archive