`
fox.tan
  • 浏览: 63268 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

初试OpenLDAP

    博客分类:
  • LDAP
阅读更多

     由于工作需要,有机会尝试使用LDAP。下面就介绍一下OpenLDAP的安装配置过程。

 

第一步, 查阅文档,下载安装文件

         强烈推荐:http://www.zytrax.com/books/ldap。基本的安装配置看第4章http://www.zytrax.com/books/ldap/ch4/win2k.html#win2k足够了。

 

第二步, 安装

         http://www.zytrax.com/books/ldap/ch4/win2k.html#win2k上有详细的介绍,这里就不说了。

 

第三步, 配置slapd.conf

      首先备份原来的LDAP_HOME/slapd.conf文件, 简单的slapd.conf配置如下:

slapd.conf
##########################################
# 加载哪些 schemas 文件
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema

#########################################
# 下面这些都是默认的配置
# DON'T bother with ARGS file unless you feel strongly
# slapd scripts stop scripts need this to work
pidfile ./run/slapd.pid
argsfile ./run/slapd.args

# enable a lot of logging - we might need it
# but generates huge logs
loglevel -1

#######################################################################
# bdb database definitions
#
# replace example and com below with a suitable domain
#
# If you don't have a domain you can leave it since example.com
# is reserved for experimentation or change them to my and inc
#
#######################################################################

database bdb
# 这个是我们需要配置的。
suffix "dc=example, dc=com"

# 设置LDAP的超级用户密码,用户名admin,密码user@XX2
rootdn "cn=admin, dc=example, dc=com"
rootpw user@XX2
# The database directory MUST exist prior to running slapd AND
# change path as necessary
# LDAP数据保存的路径,自定义的example-com需自己创建。
directory ./data/example-com


#########################################
# 下面这些都是默认的配置
# Indices to maintain for this directory
# unique id so equality match only
index uid eq
# allows general searching on commonname, givenname and email
index cn,gn,mail eq,sub
# allows multiple variants on surname searching
index sn eq,sub
# sub above includes subintial,subany,subfinal
# optimise department searches
index ou eq
# if searches will include objectClass uncomment following
# index objectClass eq
# shows use of default index parameter
index default eq,sub
# indices missing - uses default eq,sub
index telephonenumber

# other database parameters
# read more in slapd.conf reference section
cachesize 10000
checkpoint 128 15
 

第四步, 配置ldif

   首先解释一下LDAP中cn、ou、dc等词。 DC (Domain Component), OU (Organizational Unit) , CN (Common Name). 下面的脚本CN OU DC 各创建了一个。

example.ldif
## DEFINE DIT ROOT/BASE/SUFFIX ####
## uses RFC 2377 format
## replace example and com as necessary below
## or for experimentation leave as is

## dcObject is an AUXILLIARY objectclass and MUST
## have a STRUCTURAL objectclass (organization in this case)
# this is an ENTRY sequence and is preceded by a BLANK line
# 创建一个dc
dn: dc=example,dc=com
dc: example
description: My wonderful company as much text as you want to place
in this line up to 32K continuation data for the line above must
have <CR> or <CR><LF> i.e. ENTER works
on both Windows and *nix system - new line MUST begin with ONE SPACE
objectClass: dcObject
objectClass: organization
o: example, Inc.

## FIRST Level hierarchy - people
## uses mixed upper and lower case for objectclass
# this is an ENTRY sequence and is preceded by a BLANK line
# 创建一个ou
dn: ou=users, dc=example,dc=com
ou: users
description: All people in organisation
objectclass: organizationalunit

## 创建一个用户
dn: cn=QA5,ou=users,dc=example,dc=com
changetype: add
userPassword: a
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
sn: qa5
cn: QA5

## 删除一个用户
dn: cn=QA3,ou=users,dc=example,dc=com
changetype: delete

 

      如果只添加新用户,ldif文件如下:

example-2.ldif 写道
## 创建用户
dn: cn=QA1,ou=users,dc=example,dc=com
changetype: add
userPassword: a
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
sn: qa1
cn: QA1

dn: cn=QA2,ou=users,dc=example,dc=com
changetype: add
userPassword: a
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
sn: qa2
cn: QA2

dn: cn=QA3,ou=users,dc=example,dc=com
changetype: add
userPassword: a
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
sn: qa3
cn: QA3

 

第五步, 导入ldif脚本

     首先需要启动OpenLDAP Service. 成功启动后再命令行中执行以下命令:

cd C:\Program Files\OpenLDAP
C:\Program Files\OpenLDAP>ldapadd -x -D "cn=admin, dc=example, dc=com" -f c:\temp\example.ldif -w user@XX2

 

创建用户
C:\Program Files\OpenLDAP>ldapadd -x -D "cn=admin, dc=example, dc=com" -f c:\temp\example-2.ldif -w user@XX2
adding new entry "cn=QA1,ou=users,dc=example,dc=com"
adding new entry "cn=QA2,ou=users,dc=example,dc=com"
adding new entry "cn=QA3,ou=users,dc=example,dc=com"
 

 

最后,LDAP的数据如下:


 

 

  • 大小: 68.3 KB
分享到:
评论

相关推荐

    OpenLdap安装及配置

    OpenLDAP 安装及配置 OpenLDAP 是一种轻量级目录访问协议(LDAP),它可以提供身份验证、授权和目录服务。OpenLDAP 安装及配置是一个复杂的过程,需要安装 BerkeleyDB、OpenLDAP 服务器,并进行相应的配置。 1. ...

    OpenLdap2.4各版本包

    OpenLDAP(开放轻量目录访问协议)是一种开源的目录服务,用于存储和管理网络资源的信息,如用户账户、组、网络设备等。OpenLDAP 2.4系列是其一个重要且广泛应用的版本,提供了多种功能和改进,以适应不同的操作系统...

    openldap

    OpenLDAP 是一个开源的轻量级目录访问协议(Lightweight Directory Access Protocol)实现,它提供了对目录服务的强大支持。在IT行业中,OpenLDAP 被广泛用于存储和管理组织结构数据,例如用户账户、联系人信息、组...

    windows 下安装和使用OpenLDAP。

    Windows 下安装和使用 OpenLDAP OpenLDAP 是一个开源的 LDAP 服务器实现,它提供了一个轻量级的目录访问协议,基于 X.500 标准,但比 X.500 简洁许多。OpenLDAP 支持 TCP/IP,适合Internet 环境。目录是一个专业的...

    CAS整合OpenLDAP(OpenLDAP已配置好的情况)

    《CAS整合OpenLDAP的详细步骤》 CAS(Central Authentication Service),由 Jasig 组织开发,是一个开源的、基于Java的Web应用,主要用于实现单点登录(Single Sign-On,SSO)。在许多组织中,为了统一管理和认证...

    [openldap]Linux下安装openldap所需要的依赖包,源码安装方式

    db-4.7.25.tar.gz freetype-2.3.5.tar.gz ...openldap-2.4.38.tgz php-5.2.9.tar.gz phpldapadmin-0.9.8.5.tar.gz zlib-1.2.8.tar 包含上述安装包,都是源码包,通过编译安装,在CentOs5.0下运行通过

    openldap-rpm.tar.zip

    包含了openldap的所有依赖 cyrus-sasl-2.1.26-23.el7.x86_64.rpm cyrus-sasl-lib-2.1.26-23.el7.x86_64.rpm cyrus-sasl-devel-2.1.26-23.el7.x86_64.rpm compat-openldap-2.3.43-5.el7.x86_64.rpm openldap-2.4.44...

    windows版的openldap

    OpenLDAP是一款开源的轻量级目录访问协议(Lightweight Directory Access Protocol)服务器,适用于各种操作系统,包括Windows。在Windows环境下安装和配置OpenLDAP对于本地开发和测试是非常有用的,因为它允许...

    windows下搭建并配置OpenLDAP服务器

    在Windows环境下搭建并配置OpenLDAP服务器是一项常见的任务,特别是在企业级环境中,为了实现用户身份验证、数据共享和服务集成。OpenLDAP(Lightweight Directory Access Protocol)是一个开源的LDAP服务器,广泛...

    编译windows版本openldap

    OpenLDAP是一种开源的轻量级目录访问协议(Lightweight Directory Access Protocol)服务器,它提供了对分布式目录服务的支持。在Windows环境下编译OpenLDAP可以让开发者在本地进行定制化开发或者适应特定的系统需求...

    Linux下OpenLDAP的安装软件

    在IT领域,Linux系统是广泛使用的服务器操作系统,而OpenLDAP(OpenLDAP Public License)则是一个开源的轻量级目录访问协议( Lightweight Directory Access Protocol)实现。它提供了组织和存储数据的强大功能,...

    win32 openLdap 2.2.29 安装文件

    OpenLDAP 是一个开源的轻量级目录访问协议(Lightweight Directory Access Protocol)服务器,它用于存储和管理结构化数据,如用户账号、组、网络设备信息等。在Windows环境下,OpenLDAP提供了方便的安装包来简化...

    源码安装openldap2.4.45

    OpenLDAP是一款开源的轻量级目录访问协议(Lightweight Directory Access Protocol)服务器,它提供了对LDAP目录服务的强大支持。在Linux环境下,通过源码安装OpenLDAP可以更好地定制配置以满足特定需求。以下是对...

    Centos7OpenLDAP主从配置

    CentOS 7 OpenLDAP 主从配置 OpenLDAP 是一个开源的轻量级目录访问协议(LDAP)实现,广泛应用于身份验证、授权和目录服务等领域。下面详细介绍 CentOS 7 环境下 OpenLDAP 的主从配置。 OpenLDAP 主从配置环境 在...

    openldap-2.5.4

    OpenLDAP是开源的轻量级目录访问协议(Lightweight Directory Access Protocol)实现,它提供了一个灵活、可扩展的目录服务,用于存储和管理各种类型的数据,如用户账号、组织结构、网络设备信息等。OpenLDAP-2.5.4...

    centos6.7OpenLDAP主从配置

    ### CentOS 6.7 OpenLDAP 主从配置详解 #### 系统环境信息 - **操作系统**: CentOS release 6.7 - **环境准备**: - 关闭防火墙: `/etc/init.d/iptables stop && chkconfig iptables off` - 关闭 NetworkManager:...

    Linux UNIX OpenLDAP实战指南

    《Linux UNIX OpenLDAP实战指南》是一本专注于OpenLDAP在Linux和UNIX系统中应用的专业书籍,由郭大勇撰写。OpenLDAP是一种开源的轻量级目录访问协议(Lightweight Directory Access Protocol)实现,广泛用于组织和...

    OpenLDAP文档.pptx

    OpenLDAP文档 OpenLDAP 是一款轻量级目录访问协议(Lightweight Directory Access Protocol,LDAP),属于开源集中账号管理架构的实现,且支持众多系统版本,被广大互联网公司所采用。OpenLDAP 账号集中管理软件...

    openldap2.4数据同步研究

    ### OpenLDAP2.4数据同步研究 #### 一、概述 OpenLDAP是一个广泛使用的开源LDAP(轻量级目录访问协议)服务实现。随着版本的不断更新,OpenLDAP2.4引入了许多新的特性和改进,其中之一就是对数据同步机制的重大...

Global site tag (gtag.js) - Google Analytics