Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1445843
  • 博文数量: 244
  • 博客积分: 3353
  • 博客等级: 中校
  • 技术积分: 3270
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-09 17:56
文章分类

全部博文(244)

文章存档

2023年(7)

2022年(7)

2021年(4)

2020年(1)

2019年(2)

2017年(2)

2016年(3)

2015年(11)

2014年(20)

2013年(10)

2012年(176)

分类:

2012-05-29 00:02:38

原文地址:二.OpenLDAP配置 作者:redflowflag

二.OpenLDAP配置

在安装完openldap之后,我们会在/etc/openldap目录下看到有一个slapd.confldap.conf的文件。

我们首先要做的是称把sambaschema拷贝到/etc/openldap目录下的schema目录里头,然后再修改openldap的配置档

 cp /usr/share/doc/samba-3.0.33/LDAP/samba.schema /etc/openldap/schema

以下是我们修改后的slapd.conf

#

# See slapd.conf(5) for details on configuration options.

# This file should NOT be world readable.

#

include /etc/openldap/schema/core.schema

include /etc/openldap/schema/cosine.schema

include /etc/openldap/schema/inetorgperson.schema

include /etc/openldap/schema/nis.schema

include /etc/openldap/schema/samba.schema #把刚才我们新增的samba.schema加到此处

include /etc/openldap/schema/corba.schema

include /etc/openldap/schema/dyngroup.schema

include /etc/openldap/schema/misc.schema

include /etc/openldap/schema/openldap.schema

# Allow LDAPv2 client connections.  This is NOT the default.

allow bind_v2

# Do not enable referrals until AFTER you have a working directory

# service AND an understanding of referrals.

#referral ldap://root.openldap.org

pidfile /var/run/openldap/slapd.pid

argsfile /var/run/openldap/slapd.args

# Load dynamic backend modules:

# modulepath /usr/lib/openldap

# modules available in openldap-servers-overlays RPM package:

# moduleload accesslog.la

# moduleload auditlog.la

# moduleload denyop.la

# moduleload dyngroup.la

# moduleload dynlist.la

# moduleload lastmod.la

# moduleload pcache.la

# moduleload ppolicy.la

# moduleload refint.la

# moduleload retcode.la

# moduleload rwm.la

# moduleload smbk5pwd.la

# moduleload syncprov.la

# moduleload translucent.la

# moduleload unique.la

# moduleload valsort.la

# modules available in openldap-servers-sql RPM package:

# moduleload back_sql.la

# The next three lines allow use of TLS for encrypting connections using a

# dummy test certificate which you can generate by changing to

# /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on

# slapd.pem so that the ldap user or group can read it.  Your client software

# may balk at self-signed certificates, however.

# TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt

# TLSCertificateFile /etc/pki/tls/certs/slapd.pem

# TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem

# 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!

#######################################################################

# ldbm and/or bdb database definitions

#######################################################################

database bdb

suffix "dc=wlf,dc=org"    #此处定义类似于我人的域名

rootdn "cn=admin,dc=wlf,dc=org" #ldap管理者

# Cleartext passwords, especially for the rootdn, should

# be avoided.  See slappasswd(8) and slapd.conf(5) for details.

# Use of strong authentication encouraged.

#rootpw secret

# rootpw {crypt}ijFYNcSNctBYg

rootpw {SSHA}zuhwhr71Zp2uFizfjUvQFAOZivUxGgdk #设定ldap密码,建议用加密密码,官文可使用slappasswd来取得

# The database directory MUST exist prior to running slapd AND 

# should only be accessible by the slapd and slap tools.

# Mode 700 recommended.

directory /var/lib/ldap

# Indices to maintain for this database

index objectClass                       eq,pres

index ou,cn,mail,surname,givenname      eq,pres,sub

index uidNumber,gidNumber,loginShell    eq,pres

index uid,memberUid                     eq,pres,sub

index nisMapName,nisMapEntry            eq,pres,sub

index sambaSID eq

index sambaPrimaryGroupSID eq

index sambaDomainName  eq

index default sub

# Replicas of this database

#replogfile /var/lib/ldap/openldap-master-replog

#replica host=ldap-1.example.com:389 starttls=critical

#     bindmethod=sasl saslmech=GSSAPI

#     authcId=host/ldap-master.example.com@EXAMPLE.COM

配置完slapd.conf后,我们继续配置ldap.conf

#

# LDAP Defaults

#

# See ldap.conf(5) for details

# This file should be world readable but not world writable.

BASE dc=wlf,dc=org #定义我们的base dn

#URI ldap://ldap.example.com ldap://ldap-master.example.com:666

#SIZELIMIT 12

#TIMELIMIT 15

#DEREF never

URI ldap://127.0.0.1/ #这里是我们的ldap服务器的地址

TLS_CACERTDIR /etc/openldap/cacerts

在配置完openldap后,我们既可以启动我们的ldap server

 /etc/init.d/ldap  start

使用如下命令来验证我们的ldap正常启动

[root@smb1 openldap]# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

# extended LDIF

#

# LDAPv3

# base <> with scope baseObject

# filter: (objectclass=*)

# requesting: namingContexts 

#

#

dn:

namingContexts: dc=wlf,dc=org

# search result

search: 2

result: 0 Success

# numResponses: 2

# numEntries: 1

如果能看到上面的提示,表示服务器已经工作正常。

阅读(1580) | 评论(0) | 转发(0) |
0

上一篇:配置OpenLDAP服务

下一篇:配置ldap

给主人留下些什么吧!~~