Skip to content

Interview PrepDirectories · Core

Active Directory and LDAP ​

131. What is Microsoft Active Directory, and what problem does it solve? ​

The short answer

Active Directory, AD, launched with Windows 2000, is Microsoft's directory service for company networks. It keeps one central database of users, groups, computers and policies for an organisation, called a domain, and runs on servers called domain controllers. It solves the problem of managing thousands of people and machines one by one: an employee gets one account that logs in to any company PC, file share, printer and internal app, admins push settings to every machine through Group Policy, and disabling one account cuts off access everywhere on the network.

What AD bundles together:

PartJob
Directory databaseUsers, groups, computers, organisational units
LDAPThe protocol to query and change the directory
KerberosLogging in and SSO inside the network (the Kerberos question)
DNSHow machines find domain controllers
Group PolicyPushing settings and security rules to every Windows machine
ReplicationKeeping every domain controller's copy in sync

Where it still matters. Most large companies still run AD for Windows PCs, file servers and older internal apps, usually connected to Microsoft Entra ID in the cloud. Attackers also target it heavily, because whoever controls AD controls the whole network.

132. What is LDAP, and what problem does it solve? ​

The short answer

LDAP, the Lightweight Directory Access Protocol, is an open, vendor-neutral protocol for reading and updating a directory: a database of people, groups and devices organised as a tree, built for many fast reads and few writes. It solves the problem of every application keeping its own user list: apps ask the central directory "does this user exist, what are their groups, is this their password?" over LDAP. It runs on TCP port 389, or 636 for LDAPS over TLS. Active Directory, OpenLDAP and many other directories speak it.

FactValue
What it isA protocol, not a product
Port389, with StartTLS; 636 for LDAPS
Data shapeA tree of entries, each with attributes
Main operationsBind, search, compare, add, modify, delete
Common serversActive Directory, OpenLDAP, FreeIPA, 389 Directory Server

Always encrypt it. A plain LDAP bind sends the password across the network in clear text. Use LDAPS or StartTLS, and on Active Directory require LDAP signing and channel binding.

133. What is a directory service? ​

The short answer

A directory service is a specialised database that stores information about an organisation's people, groups, devices and resources, and answers questions about them quickly. It is like a phone book that systems consult: "who is asha?", "which groups is she in?", "where is the printer on floor 3?". It is tuned for many reads and few writes, organised as a hierarchy, replicated across servers for availability, and access-controlled. Active Directory, OpenLDAP and Microsoft Entra ID are directory services.

DirectoryGeneral database
Optimised forFast lookups, few changesMixed reads and writes
ShapeA tree of entriesTables or documents
Typical dataPeople, groups, devices, policiesOrders, payments, anything
SchemaShared, standard object typesDesigned per application
TransactionsLimitedFull

134. Explain LDAP architecture? ​

The short answer

LDAP uses a client-server model. Clients, such as apps, servers or login systems, open a TCP connection to a directory server and send operations: bind to authenticate, search, compare, add, modify, delete. The data is a tree called the Directory Information Tree. Each node is an entry, named by a distinguished name, holding attributes such as cn, mail and memberOf, and belonging to object classes such as user or group that the schema defines. Big directories split the tree across servers and replicate it for availability.

dc=acme,dc=exampleou=Peopleou=Groupscn=Asha Raomail: asha@acme.exampletitle: AccountantmemberOf: cn=finance,ou=Groups,…cn=finance
A tree of entries, each with attributes. The domain is the root. Organisational units group entries. Each leaf, such as Asha, holds attributes. Her group membership points to another entry in the tree.
TermMeaningExample
EntryOne node: a person, group or deviceAsha's account
AttributeA named value on an entrymail, title, memberOf
Object classThe type, which decides allowed attributesuser, group, computer
SchemaAll object classes and attribute definitionsShipped with the server, extendable
DITThe whole treeEverything under dc=acme,dc=example

135. What is a Distinguished Name (DN)? ​

The short answer

A distinguished name is the full, unique path of an entry in the LDAP tree, written from the entry itself up to the root, as comma-separated pieces. Asha's DN might be cn=Asha Rao,ou=People,dc=acme,dc=example: common name "Asha Rao", in the organisational unit "People", in the domain acme.example. Like a full postal address, no two entries have the same DN. It changes if the entry is renamed or moved, so applications should store a stable ID such as AD's objectGUID rather than the DN.

Reading a DN right to left, from the root:

PieceTypeMeaning
dc=exampleDomain componentTop-level domain
dc=acmeDomain componentTogether: acme.example
ou=PeopleOrganisational unitA folder in the tree
cn=Asha RaoCommon nameThe entry itself

