Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are CN, OU, DC in an LDAP search?

I have a search query in LDAP like this. What exactly does this query mean?

("CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com"); 
like image 557
Ritesh Chandora Avatar asked Sep 12 '13 06:09

Ritesh Chandora


People also ask

What is OU DC cn in LDAP?

The moniker "ou" means organizational unit. The component "cn=Test2" is an object whose Common Name is "Test2". The moniker "cn" means Common Name. Similarly, the moniker "dc" means domain component. The component "dc=MyDomain" is a domain component with the name "MyDomain".

What is cn in LDAP query?

CN (CommonName in X. 500) AttributeType contains names of an LDAP Entry. Each name is one value of this multi-valued attribute. If the object corresponds to a person, it is typically the person's full name.

What is the DC in LDAP?

Domain Component (DC). DC objects represent the top of an LDAP tree that uses DNS to define its namespace. Active Directory is an example of such an LDAP tree. The designator for an Active Directory domain with the DNS name Company.com would be dc=Company,dc=com.

What is cn and OU in AD?

Each class of object in AD has one attribute that is the Relative Distinguished Name (RDN) of the object. This is the name of the object in it's parent OU/Container. For user, group, computer, and container objects, the RDN is the value of the cn attribute (the Common Name).


2 Answers

  • CN = Common Name
  • OU = Organizational Unit
  • DC = Domain Component

These are all parts of the X.500 Directory Specification, which defines nodes in a LDAP directory.

You can also read up on LDAP data Interchange Format (LDIF), which is an alternate format.

You read it from right to left, the right-most component is the root of the tree, and the left most component is the node (or leaf) you want to reach.

Each = pair is a search criteria.

With your example query

("CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com"); 

In effect the query is:

From the com Domain Component, find the google Domain Component, and then inside it the gl Domain Component and then inside it the gp Domain Component.

In the gp Domain Component, find the Organizational Unit called Distribution Groups and then find the object that has a common name of Dev-India.

like image 198
Burhan Khalid Avatar answered Sep 30 '22 23:09

Burhan Khalid


What are CN, OU, DC?

From RFC2253 (UTF-8 String Representation of Distinguished Names):

String  X.500 AttributeType 
------------------------------ CN      commonName L       localityName ST      stateOrProvinceName O       organizationName OU      organizationalUnitName C       countryName STREET  streetAddress DC      domainComponent UID     userid 

**What does the string from that query mean?**

The string ("CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com") is a path from an hierarchical structure (DIT = Directory Information Tree) and should be read from right (root) to left (leaf).

It is a DN (Distinguished Name) (a series of comma-separated key/value pairs used to identify entries uniquely in the directory hierarchy). The DN is actually the entry's fully qualified name.

Here you can see an example where I added some more possible entries.
The actual path is represented using green.

LDAP tree

The following paths represent DNs (and their value depends on what you want to get after the query is run):

  • "DC=gp,DC=gl,DC=google,DC=com"
  • "OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com"
  • "OU=People,DC=gp,DC=gl,DC=google,DC=com"
  • "OU=Groups,DC=gp,DC=gl,DC=google,DC=com"
  • "CN=QA-Romania,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com"
  • "CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com"
  • "CN=Diana Anton,OU=People,DC=gp,DC=gl,DC=google,DC=com"
like image 34
ROMANIA_engineer Avatar answered Sep 30 '22 21:09

ROMANIA_engineer