OpenLDAP主配置文件slapd.conf介绍

安全起见,slapd.conf文件应该只让运行此进程的用户可读写。下面是安装完毕后的一个slapd.conf示例。
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/openldap/schema/core.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /usr/local/openldap/var/run/slapd.pid
argsfile /usr/local/openldap/var/run/slapd.args
# Load dynamic backend modules:
# modulepath /usr/local/openldap/libexec/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!
####################################################
# BDB database definitions
####################################################
database bdb
suffix "dc=my-domain,dc=org"
rootdn "cn=Manager,dc=mydomain,dc=org"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 reorgmended.
directory /usr/local/openldap/var/openldap-data
# Indices to maintain
index objectClass eq
接下来我们对上述部分进行一些介绍:
include /etc/openldap/openldap/schema/core.schema
此 句是用来将目录所用到的schema文件包含进来;openldap一般默认带有几个schema,在我们的配置文件安装目录下的schema目录中存 放。本句中的core.schema是LDAP V3中必须的,它给出了LDAP V3中最基本的attribute和objects的定义。其它的还有:corba.schema、dyngroup.schema、 java.schema nis.schema、openldap.schema、cosine.schema、 inetorgperson.schema、misc.schema、ppolicy.schema
pidfile /usr/local/openldap/var/run/slapd.pid
此句用来定义slapd进程运行时的pid文件,需要使用绝对路径。
argsfile /usr/local/openldap/var/run/slapd.args
此句用来定义包含当前正在运行的slapd进程所用到的命令行参数的文件,需要使用绝对路径。
# Load dynamic backend modules:
# modulepath /usr/local/openldap/libexec/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la
以上用来指定动态加载的后端模块。
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
以上是安全相关的声明语句。常用到的参数有五类,除了Require和security外还有Allow、Disallow和password-hash等。
Require参数用来使管理员指定访问目录时必须遵循的规则和条件;这种指定可以是全局的,也可以仅用来限制对某个后端数据库的访问限制。
security参数用来让管理员指定加强安全性的一般规则。
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!
以上主要是用来定义访问控制列表。
#######################################################################
# BDB database definitions
#######################################################################
database bdb
定义使用的后端数据存储方式。其后可以跟的值有bdb、ldbm、passwd和shell。bdb指使用Berkley DB 4数据库。
suffix "dc=my-domain,dc=org"
定义suffix,以上部分可以改作你的域名中相关的部分,如"dc=example,dc=com"。
rootdn "cn=Manager,dc=mydomain,dc=org"
定义此目录的超级管理员帐号,类同于系统中的root。由于访问控制对此用户是不生效的,因此存在很大的安全隐患。建议安装配置及调试完成以后移除此帐号。
rootpw secret
定 义超级管理员帐号的密码,这里使用的是明文存储(secret即是其密码)的方式。这是极不安全的,建议使用加密方式存储,可以使用的加密方式有: CRYPT、MD5、SMD5、SHA和SSHA。产生加密密码散列的方法是使用slappasswd命令,用-h选项指明加密时使用的方式。示例如下:
# /usr/local/openldap/sbin/slappasswd -h {SSHA}
New password:
Re-enter new password:
{SSHA}k2H1GPM/95VfgsKg2jZv9hV+2GCH04hC
directory /usr/local/openldap/var/openldap-data
这一句用来指定目录相关数据的存放位置。此目录最好只能由运行slapd进程的用户所有,推荐权限为700
index objectClass eq
此 句用来指定slapd索引时用到的attribute,eq指索引时的匹配规则。主要是用来优化查询的。常用到的匹配规则有:approx(模糊匹配, approximate)、eq(精确匹配,equality)、pres(现值匹配,若某记录的此attribute没有值则不进行匹配, presence)和sub (子串匹配,substring)。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值