44

Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Embed Size (px)

Citation preview

Page 1: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Directory Services

(in particular LDAP)

Karst Koymans, Jaap van Ginkel

Informatics Institute

University of Amsterdam

(version 1.9, 2012/10/05 13:37:02)

Friday, October 12, 2012

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 1 / 40

Page 2: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

1 History of Directory Services

2 Use of directories

3 DIT, naming and attributes

4 Representation and protocol

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 2 / 40

Page 3: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

Outline

1 History of Directory Services

2 Use of directories

3 DIT, naming and attributes

4 Representation and protocol

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 3 / 40

Page 4: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

Common Directory Services

Flat �les (from BSD)

NIS (Network Information Service from Sun)

was YP (Yellow Pages)

extended to NIS+

NetInfo (NEXTSTEP - Mac OS X v10.4)

Active Directory (Microsoft)

LDAP (Lightweight Directory Access Protocol)

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 4 / 40

Page 5: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

LDAP History (1)

X.500 standard (1988)

Developed by CCITT (ITU-T)

Uses DAP (Directory Access Protocol)

Between DUA (Directory User Agent)

and DSA (Directory System Agent)

Based on OSI software

Revised in 1993

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 5 / 40

Page 6: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

LDAP History (2)

LDAP (Lightweight DAP) as simple access to X.500

LDAP v1 (RFC 1487) in 1993

LDAP v2 (RFC 1777) in 1995

LDAP as replacement for X.500

LDAP v3 (RFC 2251) in 1997

Obsoleted by RFC 451i (i=0,. . . ,9) in 2006

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 6 / 40

Page 7: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

LDAP versus X.500 (1)

LDAP v1 and v2

Works directly over TCP/IP

Use ordinary strings instead of ASN.1/BER in many cases

Simpli�es BER in other cases

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 7 / 40

Page 8: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

History of Directory Services

LDAP versus X.500 (2)

LDAP v3

Simpli�cations from v1 and v2

De�nes referrals

Uses SASL for security

Uses Unicode for internationalisation

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 8 / 40

Page 9: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

Outline

1 History of Directory Services

2 Use of directories

3 DIT, naming and attributes

4 Representation and protocol

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 9 / 40

Page 10: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

Properties of directories

Optimized for reads

Distributed model for information storage

Extendable information

Advanced search capabilities

Replication capabilities

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 10 / 40

Page 11: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (1)

Information model

De�nes structures and data types

De�nes the Directory Information Base (DIB)

Naming model

How entries are referenced

De�nes (Relative) Distinguished Names

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 11 / 40

Page 12: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (2)

Functional model

De�nes the protocol

De�nes what operations can be performed

Security model

Provides authentication

Provides authorization

Provides con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 12 / 40

Page 13: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (3)

How do LDAP models compare to the DNS environment?

Information model

Resource records

Naming model

Owner names (domain names)

Functional model

Query

Security model

Authentication, no authorization or con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 13 / 40

Page 14: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (3)

How do LDAP models compare to the DNS environment?

Information model

Resource records

Naming model

Owner names (domain names)

Functional model

Query

Security model

Authentication, no authorization or con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 13 / 40

Page 15: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (3)

How do LDAP models compare to the DNS environment?

Information model

Resource records

Naming model

Owner names (domain names)

Functional model

Query

Security model

Authentication, no authorization or con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 13 / 40

Page 16: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (3)

How do LDAP models compare to the DNS environment?

Information model

Resource records

Naming model

Owner names (domain names)

Functional model

Query

Security model

Authentication, no authorization or con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 13 / 40

Page 17: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Use of directories

LDAP models (3)

How do LDAP models compare to the DNS environment?

Information model

Resource records

Naming model

Owner names (domain names)

Functional model

Query

Security model

Authentication, no authorization or con�dentiality

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 13 / 40

Page 18: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Outline

1 History of Directory Services

2 Use of directories

3 DIT, naming and attributes

4 Representation and protocol

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 14 / 40

Page 19: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Directory Information Tree

A Directory Information Tree (DIT) is a tree

where the nodes are called Directory Entries

which each contain a set of attributes

where every attribute has a type and a value

Directory Schemas are used to specify

the allowed entries and attribute types

LDIF (LDAP Data Interchange Format) is used

to de�ne speci�c entries

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 15 / 40

Page 20: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Naming Directory Entries

An RDN (Relative Distinguished Name)

consists of a subset of attributes

that uniquely identi�es the entry among its siblings

most of the time being a singleton subset

comparable to a primary key in a relational database

An DN (Distinguished Name)

is a sequence of RDNs, separated by �,�s

making the entry unique on the LDAP server

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 16 / 40

Page 21: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Special Attributes (1)

the �objectClass� attribute is always present

objectClass de�nes valid attribute types for the entry

a �classic selfreference�

objectClass is always in the list

