OpenLDAP安装与配置
系统:ubuntu 14.04
安装:
1. sudo apt-get install slapd ldap-utils
2. 在1的过程中会让你输了admin密码
配置:
如果安装过,只是想配置OpenLDAP,可以运行 sudo dpkg-reconfigure slapd
配置分三种,1使用LDIF配置,2使用slapd.conf配置,3使用目录中的/etc/ldap/slapd.d/配置
1. LDIF配置,格式如下:
# global configuration settings
dn: cn=config
objectClass: olcGlobal
cn: config
<global config settings>
# schema definitions
dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema
<system schema>
dn: cn={X}core,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: {X}core
<core schema>
# additional user-specified schema
...
# backend definitions
dn: olcBackend=<typeA>,cn=config
objectClass: olcBackendConfig
olcBackend: <typeA>
<backend-specific settings>
# database definitions
dn: olcDatabase={X}<typeA>,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {X}<typeA>
<database-specific settings>
# subsequent definitions and settings
...
这里给出一个样例,如下:
### backend.ldif ###
# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb.la # Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=example,dc=com
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=Manager,dc=example,dc=com
olcRootPW: secret
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn="cn=Manager,dc=example,dc=com" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=Manager,dc=example,dc=com" write by * read
### end backend.ldif ###
然后运行如下命令使配置生效:
ldapadd -Y EXTERNAL -H ldapi:/// -f backend.ldif
2. slapd.conf配置
/etc/ldap/slapd.d 是2.4.x版本新采用的配置文件目录,但手动编辑slapd.d目录下ldif是非常痛苦的,如果你不习惯新的配置目录格式,你可以通过修改/etc/default/slapd中的SLAPD_CONF=为SLAPD_CONF="/etc/ldap/slapd.conf"。
slapd.conf配置形式官方已经废弃了但依然支持,你还可以选择在编辑完熟悉的slapd.conf后使用openldap提供的slaptest工具将它转换成slapd.d配置目录:
mv /etc/ldap/slapd.d <path>/slapd.d #备份原目录
cp /usr/share/slapd/slapd.conf /etc/ldap/
cd /etc/ldap/
vim slapd.conf #配置ldap
slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d/ #把修改好的sldapd.conf转换成slapd.d/的配置形式
chown -R openldap:openldap /etc/ldap/slapd.d/ #修改转换好的slapd.d/的用户和组
slapd.conf配置修改样例:
5. # BDB definition for the example.com
6. database bdb
7. suffix "dc=example,dc=com"
8. directory /usr/local/var/openldap-data
9. rootdn "cn=Manager,dc=example,dc=com"
10. rootpw secret
11. # indexed attribute definitions
12. index uid pres,eq
13. index cn,sn pres,eq,approx,sub
14. index objectClass eq
15. # database access control definitions
16. access to attrs=userPassword
17. by self write
18. by anonymous auth
19. by dn.base="cn=Admin,dc=example,dc=com" write
20. by * none
21. access to *
22. by self write
23. by dn.base="cn=Admin,dc=example,dc=com" write
24. by * read
参考:The slapd Configuration File
上面例子中rootpw都是明文显示的,也可以加密存储:
$ slappasswd -h {SHA} -s secret
{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=
用{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=代替secret即可。
1. backend & database
ldap的后台进程slapd接收、响应请求,但实际存储数据、获取数据的操作是由Backends做的,而数据是存放在database中,所以你可以看到往往你可以看到backend和database指令是一样的值如 bdb 。一个 backend 可以有多个 database instance,但每个 database 的 suffix 和 rootdn 不一样。openldap 2.4版本的模块是动态加载的,所以在使用backend时需要moduleload back_bdb指令。
bdb是一个高性能的支持事务和故障恢复的数据库后端,可以满足绝大部分需求。许多旧文档里(包括官方)说建议将bdb作为首选后端服务(primary backend),但2.4版文档明确说hdb才是被首先推荐使用的,这从 2.4.40 版默认安装后的配置文件里也可以看出。hdb是基于bdb的,但是它通过扩展的索引和缓存技术可以加快数据访问,修改entries会更有效率,有兴趣可以访问上的链接或slapd.backends。
另外config是特殊的backend,用来在运行时管理slapd的配置,它只能有一个实例,甚至无需显式在slapd.conf中配置。
OpenLDAP安装与配置的更多相关文章
- OpenLDAP 安装及配置 笔记
首先下载 OpenLdap(Ldap服务器) 和 LdapAdmin(客户端) 两个软件 OpenLDAPforWindows_2.4.39.part1.rar OpenLDAPforWindows_ ...
- OpenLDAP编译安装及配置
原文发表于cu:2016-06-20 参考文档: 原理:http://seanlook.com/2015/01/15/openldap_introduction/ 官方文档: http://www.o ...
- CentOS 7下OpenLDAP编译安装及配置
一.环境 Server:基于CentOS-7-x86_64-1511 Server IP: 172.18.12.203 二.软件获取 OpenLDAP OpenLDAP官网下载地址:http://ww ...
- OpenLDAP安装
参考: http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%85 ...
- linux学习之centos(三):mysql数据库的安装和配置
前言:mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库, ...
- ldap服务器OpenLDAP安装使用
OpenLDAP 是 LDAP 协议的一个开源实现.LDAP 服务器本质上是一个为只读访问而优化的非关系型数据库.它主要用做地址簿查询(如 email 客户端)或对各种服务访问做后台认证以及用户数据权 ...
- 2.openldap安装
1.安装步骤如下 获取软件包 安装软件包(rpm或者源码编译) 生产openldap配置文件及数据库文件 配置 添加目录树条目 加载slapd进程 验证 2.所需安装包说明 openldap,open ...
- 【JMeter4.0】之 “jdk1.8、JMeter4.0” 安装与配置以及JMeter永久汉化和更改界面背景、并附加附录:个人学习总结
目录: 一.首先,需要安装.配置jdk 二.其次,安装.配置JMeter 三.JMeter汉化以及更改界面背景 四.附录:个人学习总结 一.首先,需要安装.配置jdk 返回目录 1.到官网下载1. ...
- OpenLDAP 安装教程
OpenLDAP 安装教程 本文原始地址:https://sitoi.cn/posts/48217.html 在centos7上安装OpenLDAP 环境准备 两台虚拟机 node01 IP:192. ...
随机推荐
- aop代理方式引起的spring注入bean(实现类)与获取bean(实现类)出错
描述: 现象一 :A 为 接口,AImpl 为 A 的实现类,且 AImpl 受 aop 扫描,且 aop 无特殊配置 此时若:Spring 中 注入 AImpl 类型的bean,获取一样 ...
- 在线预览pdf、xlsx、docx、ppt等文档
使用微软提供的Office Online平台只需要一个网址即可在线查看Xls,doc,PPT等文档 http://view.officeapps.live.com/op/view.aspx?src=要 ...
- 关于python的元类
当你创建一个类时: class Foo(Bar): pass Python做了如下的操作: Foo中有__metaclass__这个属性吗?如果是,Python会在内存中通过__metaclass__ ...
- Socket.io 延伸
项目正好用到了即时通讯功能,于是研究到了webSocket技术,后来发现了可以在web.[Android].[iOS]上同时使用的解决方案,那就是SocketIO.其实现原理啥的不做介绍了,直接贴上I ...
- log4j2
转载自 Blog of 天外的星星: http://www.cnblogs.com/leo-lsw/p/log4j2tutorial.html Log4j 2的好处就不和大家说了,如果你搜了2,说明你 ...
- java-成员方法/变量、类方法/变量等区别
方法 成员方法 成员方法也叫实例方法.必须先有实例即对象,然后才能通过实例调用该实例方法. 类方法 和类变量一样,有关键字static修饰,可以不用实例,直接用类就可以调用类方法. 变量 成员变量 也 ...
- ggplot2 theme相关设置—线条设置
在ggplot的主题射中有一部分图需要对图中的部分线条进行设置 element_line(colour = NULL, size = NULL, linetype = NULL, lineend = ...
- hdu_5286_wyh2000 and sequence(分块)
题目链接:hdu_5286_wyh2000 and sequence 题意: 给一段长度为N的序列,每次询问l-r(l和r和上一次询问的答案有关)内 不同的数的 出现次数的次方 的和.强制在线 题解: ...
- webapi中的扩展点
Extension Points Web API provides extension points for some parts of the routing process. Interface ...
- LeetCode OJ 11. Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...