2017-03-07 13 views
-1

我将OpenLDAP 2.4安装到CentOS 6服务器。 添加自定义属性和模式 'MYUSER':不允许属性“privateEmail”的等号索引

dn: cn=my,cn=schema,cn=config 
objectClass: olcSchemaConfig 
cn: my 
objectClass: top 
olcAttributeTypes: (331.332.333.1 NAME 'firstName' DESC 'First name of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) 
olcAttributeTypes: (331.332.333.2 NAME 'privateEmail' DESC 'Private email of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.3 NAME 'userOid' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.339.4 NAME 'isTrusted' DESC 'Determines if user is trusted' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.6 NAME 'gender' DESC 'Person gender (M,F or U)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.8 NAME 'privatePhone' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.9 NAME 'otpContact' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.10 NAME 'otpAuthnFlag' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (331.332.333.11 NAME 'lastName' DESC 'Last name of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined') 
olcAttributeTypes: (2.16.840.1.113730.3.1.610 NAME 'nsAccountLock' DESC 'Operational attribute for Account Inactivation' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE) 
olcObjectClasses: (331.332.333.12 NAME 'myUser' DESC 'user for my entity' SUP top STRUCTURAL MUST (uid $ isTrusted $ nsAccountLock $ firstName) MAY (lastName $ userPassword $ privateEmail $ otpContact $ otpAuthnFlag $ privatePhone $ userOid) X-ORIGIN 'user defined') 

尝试添加索引并且得到错误:

# ldapadd -x -W -D cn=config -f /opt/index.ldif 
Enter LDAP Password: 
modifying entry "olcDatabase={2}bdb, cn=config" 
ldap_modify: Other (e.g., implementation specific) error (80) 
     additional info: equality index of attribute "privateEmail" disallowed 

我index.ldif:

dn: olcDatabase={2}bdb, cn=config 
changetype: modify 
add: olcDbIndex 
olcDbIndex: privateEmail eq 
olcDbIndex: privatePhone eq 

回答

0

您使用privateEmail错误的语法OID。您正在使用的是Postal Addresses,并且不支持索引。 See RFC 4517

您应该按照RFC 2798使用1.3.6.1.4.1.1466.115.121.1.26。检查其他人的理智。

+0

我更新了我的ldif以创建属性和架构: 'olcAttributeTypes:(331.332.333.2名称'privateEmail'DESC'私人电子邮件的人'语法1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN'用户定义') Stoped slapd,删除了/etc/openldap/slapd.d/cn=config/cn=schema/cn={12}my.ldif,并重新创建了模式和属性,但错误“ ((( )然而,私人电话的属性也有错误 –

+0

那么你应该使用[private phone] [RFC 4571电话号码](https://tools.ietf.org/html/rfc4517#第3.3.31节)如果你有任何已经包含这些属性的条目,你至少必须清除这些模式更改的属性,可能完全删除条目,也可能是值得检查你的改变模式的蛮力方法是否已经实际生效。你应该通过'ldapmodify'来完成你的原始问题。 – EJP