this attribute can be multivalued

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 17 / 40

Page 22: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Special Attributes (2)

the �dn� attribute is not a real attribute

but is often presented as such

contains the distinguished name of an entry

is useful inside an LDIF representation

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 18 / 40

Page 23: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

X.500 names and DNS labels

A DNS domain name like �os3.nl.� corresponds to

a distinguished name �dc=os3,dc=nl�

where �dc� is the domainComponent attribute

of an entry of objectClass: domain

which represents the LDAP server's naming context

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 19 / 40

Page 24: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Object classes

An object class

speci�es a name for the class

and its OID (object identi�er)

speci�es mandatory attribute types

speci�es optional attribute types

is part of a class hierarchy (inheritance)

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 20 / 40

Page 25: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Attribute types

An attribute type

uniquely speci�es the name of the attribute type

and its OID (object identi�er)

speci�es whether it is single-valued or multi-valued

speci�es the attribute syntax and matching criteria, for instance

testing for equality, ordering, . . .

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 21 / 40

Page 26: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Attribute syntax

speci�es the kind of data for values (datatype)

can be primitive or complex

sets parameters for ranges or sizes

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 22 / 40

Page 27: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Directory schema (1)

A directory schema speci�es

available object classes

with the attribute types

and the attribute syntax

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 23 / 40

Page 28: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

DIT, naming and attributes

Directory schema (2)

A schema can be written in several formats

ASN.1 schema format

LDAPv3 schema format

slapd.conf schema format

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 24 / 40

Page 29: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Outline

1 History of Directory Services

2 Use of directories

3 DIT, naming and attributes

4 Representation and protocol

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 25 / 40

Page 30: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDIF

LDAP Data Interchange Format

standard text �le format describing directory entries

de�ned in RFC 2849

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 26 / 40

Page 31: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP wire format

LDAP sends messages based on ASN.1

Abstract Syntac Notation One

and uses a subset of BER for wire encoding

Basic Encoding Rules

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 27 / 40

Page 32: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP operations (1)

Authentication and control

bind

establish authentication state

unbind

abandon operations and close connections

abandon

abort earlier operation (by ID)

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 28 / 40

Page 33: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP operations (2)

Updates

add

create a new node

delete

remove a complete node

modify

change attributes or values at a node

modify DN

rename/move (R)DN

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 29 / 40

Page 34: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP operations (3)

Search and retrieve

search

compare

specialized search

can show nonexistence of an attribute

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 30 / 40

Page 35: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP security

Several security mechanisms are de�ned

None (anonymous access)

Clear text passwords

Kerberos authentication

SASL authentication

LDAP over SSL/TLS (STARTTLS or ldaps)

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 31 / 40

Page 36: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Searching

A search operation has eight (!) parameters

Replaces a non-existent read operation

A read is a search restricted to only one DN

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 32 / 40

Page 37: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Search parameters (1)

Base DN

Scope

base

onelevel

subtree

Treatment of aliases

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 33 / 40

Page 38: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Search parameters (2)

Size limit (number of entries to return)

Time limit (maximum time spent searching)

Include attribute types and values or only types

Search �lter

List of attributes to be returned

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 34 / 40

Page 39: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Search �lters

Boolean combination of atomic search �lters

Boolean operators allowed

& (Boolean AND)

| (Boolean OR)

! (Boolean NOT)

�(&(givenName=Niels)(|(l=Amsterdam)(l=Utrecht)))�

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 35 / 40

Page 40: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Atomic search �lters (1)

Equality

�(sn=van der ham)� matches �van der Ham�

Greater Than or Equal To

�(age>=18)� matches �21�

Less Than or Equal To

�(age<=21)� matches �21�

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 36 / 40

Page 41: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Atomic search �lters (2)

Substring

�(sn=*ham)� matches �van der Ham�

Approximate

�(sn∼=van der Hem)� matches �van der Ham�

Presence

�(sn=*)� matches any entry with a sn attribute

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 37 / 40

Page 42: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Aliases

Directory entries of objectClass �alias�

Mandatory attribute �aliasedObjectName�

which contains a reference to another DN

Could be compared with a CNAME in DNS

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 38 / 40

Page 43: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

Referrals

Directory entries of objectClass �referral�

Optional attribute �ref�

which contains an LDAP URI

Another option is �chaining�

Compare to recursion and iteration in DNS

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 39 / 40

Page 44: Directory Services - (in particular LDAP) · Directory Services (in particular LDAP) Karst Koymans, Jaap van Ginkel Informatics Institute University of Amsterdam (version 1.9, 2012/10/05

Representation and protocol

LDAP URIs

ldap://

fqdn:port/

distinguished_name

ldaps://

fqdn:port/

distinguished_name

Karst Koymans, Jaap van Ginkel (UvA) Directory Services Friday, October 12, 2012 40 / 40