Escaping matters. A comma inside a name, as in cn=Rao\, Asha, must be escaped, or it splits the DN in the wrong place. Use your LDAP library's DN functions, never string concatenation.

136. What is a Relative Distinguished Name (RDN)? ​

The short answer

The RDN is the first piece of a DN: the entry's own name, relative to its parent. In cn=Asha Rao,ou=People,dc=acme,dc=example, the RDN is cn=Asha Rao. It must be unique among siblings under the same parent, like a file name in a folder, but the same RDN can exist under different parents. The DN is the RDN plus the parent's DN. Renaming an entry means changing its RDN; moving it means changing its parent.

RDNDN
LikeA file nameThe full file path
Examplecn=Asha Raocn=Asha Rao,ou=People,dc=acme,dc=example
Unique withinOne parentThe whole directory

137. What is LDAP bind, and what is LDAP search? ​

The short answer

A bind is how a client authenticates to the LDAP server on a connection. A simple bind sends a DN and password; an anonymous bind sends nothing; a SASL bind uses another mechanism such as Kerberos. After a bind, the connection acts with that identity's permissions. A search asks the server for entries, with a base DN to start from, a scope of just that entry, one level or the whole subtree, a filter such as (&(objectClass=user)(mail=asha@acme.example)), and the attributes to return.

ts
import { Client, AndFilter, EqualityFilter } from 'ldapts'

const ldap = new Client({ url: 'ldaps://dc1.acme.example:636' })                 // (1)
await ldap.bind('cn=svc-portal,ou=Service,dc=acme,dc=example', config.LDAP_PASSWORD)   // (2)

