Site icon

An ldapsearch(1) Quick-Reference for ACI Admins

For network guys configuring LDAP Authentication on the Cisco APIC Controller, it can be useful to query an LDAP server when configuring or troubleshooting LDAP Authentication. This page shows how ldapsearch(1) can be used to query a directory for information.

Basic Terms

If you do not have access to a directory server in your test environment, consider FreeIPA or OpenLDAP in your lab using a CentOS virtual machine.

Assumptions:

Query the LDAP server running at 10.18.188.184 anonymously:

ldapsearch -x -h 10.18.188.184

-x indicates simple authentication, even with anonymous queries.
-h references the host we wish to query.

Query with a Bind DN using assumptions above:

 ldapsearch -x -h 10.18.188.184 -D "uid=admin,cn=users,cn=accounts,dc=coastlab,dc=local" -w Password1

-D references the Bind DN of an account with permissions to query the directory. Usually a system account with non-expiring password for applications, or a user DN with appropriate a permissions
-w references the password for the

Note: FreeIPA permits anonymous queries by default, but does not show all attributes of objects unless authenticated.

Same, but prompt for password instead:

 ldapsearch -x -h 10.18.188.184 -D "uid=admin,cn=users,cn=accounts,dc=coastlab,dc=local" -W

Find a uid that equals “ldapy”:

ldapsearch -x -h 10.18.188.184 -D "uid=admin,cn=users,cn=accounts,dc=coastlab,dc=local" -W "uid=ldapy"

Find “uid=ldapy” within the container (Base DN) “cn=accounts,dc=coastlab,dc=local”:

ldapsearch -x -h 10.18.188.184 -D "uid=admin,cn=users,cn=accounts,dc=coastlab,dc=local" -W -b "dc=coastlab,dc=local" -b cn=accounts,dc=coastlab,dc=local "uid=ldapy"
Exit mobile version