我有ldif
dn: uniqueIdentifier=user.acc,ou=people,dc=domaine,dc=com
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: PostfixBookMailAccount
objectClass: extensibleObject
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: user.acc
cn: user acc
givenName: acc
uidNumber: 2000
gidNumber: 5002
loginShell: /bin/bash
homeDirectory: /home/user
mail: user.acc@domaine.com
mailEnabled: TRUE
mailGidNumber: 5000
我试图使用以下命令配置ldap服务器:
ldapadd -W -D "cn=admin,dc=domaine,dc=com" -f userimport.ldif
它给了我错误
ldap_add: Invalid syntax (21)
additional info: objectClass: value #3 invalid per syntax
这是我使用的配置
cd /etc/ldap/schema
wget http://www.postfix-buch.com/download/postfix-book.schema.gze
gunzip postfix-book.schema.gz
cd /etc/ldap/schema
mkdir ldif_output
touch schema_convert.conf
schema_convert.conf文件包含要转换的模式(以及任何依赖项):
include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/postfix-book.schema
最后,在postfix-book.ldif中,需要进行以下更改:
dn: cn=postfix-book,cn=schema,cn=config
cn: postfix-book
从structuralObjectClass开始删除元数据 然后将其添加到目录中,如下所示:
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f postfix-book.ldif
文件postfix-book.ldif包含PostfixBookMAilAccount的模式:
olcObjectClasses: {0}( 1.3.6.1.4.1.29426.1.2.2.1
NAME 'PostfixBookMailAccount'
DESC 'Mail account used in Postfix Book'
SUP top AUXILIARY
MUST mail
MAY ( mailHomeDirectory $ mailAlias $ mailGroupMember $ mailUidNumber $ mailGidNumber $ mailEnabled $ mailQuota $ mailStorageDirectory ) )
这里是文件postfix-book.schema
enter code here
# $Id$
#
# State of Mind
# Private Enterprise Number: 29426
#
# OID prefix: 1.3.6.1.4.1.29426
#
# Attributes: 1.3.6.1.4.1.29426.1.10.x
#
attributetype ( 1.3.6.1.4.1.29426.1.10.1 NAME 'mailHomeDirectory'
DESC 'The absolute path to the mail user home directory'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.29426.1.10.2 NAME 'mailAlias'
DESC 'RFC822 Mailbox - mail alias'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
attributetype ( 1.3.6.1.4.1.29426.1.10.3 NAME 'mailUidNumber'
DESC 'UID required to access the mailbox'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.29426.1.10.4 NAME 'mailGidNumber'
DESC 'GID required to access the mailbox'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.29426.1.10.5 NAME 'mailEnabled'
DESC 'TRUE to enable, FALSE to disable account'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.29426.1.10.6 NAME 'mailGroupMember'
DESC 'Name of a mail distribution list'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.29426.1.10.7 NAME 'mailQuota'
DESC 'Mail quota limit in kilobytes'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.29426.1.10.8 NAME 'mailStorageDirectory'
DESC 'The absolute path to the mail users mailbox'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
#
# Objects: 1.3.6.1.4.1.29426.1.2.2.x
#
objectclass ( 1.3.6.1.4.1.29426.1.2.2.1 NAME 'PostfixBookMailAccount'
SUP top AUXILIARY
DESC 'Mail account used in Postfix Book'
MUST ( mail )
MAY ( mailHomeDirectory $ mailAlias $ mailGroupMember
$ mailUidNumber $ mailGidNumber $ mailEnabled
$ mailQuota $mailStorageDirectory ) )
objectclass ( 1.3.6.1.4.1.29426.1.2.2.2 NAME 'PostfixBookMailForward'
SUP top AUXILIARY
DESC 'Mail forward used in Postfix Book'
MUST ( mail $ mailAlias ))
并感谢您的帮助