const { searchEntries } = await ldap.search('ou=People,dc=acme,dc=example', {   // (3)
  scope: 'sub',
  filter: new AndFilter({ filters: [
    new EqualityFilter({ attribute: 'objectClass', value: 'user' }),
    new EqualityFilter({ attribute: 'mail', value: email }),                    // (4)
  ] }),
  attributes: ['dn', 'objectGUID', 'displayName', 'memberOf'],                  // (5)
})
await ldap.unbind()
  1. LDAPS on port 636, so everything, passwords included, is encrypted.
  2. Bind as a service account with read-only rights.
  3. Search the People subtree.
  4. Build the filter with filter objects, which escape the value. Building (mail=${email}) as a string allows LDAP injection: an email of *)(objectClass=* would match everyone.
  5. Ask only for the attributes you need.

LDAP filter syntax, read aloud:

FilterMeans
(mail=asha@acme.example)Mail equals this
(&(objectClass=user)(department=Finance))A user and in Finance
(|(title=Manager)(title=Director))Manager or Director
(!(userAccountControl:1.2.840.113556.1.4.803:=2))Not disabled, in AD
(cn=Asha*)Common name starts with Asha

138. How does LDAP authentication work? ​

The short answer

An app checks a user's password against LDAP in two steps. First it binds as a service account and searches for the user by their login name or email, to find their DN. Then it opens a new connection, or rebinds, and does a simple bind as that user's DN with the password they typed. If the bind succeeds, the password is correct, and the app can read the user's groups. The app never sees the stored password; the directory checks it. This must run over LDAPS, and empty passwords must be rejected.

userasha + passwordyour appdirectory, LDAPS①② bind service, search③ DN of Asha④ bind as Asha's DN⑤ success or fail
Find, then prove. The service account only finds where the user lives in the tree. The second bind, using the password the user typed, is the real check, and the directory does it, so the app never handles stored password hashes.

The empty-password trap. Many LDAP servers treat a simple bind with a DN and an empty password as an anonymous bind, and report success. An app that does not reject empty passwords first lets anyone log in as anyone. Always check password.length > 0 before binding.

Better options today. LDAP password checks mean your app handles the user's real password and cannot do MFA. Where possible, put the directory behind an identity provider and use OIDC or SAML instead.

139. What is the difference between Active Directory and LDAP? ​

The short answer

LDAP is a protocol: a standard language for talking to a directory. Active Directory is a product: Microsoft's directory service, which stores the data and also includes Kerberos, DNS, Group Policy and replication. AD speaks LDAP, so LDAP tools and apps can query it. Saying "AD versus LDAP" is like saying "a web server versus HTTP". AD also adds its own schema and extensions, such as sAMAccountName, objectGUID and userAccountControl, that a generic LDAP server would not have.

LDAPActive Directory
IsA protocol, a standardA Microsoft product
Stores dataNoYes
Authentication for Windows loginsNoYes, through Kerberos
Policy managementNoGroup Policy
Other implementationsOpenLDAP, FreeIPA and many moreOnly Microsoft

140. Does Active Directory use LDAP? ​

The short answer

Yes. LDAP is the main protocol for reading and changing Active Directory data. Domain controllers listen on port 389 for LDAP, 636 for LDAPS, and 3268 and 3269 for the Global Catalog, a searchable copy of key attributes from every domain in the forest. Windows itself, admin tools and countless apps use LDAP queries against AD. But Windows logins themselves use Kerberos, not an LDAP bind, and AD also uses DNS, RPC and SMB for other jobs.

PortUse
389LDAP, with signing or StartTLS
636LDAPS
3268 / 3269Global Catalog / Global Catalog over TLS
88Kerberos
53DNS

141. What is the difference between LDAP and Microsoft Entra ID? ​

The short answer

LDAP is a decades-old protocol for querying directories inside a company network. Microsoft Entra ID is a cloud identity service that does not speak LDAP at all by default. Apps talk to Entra ID with web protocols: OIDC and OAuth 2.0 for login and tokens, SAML for SSO, SCIM for provisioning, and Microsoft Graph, a REST API, for reading users and groups. To serve old apps that need LDAP, Microsoft offers a separate add-on, Entra Domain Services, which provides a managed LDAP and Kerberos domain.

LDAPMicrosoft Entra ID
KindProtocolCloud identity service
WhereUsually inside a private networkInternet, global
How apps log users inLDAP bind with the passwordOIDC, SAML redirects; MFA possible
How apps read usersLDAP searchMicrosoft Graph REST API
MFA, Conditional AccessNoYes

142. What are the differences between on-premises Active Directory and Entra ID? ​

The short answer

On-premises AD runs on your own domain controllers, inside your network, and manages Windows PCs, servers and file shares with Kerberos, LDAP and Group Policy, in a tree of domains and organisational units. Entra ID is Microsoft's cloud service, run by Microsoft, which manages logins to cloud apps and Microsoft 365 with OIDC, OAuth and SAML, plus MFA and Conditional Access, in a flat tenant. They are not two versions of the same thing. Most companies run both, linked by Entra Connect, which syncs users from AD into Entra ID.

Active DirectoryEntra ID
RunsYour serversMicrosoft's cloud
ProtocolsKerberos, NTLM, LDAPOIDC, OAuth 2.0, SAML, SCIM
StructureForests, domains, OUsFlat tenant, groups, administrative units
Manages devices withGroup PolicyIntune
Login securityPassword, smart cardMFA, passkeys, Conditional Access
Built forOffice networkInternet and cloud apps
Active Directorydomain controllersoffice PCs, file sharesKerberos, LDAP, GPOEntra Connectsync usersEntra IDcloud tenantMicrosoft 365, SaaS appsOIDC, SAML, MFA
Two directories, kept in step. Accounts are created in AD, as before. Entra Connect copies them to the cloud, so the same person signs in to office PCs through AD and to cloud apps through Entra ID with one identity.

How cloud logins check an AD password, three options: password hash sync, where a hash of the AD password hash is synced to Entra ID and Microsoft recommends it; pass-through authentication, where an agent on-premises checks the password live; and federation through ADFS, an older approach Microsoft now advises moving away from.

143. What is a domain controller? ​

The short answer

A domain controller is a Windows Server that runs Active Directory Domain Services and holds a copy of the domain's directory database. It answers logins with Kerberos, serves LDAP queries, applies Group Policy, and usually runs DNS for the domain. A domain has several domain controllers that replicate changes to each other, so if one fails, others keep handling logins. Because it holds every account's password hashes, a domain controller is the most sensitive server in the company and must be protected accordingly.

What to remember about domain controllers:

TopicFact
ReplicationMulti-master: most changes can be made on any DC, then copied to the others
Read-only DCA DC with no writable copy, for branch offices with weak physical security
FSMO rolesA few special jobs only one DC holds at a time, such as the schema master
TimeKerberos needs clocks within 5 minutes, so the DCs are the time source
Attack targetA stolen DC database, NTDS.dit, gives every password hash

Why attackers want one. With domain admin rights, an attacker can copy every password hash, or forge Kerberos tickets that let them act as anyone, the "golden ticket" attack. Protect DCs with separate admin accounts, tiered access, and close monitoring.

Combine chapters into one PDF

Pick the chapters you want. They print in the order you pick them.

Interview Prep
Authentication & Identity
Cookies & sessions
Authentication
Tokens
OAuth & OIDC
Enterprise SSO
Directories
Authorization
Other topics
Nothing picked yet