2000-08-11 10:52:27 +08:00
|
|
|
# $OpenLDAP$
|
2003-01-04 04:04:17 +08:00
|
|
|
# Copyright 1999-2003, The OpenLDAP Foundation, All Rights Reserved.
|
2000-08-11 10:52:27 +08:00
|
|
|
# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
|
|
|
|
|
|
|
|
H1: Schema Specification
|
|
|
|
|
2003-12-05 03:34:02 +08:00
|
|
|
This chapter describes how to extend the user schema used by
|
|
|
|
{{slapd}}(8). The chapter assumes the reader is familar with the
|
|
|
|
{{TERM:LDAP}}/{{TERM:X.500}} information model.
|
|
|
|
|
2000-09-05 06:51:48 +08:00
|
|
|
The first section, {{SECT:Distributed Schema Files}} details optional
|
2000-08-30 04:25:05 +08:00
|
|
|
schema definitions provided in the distribution and where to obtain
|
|
|
|
other definitions.
|
|
|
|
The second section, {{SECT:Extending Schema}}, details how to define
|
|
|
|
new schema items.
|
|
|
|
!if 0
|
|
|
|
The third section, {{SECT:Transferring Schema}} details how you can
|
|
|
|
export schema definitions from an LDAPv3 server and transform it
|
|
|
|
to {{slapd.conf}}(5) format.
|
|
|
|
!endif
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2002-08-28 12:08:02 +08:00
|
|
|
This chapter does not discuss how to extend system schema used by
|
2002-08-28 12:05:07 +08:00
|
|
|
{{slapd}}(8) as this requires source code modification. System
|
|
|
|
schema includes all operational attribute types or any object class
|
|
|
|
which allows or requires an operational attribute (directly or
|
|
|
|
indirectly).
|
|
|
|
|
|
|
|
|
2000-08-11 10:52:27 +08:00
|
|
|
H2: Distributed Schema Files
|
|
|
|
|
|
|
|
OpenLDAP is distributed with a set of schema specifications for
|
|
|
|
your use. Each set is defined in a file suitable for inclusion
|
|
|
|
(using the {{EX:include}} directive) in your {{slapd.conf}}(5)
|
|
|
|
file. These schema files are normally installed in the
|
|
|
|
{{F:/usr/local/etc/openldap/schema}} directory.
|
|
|
|
|
2000-08-13 12:27:15 +08:00
|
|
|
!block table; colaligns="LR"; coltags="F,N"; align=Center; \
|
2002-08-28 12:05:07 +08:00
|
|
|
title="Table 8.1: Provided Schema Specifications"
|
2000-08-13 12:27:15 +08:00
|
|
|
File Description
|
|
|
|
core.schema OpenLDAP {{core}} (required)
|
|
|
|
cosine.schema Cosine and Internet X.500 (useful)
|
|
|
|
inetorgperson.schema InetOrgPerson (useful)
|
|
|
|
misc.schema Assorted (experimental)
|
|
|
|
nis.schema Network Information Services (FYI)
|
|
|
|
openldap.schema OpenLDAP Project (experimental)
|
2000-08-11 10:52:27 +08:00
|
|
|
!endblock
|
|
|
|
|
|
|
|
To use any of these schema files, you only need to include the
|
2001-09-02 01:49:27 +08:00
|
|
|
desired file in the global definitions portion of your
|
2000-08-11 10:52:27 +08:00
|
|
|
{{slapd.conf}}(5) file. For example:
|
|
|
|
|
|
|
|
> # include schema
|
|
|
|
> include /usr/local/etc/openldap/schema/core.schema
|
|
|
|
> include /usr/local/etc/openldap/schema/cosine.schema
|
|
|
|
> include /usr/local/etc/openldap/schema/inetorgperson.schema
|
|
|
|
|
|
|
|
Additional files may be available. Please consult the OpenLDAP
|
|
|
|
FAQ ({{URL:http://www.openldap.org/faq/}}).
|
|
|
|
|
|
|
|
Note: You should not modify any of the schema items defined
|
|
|
|
in provided files.
|
|
|
|
|
2002-01-20 11:32:48 +08:00
|
|
|
|
2000-08-11 10:52:27 +08:00
|
|
|
H2: Extending Schema
|
|
|
|
|
2000-08-24 07:23:16 +08:00
|
|
|
Schema used by {{slapd}}(8) may be extended to support additional
|
2002-01-20 11:32:48 +08:00
|
|
|
syntaxes, matching rules, attribute types, and object classes. This
|
|
|
|
chapter details how to add user application attribute types and
|
|
|
|
object classes using the syntaxes and matching rules already supported
|
|
|
|
by slapd. slapd can also be extended to support additional syntaxes,
|
|
|
|
matching rules and system schema, but this requires some programming
|
|
|
|
and hence is not discussed here.
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
There are five steps to defining new schema:
|
2000-08-11 10:52:27 +08:00
|
|
|
^ obtain Object Identifer
|
2000-08-24 15:00:30 +08:00
|
|
|
+ choose a name prefix
|
2000-08-11 10:52:27 +08:00
|
|
|
+ create local schema file
|
|
|
|
+ define custom attribute types (if necessary)
|
|
|
|
+ define custom object classes
|
|
|
|
|
2002-01-20 11:32:48 +08:00
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
H3: Object Identifiers
|
2000-08-11 10:52:27 +08:00
|
|
|
|
|
|
|
Each schema element is identified by a globally unique
|
2000-08-24 07:23:16 +08:00
|
|
|
{{TERM[expand]OID}} (OID). OIDs are also used to identify
|
2000-08-11 10:52:27 +08:00
|
|
|
other objects.
|
|
|
|
They are commonly found in protocols described by {{TERM:ASN.1}}. In
|
2000-09-05 06:51:48 +08:00
|
|
|
particular, they are heavily used by the {{TERM[expand]SNMP}} (SNMP).
|
2000-08-24 07:23:16 +08:00
|
|
|
As OIDs are hierarchical, your organization
|
2000-08-11 10:52:27 +08:00
|
|
|
can obtain one OID and branch it as needed. For example,
|
|
|
|
if your organization were assigned OID {{EX:1.1}}, you could branch
|
|
|
|
the tree as follows:
|
|
|
|
|
2000-08-13 12:27:15 +08:00
|
|
|
!block table; colaligns="LR"; coltags="EX,N"; align=Center; \
|
2002-08-28 12:05:07 +08:00
|
|
|
title="Table 8.2: Example OID hierarchy"
|
2000-08-13 12:27:15 +08:00
|
|
|
OID Assignment
|
|
|
|
1.1 Organization's OID
|
|
|
|
1.1.1 SNMP Elements
|
|
|
|
1.1.2 LDAP Elements
|
|
|
|
1.1.2.1 AttributeTypes
|
|
|
|
1.1.2.1.1 myAttribute
|
|
|
|
1.1.2.2 ObjectClasses
|
|
|
|
1.1.2.2.1 myObjectClass
|
2000-08-11 10:52:27 +08:00
|
|
|
!endblock
|
|
|
|
|
|
|
|
You are, of course, free to design a hierarchy suitable to your
|
2002-08-28 04:20:52 +08:00
|
|
|
organizational needs under your organization's OID. No matter what
|
|
|
|
hierarchy you choose, you should maintain a registry of assignments
|
|
|
|
you make. This can be a simple flat file or something more
|
|
|
|
sophisticated such as the {{OpenLDAP OID Registry}}
|
2000-08-11 13:58:45 +08:00
|
|
|
({{URL:http://www.openldap.org/faq/index.cgi?file=197}}).
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2002-08-28 04:20:52 +08:00
|
|
|
For more information about Object Identifers (and a listing service)
|
|
|
|
see {{URL:http://www.alvestrand.no/harald/objectid/}}.
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2002-08-28 04:20:52 +08:00
|
|
|
.{{Under no circumstances should you hijack OID namespace!}}
|
2002-08-28 02:17:09 +08:00
|
|
|
|
2002-08-28 04:20:52 +08:00
|
|
|
To obtain a registered OID at {{no cost}}, apply for an OID under
|
|
|
|
the {{ORG[expand]IANA}} (IANA) maintained {{Private Enterprise}}
|
2002-08-28 03:20:29 +08:00
|
|
|
arc. Any private enterprise (organization) may request an OID to
|
|
|
|
be assigned under this arc. Just fill out the {{ORG:IANA}} form
|
2002-08-28 02:17:09 +08:00
|
|
|
at {{URL: http://www.iana.org/cgi-bin/enterprise.pl}} and your
|
|
|
|
official OID will be sent to you usually within a few days. Your
|
|
|
|
base OID will be something like {{EX:1.3.6.1.4.1.X}} where {{EX:X}}
|
2000-08-11 10:52:27 +08:00
|
|
|
is an integer.
|
|
|
|
|
2002-08-28 04:20:52 +08:00
|
|
|
Note: Don't let the "MIB/SNMP" statement on the IANA page confuse
|
|
|
|
you. OIDs obtained using this form may be used for any purpose
|
|
|
|
including identifying LDAP schema elements.
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2002-08-28 02:17:09 +08:00
|
|
|
Alternatively, OID name space may be available from a national
|
2002-08-28 12:05:07 +08:00
|
|
|
authority (e.g., ANSI, BSI).
|
2002-08-28 02:17:09 +08:00
|
|
|
|
2002-08-28 04:20:52 +08:00
|
|
|
For private experiments, OIDs under {{EX:1.1}} may be used. The
|
|
|
|
OID {{EX:1.1}} arc is regarded as dead name space.
|
2002-08-28 02:17:09 +08:00
|
|
|
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2000-08-24 15:00:30 +08:00
|
|
|
H3: Name Prefix
|
2000-08-11 13:58:45 +08:00
|
|
|
|
2000-09-05 06:51:48 +08:00
|
|
|
In addition to assigning a unique object identifier to each schema
|
2000-08-11 13:58:45 +08:00
|
|
|
element, you should provide a least one textual name for each
|
2002-08-28 12:05:07 +08:00
|
|
|
element. The name should be both descriptive and not likely to
|
|
|
|
clash with names of other schema elements. In particular, any name
|
|
|
|
you choose should not clash with present or future Standard Track
|
|
|
|
names.
|
2000-08-11 13:58:45 +08:00
|
|
|
|
2002-08-28 12:05:07 +08:00
|
|
|
To reduce (but not eliminate) the potential for name clashes, the
|
|
|
|
convention is to prefix names of non-Standard Track with a few
|
|
|
|
letters to localize the changes to your organization. The smaller
|
|
|
|
the organization, the longer your prefix should be.
|
2000-08-11 13:58:45 +08:00
|
|
|
|
2002-04-20 14:18:55 +08:00
|
|
|
In the examples below, we have chosen a short prefix '{{EX:my}}'
|
2002-08-28 12:05:07 +08:00
|
|
|
(to save space). Such a short prefix would only be suitable for a
|
|
|
|
very large, global organization. In general, we recommend something
|
|
|
|
like '{{EX:deFirm}}' (German company) or '{{EX:comExample}}' (elements
|
|
|
|
associated with organization associated with {{EX:example.com}}).
|
2000-08-11 13:58:45 +08:00
|
|
|
|
|
|
|
|
2000-08-11 10:52:27 +08:00
|
|
|
H3: Local schema file
|
|
|
|
|
|
|
|
The {{EX:objectclass}} and {{EX:attributeTypes}} configuration file
|
|
|
|
directives can be used to define schema rules on entries in the
|
|
|
|
directory. It is customary to create a file to contain definitions
|
|
|
|
of your custom schema items. We recommend you create a file
|
|
|
|
{{F:local.schema}} in {{F:/usr/local/etc/openldap/schema/local.schema}}
|
|
|
|
and then include this file in your {{slapd.conf}}(5) file immediately
|
|
|
|
after other schema {{EX:include}} directives.
|
|
|
|
|
|
|
|
> # include schema
|
|
|
|
> include /usr/local/etc/openldap/schema/core.schema
|
|
|
|
> include /usr/local/etc/openldap/schema/cosine.schema
|
|
|
|
> include /usr/local/etc/openldap/schema/inetorgperson.schema
|
|
|
|
> # include local schema
|
|
|
|
> include /usr/local/etc/openldap/schema/local.schema
|
|
|
|
|
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
H3: Attribute Type Specification
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
The {{attributetype}} directive is used to define a new attribute
|
|
|
|
type. The directive uses the same Attribute Type Description
|
|
|
|
(as defined in {{REF:RFC2252}}) used by the attributeTypes
|
|
|
|
attribute found in the subschema subentry, e.g.:
|
2000-08-11 10:52:27 +08:00
|
|
|
|
|
|
|
E: attributetype <{{REF:RFC2252}} Attribute Type Description>
|
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
where Attribute Type Description is defined by the following
|
|
|
|
{{TERM:BNF}}:
|
|
|
|
|
|
|
|
> AttributeTypeDescription = "(" whsp
|
|
|
|
> numericoid whsp ; AttributeType identifier
|
|
|
|
> [ "NAME" qdescrs ] ; name used in AttributeType
|
|
|
|
> [ "DESC" qdstring ] ; description
|
|
|
|
> [ "OBSOLETE" whsp ]
|
|
|
|
> [ "SUP" woid ] ; derived from this other
|
|
|
|
> ; AttributeType
|
|
|
|
> [ "EQUALITY" woid ; Matching Rule name
|
|
|
|
> [ "ORDERING" woid ; Matching Rule name
|
|
|
|
> [ "SUBSTR" woid ] ; Matching Rule name
|
2002-01-05 03:09:36 +08:00
|
|
|
> [ "SYNTAX" whsp noidlen whsp ] ; Syntax OID
|
2000-08-11 13:58:45 +08:00
|
|
|
> [ "SINGLE-VALUE" whsp ] ; default multi-valued
|
|
|
|
> [ "COLLECTIVE" whsp ] ; default not collective
|
|
|
|
> [ "NO-USER-MODIFICATION" whsp ]; default user modifiable
|
|
|
|
> [ "USAGE" whsp AttributeUsage ]; default userApplications
|
|
|
|
> whsp ")"
|
|
|
|
>
|
|
|
|
> AttributeUsage =
|
|
|
|
> "userApplications" /
|
|
|
|
> "directoryOperation" /
|
|
|
|
> "distributedOperation" / ; DSA-shared
|
|
|
|
> "dSAOperation" ; DSA-specific, value depends on server
|
|
|
|
>
|
|
|
|
|
|
|
|
where whsp is a space ('{{EX: }}'), numericoid is a globally unique
|
2002-01-20 11:32:48 +08:00
|
|
|
OID in dotted-decimal form (e.g. {{EX:1.1.0}}), qdescrs is one or
|
2002-01-05 03:09:36 +08:00
|
|
|
more names, woid is either the name or OID optionally followed
|
2002-06-15 09:00:50 +08:00
|
|
|
by a length specifier (e.g {{EX:{10}}}).
|
2000-08-11 13:58:45 +08:00
|
|
|
|
|
|
|
For example, the attribute types {{EX:name}} and {{EX:cn}} are defined
|
|
|
|
in {{F:core.schema}} as:
|
|
|
|
|
2000-09-12 02:40:39 +08:00
|
|
|
> attributeType ( 2.5.4.41 NAME 'name'
|
2002-01-05 03:09:36 +08:00
|
|
|
> DESC 'name(s) associated with the object'
|
2000-08-11 13:58:45 +08:00
|
|
|
> EQUALITY caseIgnoreMatch
|
|
|
|
> SUBSTR caseIgnoreSubstringsMatch
|
|
|
|
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
|
2002-10-10 09:34:55 +08:00
|
|
|
> attributeType ( 2.5.4.3 NAME ( 'cn' 'commonName' )
|
2002-01-05 03:09:36 +08:00
|
|
|
> DESC 'common name(s) assciated with the object'
|
|
|
|
> SUP name )
|
|
|
|
|
|
|
|
Notice that each defines the attribute's OID, provides a short name,
|
|
|
|
and a brief description. Each name is an alias for the OID.
|
|
|
|
{{slapd}}(8) returns the first listed name when returning results.
|
|
|
|
|
|
|
|
The first attribute, {{EX:name}}, holds values of {{EX:directoryString}}
|
2002-06-15 09:00:50 +08:00
|
|
|
(UTF-8 encoded Unicode) syntax. The syntax is specified by OID
|
2002-01-05 03:09:36 +08:00
|
|
|
(1.3.6.1.4.1.1466.115.121.1.15 identifies the directoryString
|
2002-01-20 11:32:48 +08:00
|
|
|
syntax). A length recommendation of 32768 is specified. Servers
|
2002-01-05 03:09:36 +08:00
|
|
|
should support values of this length, but may support longer values
|
|
|
|
The field does NOT specify a size constraint, so is ignored on
|
|
|
|
servers (such as slapd) which don't impose such size limits. In
|
|
|
|
addition, the equality and substring matching uses case ignore
|
|
|
|
rules. Below are tables listing commonly used syntax and
|
|
|
|
matching rules (OpenLDAP supports these and many more).
|
2000-08-11 13:58:45 +08:00
|
|
|
|
2000-08-13 12:27:15 +08:00
|
|
|
!block table; align=Center; coltags="EX,EX,N"; \
|
2002-08-28 12:05:07 +08:00
|
|
|
title="Table 8.3: Commonly Used Syntaxes"
|
2000-08-24 07:23:16 +08:00
|
|
|
Name OID Description
|
|
|
|
boolean 1.3.6.1.4.1.1466.115.121.1.7 boolean value
|
2003-06-10 04:58:38 +08:00
|
|
|
directoryString 1.3.6.1.4.1.1466.115.121.1.15 Unicode (UTF-8) string
|
|
|
|
distinguishedName 1.3.6.1.4.1.1466.115.121.1.12 LDAP DN
|
|
|
|
integer 1.3.6.1.4.1.1466.115.121.1.27 integer
|
|
|
|
numericString 1.3.6.1.4.1.1466.115.121.1.36 numeric string
|
2000-08-24 07:23:16 +08:00
|
|
|
OID 1.3.6.1.4.1.1466.115.121.1.38 object identifier
|
2003-06-10 04:58:38 +08:00
|
|
|
octetString 1.3.6.1.4.1.1466.115.121.1.40 arbitary octets
|
2000-08-13 12:27:15 +08:00
|
|
|
!endblock
|
|
|
|
|
2000-08-24 07:23:16 +08:00
|
|
|
>
|
2000-08-13 12:32:19 +08:00
|
|
|
|
2000-08-13 12:27:15 +08:00
|
|
|
!block table; align=Center; coltags="EX,N"; \
|
2002-08-28 12:05:07 +08:00
|
|
|
title="Table 8.4: Commonly Used Matching Rules"
|
2003-06-10 04:58:38 +08:00
|
|
|
Name Type Description
|
|
|
|
booleanMatch equality boolean
|
|
|
|
caseIgnoreMatch equality case insensitive, space insensitive
|
|
|
|
caseIgnoreOrderingMatch ordering case insensitive, space insensitive
|
|
|
|
caseIgnoreSubstringsMatch substrings case insensitive, space insensitive
|
|
|
|
caseExactMatch equality case sensitive, space insensitive
|
|
|
|
caseExactOrderingMatch ordering case sensitive, space insensitive
|
|
|
|
caseExactSubstringsMatch substrings case sensitive, space insensitive
|
|
|
|
distinguishedNameMatch equality distinguished name
|
|
|
|
integerMatch equality integer
|
|
|
|
integerOrderingMatch ordering integer
|
|
|
|
numericStringMatch equality numerical
|
|
|
|
numericStringOrderingMatch ordering numerical
|
|
|
|
numericStringSubstringsMatch substrings numerical
|
|
|
|
octetStringMatch equality octet string
|
|
|
|
octetStringOrderingStringMatch ordering octet string
|
|
|
|
octetStringSubstringsStringMatch ordering octet string
|
|
|
|
objectIdentiferMatch equality object identifier
|
2000-08-13 12:27:15 +08:00
|
|
|
!endblock
|
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
The second attribute, {{EX:cn}}, is a subtype of {{EX:name}} hence
|
2000-09-05 06:51:48 +08:00
|
|
|
it inherits the syntax, matching rules, and usage of {{EX:name}}.
|
2000-08-11 13:58:45 +08:00
|
|
|
{{EX:commonName}} is an alternative name.
|
|
|
|
|
2002-01-05 03:09:36 +08:00
|
|
|
Neither attribute is restricted to a single value. Both are meant
|
|
|
|
for usage by user applications. Neither is obsolete nor collective.
|
2000-08-11 13:58:45 +08:00
|
|
|
|
|
|
|
The following subsections provide a couple of examples.
|
|
|
|
|
|
|
|
|
|
|
|
H4: myUniqueName
|
|
|
|
|
|
|
|
Many organizations maintain a single unique name for each user.
|
2000-09-05 06:51:48 +08:00
|
|
|
Though one could use {{EX:displayName}} ({{REF:RFC2798}}), this
|
|
|
|
attribute is really meant to be controlled by the user, not the
|
2000-08-11 13:58:45 +08:00
|
|
|
organization. We could just copy the definition of {{EX:displayName}}
|
|
|
|
from {{F:inetorgperson.schema}} and replace the OID, name, and
|
|
|
|
description, e.g:
|
|
|
|
|
|
|
|
> attributetype ( 1.1.2.1.1 NAME 'myUniqueName'
|
|
|
|
> DESC 'unique name with my organization'
|
|
|
|
> EQUALITY caseIgnoreMatch
|
|
|
|
> SUBSTR caseIgnoreSubstringsMatch
|
|
|
|
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
|
|
|
|
> SINGLE-VALUE )
|
|
|
|
|
2000-09-05 06:51:48 +08:00
|
|
|
However, if we want this name to be included in
|
2000-08-11 13:58:45 +08:00
|
|
|
{{EX:name}} assertions [e.g. {{EX:(name=*Jane*)}}], the attribute
|
|
|
|
could alternatively be defined as a subtype of {{EX:name}}, e.g.:
|
|
|
|
|
|
|
|
> attributetype ( 1.1.2.1.1 NAME 'myUniqueName'
|
|
|
|
> DESC 'unique name with my organization'
|
|
|
|
> SUP name )
|
|
|
|
|
|
|
|
|
|
|
|
H4: myPhoto
|
|
|
|
|
|
|
|
Many organizations maintain a photo of each each user. A
|
|
|
|
{{EX:myPhoto}} attribute type could be defined to hold a photo.
|
|
|
|
Of course, one could use just use {{EX:jpegPhoto}} ({{REF:RFC2798}})
|
|
|
|
(or a subtype) to hold the photo. However, you can only do
|
|
|
|
this if the photo is in {{JPEG File Interchange Format}}.
|
|
|
|
Alternatively, an attribute type which uses the {{Octet String}}
|
|
|
|
syntax can be defined, e.g.:
|
|
|
|
|
|
|
|
> attributetype ( 1.1.2.1.2 NAME 'myPhoto'
|
|
|
|
> DESC 'a photo (application defined format)'
|
|
|
|
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
|
|
|
|
> SINGLE-VALUE )
|
|
|
|
|
2002-01-20 11:32:48 +08:00
|
|
|
In this case, the syntax doesn't specify the format of the photo.
|
|
|
|
It's assumed (maybe incorrectly) that all applications accessing
|
|
|
|
this attribute agree on the handling of values.
|
2000-08-11 13:58:45 +08:00
|
|
|
|
2000-09-05 06:51:48 +08:00
|
|
|
If you wanted to support multiple photo formats, you could define
|
|
|
|
a separate attribute type for each format, prefix the photo
|
2000-08-11 13:58:45 +08:00
|
|
|
with some typing information, or describe the value using
|
|
|
|
{{TERM:ASN.1}} and use the {{EX:;binary}} transfer option.
|
|
|
|
|
2000-08-28 06:08:13 +08:00
|
|
|
Another alternative is for the attribute to hold a {{TERM:URI}}
|
2000-08-11 13:58:45 +08:00
|
|
|
pointing to the photo. You can model such an attribute after
|
2002-01-20 11:32:48 +08:00
|
|
|
{{EX:labeledURI}} ({{REF:RFC2079}}) or simply create a subtype,
|
|
|
|
e.g.:
|
|
|
|
|
|
|
|
> attributetype ( 1.1.2.1.3 NAME 'myPhotoURI'
|
|
|
|
> DESC 'URI and optional label referring to a photo'
|
|
|
|
> SUP labeledURI )
|
2000-08-11 13:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
H3: Object Class Specification
|
|
|
|
|
|
|
|
The {{objectclasses}} directive is used to define a new object
|
|
|
|
class. The directive uses the same Object Class Description
|
|
|
|
(as defined in {{REF:RFC2252}}) used by the objectClasses
|
|
|
|
attribute found in the subschema subentry, e.g.:
|
2000-08-11 10:52:27 +08:00
|
|
|
|
|
|
|
E: objectclass <{{REF:RFC2252}} Object Class Description>
|
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
where Object Class Description is defined by the following
|
|
|
|
{{TERM:BNF}}:
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
> ObjectClassDescription = "(" whsp
|
|
|
|
> numericoid whsp ; ObjectClass identifier
|
|
|
|
> [ "NAME" qdescrs ]
|
|
|
|
> [ "DESC" qdstring ]
|
|
|
|
> [ "OBSOLETE" whsp ]
|
|
|
|
> [ "SUP" oids ] ; Superior ObjectClasses
|
|
|
|
> [ ( "ABSTRACT" / "STRUCTURAL" / "AUXILIARY" ) whsp ]
|
|
|
|
> ; default structural
|
|
|
|
> [ "MUST" oids ] ; AttributeTypes
|
|
|
|
> [ "MAY" oids ] ; AttributeTypes
|
|
|
|
> whsp ")"
|
|
|
|
|
|
|
|
where whsp is a space ('{{EX: }}'), numericoid is a globally unique
|
2002-01-20 11:32:48 +08:00
|
|
|
OID in numeric form (e.g. {{EX:1.1.0}}), qdescrs is one or more
|
2000-09-05 06:51:48 +08:00
|
|
|
names, and oids is one or more names and/or OIDs.
|
2000-08-11 10:52:27 +08:00
|
|
|
|
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
H4: myPhotoObject
|
|
|
|
|
2000-08-28 06:08:13 +08:00
|
|
|
To define an {{auxiliary}} object class which allows
|
2000-08-11 13:58:45 +08:00
|
|
|
myPhoto to be added to any existing entry.
|
|
|
|
|
|
|
|
> objectclass ( 1.1.2.2.1 NAME 'myPhotoObject'
|
|
|
|
> DESC 'mixin myPhoto'
|
|
|
|
> AUXILIARY
|
|
|
|
> MAY myPhoto )
|
|
|
|
|
|
|
|
|
|
|
|
H4: myPerson
|
|
|
|
|
2000-08-28 06:08:13 +08:00
|
|
|
If your organization would like have a private {{structural}}
|
2000-08-11 13:58:45 +08:00
|
|
|
object class to instantiate users, you can subclass one of
|
|
|
|
the existing person classes, such as {{EX:inetOrgPerson}}
|
2000-08-28 06:08:13 +08:00
|
|
|
({{REF:RFC2798}}), and add any additional attributes which
|
2000-08-11 13:58:45 +08:00
|
|
|
you desire.
|
|
|
|
|
|
|
|
> objectclass ( 1.1.2.2.2 NAME 'myPerson'
|
|
|
|
> DESC 'my person'
|
|
|
|
> SUP inetOrgPerson
|
2002-06-10 02:57:35 +08:00
|
|
|
> MUST ( myUniqueName $ givenName )
|
|
|
|
> MAY myPhoto )
|
2000-08-11 10:52:27 +08:00
|
|
|
|
2000-08-11 13:58:45 +08:00
|
|
|
The object class inherits the required/allowed attribute
|
|
|
|
types of {{EX:inetOrgPerson}} but requires {{EX:myUniqueName}}
|
2000-08-18 19:22:48 +08:00
|
|
|
and {{EX:givenName}} and allows {{EX:myPhoto}}.
|
2000-08-30 04:25:05 +08:00
|
|
|
|
|
|
|
!if 0
|
|
|
|
H2: Transferring Schema
|
|
|
|
|
|
|
|
Since the {{slapd.conf}}(5) schema directives use {{REF:RFC2252}}
|
|
|
|
format values, you can extract schema elements published by
|
|
|
|
any LDAPv3 server and easily construct directives for use with
|
|
|
|
{{slapd}}(8).
|
|
|
|
|
|
|
|
LDAPv3 servers publish schema elements in special {{subschema}}
|
2002-08-28 12:22:12 +08:00
|
|
|
entries (or subentries). While {{slapd}}(8) publishes a single
|
|
|
|
subschema subentry normally named {{EX:cn=Subschema}}, this behavior
|
|
|
|
cannot be expected from other servers. The subschema subentry
|
|
|
|
controlling a particular entry can be obtained by examining the
|
|
|
|
{{EX:subschemaSubentry}} attribute contained in the entry at the
|
|
|
|
root of each administrative context. For example,
|
|
|
|
|
|
|
|
> ldapsearch -LLL -x -b "dc=example,dc=com" -s base "(objectclass=*)" subschemaSubentry
|
2000-08-30 04:25:05 +08:00
|
|
|
|
|
|
|
To obtain the schema from a subschema subentry, you can use
|
|
|
|
ldapsearch(1) as follows (replace the search base as needed):
|
|
|
|
|
|
|
|
> ldapsearch -LLL -x -b "cn=Subschema" -s base "(objectclass=subschema)" attributeTypes objectClasses
|
|
|
|
|
2002-08-28 12:22:12 +08:00
|
|
|
where "cn=Subschema" is the value of subschemaSubentry returned in
|
|
|
|
the prior search.
|
|
|
|
|
2000-08-30 04:25:05 +08:00
|
|
|
This will return {{TERM:LDIF}} output containing many type/value
|
|
|
|
pairs. The following is an abbreviated example:
|
|
|
|
|
|
|
|
> dn: cn=Subschema
|
2002-08-28 12:22:12 +08:00
|
|
|
> objectClasses: ( 1.1.2.2.2 NAME 'myPerson' DESC 'my person' SUP inet
|
|
|
|
> OrgPerson MUST ( myUniqueName $ givenName ) MAY myPhoto )
|
2000-08-30 04:25:05 +08:00
|
|
|
> attributeTypes: ( 1.1.2.1.1 NAME 'myUniqueName' DESC 'unique name wi
|
|
|
|
> th my organization' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubst
|
|
|
|
> ringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
|
|
|
> attributeTypes: ( 1.1.2.1.2 NAME 'myPhoto' DESC 'a photo (applicatio
|
|
|
|
> n defined format)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
|
|
|
|
|
|
|
|
Capture the output of the search in a file and then edit the file:
|
|
|
|
|
|
|
|
+ to contain only desired type/value pairs
|
|
|
|
^ join LDIF continuation lines
|
|
|
|
^ replace attribute type with directive name
|
2002-08-28 12:22:12 +08:00
|
|
|
(e.g. {{EX:s/attributeTypes:/attributeType /}} and
|
|
|
|
{{EX:s/objectClasses:/objectClass /}}).
|
|
|
|
^ reorder lines so each element is defined before first use
|
2000-08-30 04:25:05 +08:00
|
|
|
^ continue long directives over multiple lines
|
|
|
|
|
|
|
|
For the three type/value pairs in our example, the edit should
|
|
|
|
result in a file with contains of:
|
|
|
|
|
|
|
|
> attributetype ( 1.1.2.1.1 NAME 'myUniqueName'
|
|
|
|
> DESC 'unique name with my organization'
|
|
|
|
> EQUALITY caseIgnoreMatch
|
|
|
|
> SUBSTR caseIgnoreSubstringsMatch
|
|
|
|
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
|
|
|
|
> SINGLE-VALUE )
|
|
|
|
> attributeType ( 1.1.2.1.2 NAME 'myPhoto'
|
|
|
|
> DESC 'a photo (application defined format)'
|
|
|
|
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
|
|
|
|
> objectClass ( 1.1.2.2.2 NAME 'myPerson'
|
|
|
|
> DESC 'my person'
|
|
|
|
> SUP inetOrgPerson
|
2002-06-10 02:57:35 +08:00
|
|
|
> MUST ( myUniqueName $ givenName )
|
|
|
|
> MAY myPhoto )
|
2000-08-30 04:25:05 +08:00
|
|
|
|
2002-08-28 12:22:12 +08:00
|
|
|
Save in an appropriately named file (e.g. {{F:local.schema}}).
|
2002-01-20 11:32:48 +08:00
|
|
|
You may now include this file in your {{slapd.conf}}(5) file.
|
2000-08-30 04:25:05 +08:00
|
|
|
!endif
|
2002-01-20 11:32:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
H3: OID Macros
|
|
|
|
|
|
|
|
To ease the management and use of OIDs, {{slapd}}(8) supports
|
2002-08-28 12:22:12 +08:00
|
|
|
{{Object Identifier}} macros. The {{EX:objectIdentifier}} directive
|
|
|
|
is used to equate a macro (name) with a OID. The OID may possibly
|
|
|
|
be derived from a previously defined OID macro. The {{slapd.conf}}(5)
|
|
|
|
syntax is:
|
2002-01-20 11:32:48 +08:00
|
|
|
|
|
|
|
E: objectIdentifier <name> { <oid> | <name>[:<suffix>] }
|
|
|
|
|
|
|
|
The following demonstrates definition of a set of OID macros
|
|
|
|
and their use in defining schema elements:
|
|
|
|
|
2002-06-15 05:19:42 +08:00
|
|
|
> objectIdentifier myOID 1.1
|
2002-06-15 09:00:50 +08:00
|
|
|
> objectIdentifier mySNMP myOID:1
|
|
|
|
> objectIdentifier myLDAP myOID:2
|
|
|
|
> objectIdentifier myAttributeType myLDAP:1
|
|
|
|
> objectIdentifier myObjectClass myLDAP:2
|
2002-01-20 11:32:48 +08:00
|
|
|
> attributetype ( myAttributeType:3 NAME 'myPhotoURI'
|
|
|
|
> DESC 'URI and optional label referring to a photo'
|
|
|
|
> SUP labeledURI )
|
|
|
|
> objectclass ( myObjectClass:1 NAME 'myPhotoObject'
|
|
|
|
> DESC 'mixin myPhoto'
|
|
|
|
> AUXILIARY
|
2002-06-14 21:18:15 +08:00
|
|
|
> MAY myPhoto )
|
2002-01-20 11:32:48 +08:00
|
|
|
|