码迷,mamicode.com
首页 > 其他好文 > 详细

ldap添加自定义字段

时间:2016-06-30 23:45:57      阅读:2937      评论:0      收藏:0      [点我收藏+]

标签:ldap添加自定义字段

因项目原因,需要在LDAP中配置inetOrgPerson对象类的两个自定义属性。

  • isAbsent 128字符内的字符串,单值

  • substitutes 128字符内的字符串,多值


参阅了OpenLdap的管理文档以及网上的实例之后,解决方案如下:

编辑OpenLDAP的模式定义文件inetorgperson.schema,增加属性定义

attributetype ( 2.16.840.1.113730.3.1.900
  NAME ‘isAbsent‘
  DESC ‘whether the person is absent from work‘
  EQUALITY caseIgnoreMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128}
  SINGLE-VALUE )

attributetype ( 2.16.840.1.113730.3.1.901
  NAME ‘substitutes‘
  DESC ‘people substitutes when absent‘
  EQUALITY caseIgnoreMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )


其中2.16.840.1.113730.3.1.900和901是选择未被使用的OID(不知道有没有被使用过?google下吧),而1.3.6.1.4.1.1466.115.121.1.15则是字符串类型的语法。

在inetOrgPerson类中启用这2个属性

objectclass  ( 2.16.840.1.113730.3.2.2
        NAME ‘inetOrgPerson‘
  DESC ‘RFC2798: Internet Organizational Person‘
        SUP organizationalPerson
        STRUCTURAL
  MAY (
...
    isAbsent $ substitutes )
  )

在slapd.conf中启用inetorgperson.schema

#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
ucdata-path  ./ucdata
include    ./schema/core.schema
include    ./schema/cosine.schema
include    ./schema/inetorgperson.schema
include    ./schema/nis.schema

重新启动LDAP服务之后一切搞定。


ldap添加自定义字段

标签:ldap添加自定义字段

原文地址:http://chentianwang.blog.51cto.com/9250930/1794626

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!