У меня есть определяемая пользователем схема, которая должна быть добавлена в существующий сервер LDAP. Его ldif формат:
dn: cn=userControl,cn=schema,cn=config objectClass: olcSchemaConfig cn: userControl olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.1 NAME 'genderAttr' DESC 'gender' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.2 NAME 'dobAttr' DESC 'dateOfBirth' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 ) olcAttributeTypes: (1.3.6.1.4.1.xxxxx.1.1.3 NAME 'languageAttr' DESC 'languages known' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.4 NAME 'mTongueAttr' DESC 'motherTongue' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.5 NAME 'nationalityAttr DESC 'nationality' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.6 NAME 'worksAtAttr' DESC 'worksAt' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.7 NAME 'qualificationAttr' DESC 'qualification' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.8 NAME 'schoolAttr' DESC 'school' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.9 NAME 'collegeAttr' DESC 'college' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.10 NAME 'addressAttr' DESC 'address' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.11 NAME 'zipAttr' DESC 'pinCode' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) objectclass ( 1.3.6.1.4.1.xxxxx.1.2.1 NAME 'userControl' DESC 'RFC2798: New Customized Schema' SUP organizationalPerson STRUCTURAL MAY ( gender $ dateOfBirth $ languagesKnown $ motherTongue $ nationality $ worksAt $ qualification $ school $ college $ address $ pinCode $ contactNumber $ interestedIn ) )
и .schema формат
# userControl.schema attributetype ( 1.3.6.1.4.1.xxxxx.1.1.1 NAME 'genderAttr' DESC 'gender' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.2 NAME 'dobAttr' DESC 'dateOfBirth' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 ) attributetype (1.3.6.1.4.1.xxxxx.1.1.3 NAME 'languageAttr' DESC 'languages known' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.4 NAME 'mTongueAttr' DESC 'motherTongue' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.5 NAME 'nationalityAttr DESC 'nationality' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.6 NAME 'worksAtAttr' DESC 'worksAt' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.7 NAME 'qualificationAttr' DESC 'qualification' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.8 NAME 'schoolAttr' DESC 'school' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.9 NAME 'collegeAttr' DESC 'college' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.10 NAME 'addressAttr' DESC 'address' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) attributetype ( 1.3.6.1.4.1.xxxxx.1.1.11 NAME 'zipAttr' DESC 'pinCode' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) objectclass ( 1.3.6.1.4.1.xxxxx.1.2.1 NAME 'userControl' DESC 'RFC2798: New Customized Schema' SUP organizationalPerson STRUCTURAL MAY ( gender $ dateOfBirth $ languagesKnown $ motherTongue $ nationality $ worksAt $ qualification $ school $ college $ address $ pinCode $ contactNumber $ interestedIn ) )
Я попытался добавить ldif файл в LDAP использующий кода
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/userControl.ldif
Но я получаю ошибку
ldapadd: invalid format (line 5) entry: "cn=userControl,cn=schema,cn=config"
Я проверил на решения и применил его, но там был бесполезен. Тем не менее я получаю ошибки. Я сравнил свою схему с другой схемой и ldif файл с другими ldif файлами, я не мог, нашел любые ошибки. Любой помогите мне решить эту проблему.
Моей ОС является Ubuntu 12.04 LTS. Есть ли любая потребность добавить
# global configuration settings dn: cn=config objectClass: olcGlobal cn: config
в ldif файле. Я попробовал его. Но затем также я получил ту же ошибку.
Честно говоря, вся твоя схема - это единственное препятствие.
objectClass
в вашей схеме, вам нужна строка olcObjectClasses:
, с :
в конце. NAME
, а не DESC
, поэтому он должен быть MAY ( genderAttr $ dobAttr
и др. Название 'NationAttr
пропускает закрытие '
zipAttr
ZIP-кодом или PIN-кодом? contactNumber
и interestedIn
вообще не определены, но указаны в строке olcObjectClasses
. Attr
после любого атрибута бесполезен. Понятно, что это атрибут, потому что каким ещё он должен быть? Если вы все это исправите, то в итоге получите что-то вроде файла ниже (все еще отсутствуют контакт и интересы), который легко импортировать (замените 88888
на ваш личный OID номер).
dn: cn=userControl,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: userControl
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.1
NAME 'genderAttr'
DESC 'gender'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.2
NAME 'dobAttr'
DESC 'dateOfBirth'
EQUALITY generalizedTimeMatch
ORDERING generalizedTimeOrderingMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
olcAttributeTypes: (1.3.6.1.4.1.88888.1.1.3
NAME 'languageAttr'
DESC 'languages known'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.4
NAME 'mTongueAttr'
DESC 'motherTongue'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.5
NAME 'nationalityAttr'
DESC 'nationality'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.6
NAME 'worksAtAttr'
DESC 'worksAt'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.7
NAME 'qualificationAttr'
DESC 'qualification'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.8
NAME 'schoolAttr'
DESC 'school'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.9
NAME 'collegeAttr'
DESC 'college'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.10
NAME 'addressAttr'
DESC 'address'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.11
NAME 'zipAttr'
DESC 'pinCode'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
olcObjectClasses: ( 1.3.6.1.4.1.88888.1.2.1
NAME 'userControl'
DESC 'RFC2798: New Customized Schema'
SUP organizationalPerson
STRUCTURAL
MAY (
genderAttr $ dobAttr $ languageAttr $ mTongueAttr $ nationalityAttr $ worksAtAttr $ qualificationAttr $ schoolAttr $ collegeAttr $ addressAttr $ zipAttr)
)