歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 車干子的openldap的詳細配置

車干子的openldap的詳細配置

日期:2017/2/27 9:52:00   编辑:更多Linux
我剛剛配完openldap具體如下:
安裝軟件包需要注意的問題
編譯
編譯和優化
清除不必要的文件

配置
配置“/etc/ldap/slapd.conf”文件
配置“/etc/rc.d/init.d/ldap”腳本文件
更多的資料

保證OpenLDAP的安全
使得重要的配置文件不可改變

OpenLDAP的創建和維護工具
離線創建數據庫
IDIF輸入文件(用文本表示的輸入文件)
為LDAP創建數據庫
ldapmodify

OpenLDAP的用戶工具
搜索LDAP的數據項

安裝到系統中的文件

概述
LDAP(Lightweight Directory Access Protocol)是用來訪問信息服務的標准協議。這個協議是用在Internet傳輸協議上,如:TCP,能夠訪問單獨的目錄服務或X.500目錄。

注意事項

下面所有的命令都是Unix兼容的命令。
源路徑都為“/var/tmp”(當然在實際情況中也可以用其它路徑)。
安裝在RedHat Linux 6.1下測試通過。
要用“root”用戶進行安裝。
OpenLDAP的版本號是1_2_8。

軟件包的來源
OpenLDAP的主頁:http://www.openldap.org/。

下載:openldap-1_2_8.tgz。

安裝軟件包需要注意的問題
最好在編譯前和編譯後都做一張系統中所有文件的列表,然後用“diff”命令去比較它們,找出其中的差別並知道到底把軟件安裝在哪裡。只要簡單地在編譯之前運行一下命令“find /* >ldap1”,在編譯和安裝完軟件之後運行命令“find /* > ldap2”,最後用命令 “diff ldap1 ldap2 > ldap”找出變化。

編譯
把軟件包(tar.gz)解壓縮:

[root@deep]# cp openldap-version.tgz /var/tmp
[root@deep]# cd /var/tmp/
[root@deep]# tar xzpf openldap-version.tgz

編譯和優化
轉到OpenLDAP的新目錄下。

編輯“string.h”文件(vi +52 include/ac/string.h),刪掉這些幾行:

#else
/* some systems have strdup(), but fail to declare it */
extern char *(strdup)();

上面的這幾行對Linux系統是沒有用的必須刪掉。

下面設置編譯器的編譯參數:

CC="egcs"
CFLAGS="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-
pointer -fno-exceptions"
./configure
--prefix=/usr
--libexecdir=/usr/sbin
--localstatedir=/var/run
--sysconfdir=/etc
--enable-shared
--with-gnu-ld

這些編譯參數告訴編譯器如何編譯OpenLDAP:

l 編譯共享庫
l 假定C編譯器使用GNU ld

開始編譯:

[root@deep]# make depend
[root@deep]# make
[root@deep]# cd tests/
[root@deep]# make
[root@deep]# cd ..
[root@deep]# make install

“make depend” 命令編譯必要的相關文件,“make”把源文件編譯成可執行的二進制文件。“make install”把二進制文件和相關的配置文件安裝到相應的目錄中去。在“test”目錄下的“make”命令在安裝LDAP服務器之前進行一些必要的測試保證軟件安裝完成後能正常運行。如何測試失敗在繼續安裝之前先要解決這些問題。

[root@deep]# install -d -m 700 /var/ldap



[root@deep]# echo localhost > /etc/openldap/ldapserver
[root@deep]# strip /usr/lib/liblber.so.1.0.0
[root@deep]# strip /usr/lib/libldap.so.1.0.0
[root@deep]# strip /usr/lib/libldap.a
[root@deep]# strip /usr/lib/liblber.a
[root@deep]# strip /usr/sbin/in.xfingerd
[root@deep]# strip /usr/sbin/go500
[root@deep]# strip /usr/sbin/go500gw
[root@deep]# strip /usr/sbin/mail500
[root@deep]# strip /usr/sbin/rp500
[root@deep]# strip /usr/sbin/fax500
[root@deep]# strip /usr/sbin/rcpt500
[root@deep]# strip /usr/sbin/slapd
[root@deep]# strip /usr/sbin/ldif2ldbm
[root@deep]# strip /usr/sbin/ldif2index
[root@deep]# strip /usr/sbin/ldif2id2entry
[root@deep]# strip /usr/sbin/ldif2id2children
[root@deep]# strip /usr/sbin/ldbmcat
[root@deep]# strip /usr/sbin/ldif
[root@deep]# strip /usr/sbin/centipede
[root@deep]# strip /usr/sbin/ldbmtest
[root@deep]# strip /usr/sbin/slurpd
[root@deep]# strip /usr/bin/ud
[root@deep]# strip /usr/bin/ldapadd
[root@deep]# strip /usr/bin/ldapsearch
[root@deep]# strip /usr/bin/ldapmodify
[root@deep]# strip /usr/bin/ldapmodrdn
[root@deep]# strip /usr/bin/ldappasswd
[root@deep]# strip /usr/bin/ldapdelete

上面的“install”命令在“/var”目錄下創建一個名為“ldap”的新目錄並且把它的屬性設成只能被超級用戶“root”讀、寫和執行。

“strip”命令清除目標文件中所有的符號信息,這樣可執行文件就會更小,能夠提高一點程序的性能。

清除不必要的文件
用下面的命令刪除不必要的文件:

[root@deep]# cd /var/tmp
[root@deep]# rm -rf ldap openldap-version.tgz

“rm”命令刪除所有編譯和安裝OpenLDAP所需要的源程序,並且把“/var/tmp”目錄下的OpenLDAP軟件的壓縮包刪除掉。

配置
可以到這去下載“floppy.tgz”文件:http: //pages.infinit.net/lotus1/doc/opti/floppy.tgz。把“floppy.tgz”文件解開之後,可以在相應的目錄下發現我們在這本書中介紹的所有軟件的配置文件。這樣就沒有必要手工重新生成這些文件,或者用拷貝粘貼的方法把它們粘貼到配置文件中去。不管是打算自己動手生成配置文件還是拷貝現成的,你都要學會自己修改配置文件並且把配置文件拷貝到正確的目錄下。下面將具體說明。

為了運行OpenLDAP,必須創建或者把下面的文件拷貝到相應的目錄下:

l 把“slapd.conf”文件拷貝到“/etc/openldap”目錄下
l 把“ldap”文件拷貝到“/etc/rc.d/init.d”目錄下

可以把“floppy.tgz”解壓之後,找到上面列出來的文件,並拷貝到“/etc/ssh”目錄下,或者用拷貝粘貼的方法從本書中直接粘貼出。

配置“/etc/ldap/slapd.conf”文件
“/etc/openldap/slapd.conf”文件是LDAP服務器最重要的配置文件,配置權限、口令、數據庫類型和數據庫位置等等。

編輯“slap.conf”文件(vi /etc/openldap/slapd.conf)加入:

#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/slapd.at.conf
include /etc/openldap/slapd.oc.conf
schemacheck off
#referral ldap://ldap.itd.umich.edu
pidfile /var/run/slapd.pid
argsfile /var/run/slapd.args
###################################################
# ldbm database definitions
###################################################
database ldbm
suffix "o=openarch, c=com"
directory /var/ldap
rootdn "cn=admin, o=openarch, c=com"
rootpw secret
# cleartext passWords, especially for the rootdn, should


# be avoid. See slapd.conf(5) for details.
# ldbm indexed attribute definitions
index cn,sn,uid
index objectclass pres,eq
index default none
# ldbm access control definitions
defaultaccess read
access to attr=userpassword
by self write
by dn="cn=admin, o=openarch, c=com" write
by * compare

下面解釋一下上面配置文件中的一些設置:

suffix “o=openarch, c=com”

suffix(後綴)設置想要創建的子樹的根的DN(distinguished name)。換句話說,就是表示數據庫中到底放些什麼。

directory /var/ldap

設置LDAP數據庫和索引文件所在的目錄。必須設置為“/var/ldap”因為我們在安裝階段已經指定了LDAP的後台數據庫。

rootdn “cn=admin, o=openarch, c=com”

設置管理LDAP目錄的超級用戶的DN。這個用戶名(admin)並不要出現在“/etc/passwd”文件裡。

rootpw secret

設置這個數據庫的超級用戶的口令驗證方式。也就是上面“rootdn”設置的用戶的口令。千萬不要用明文進行口令驗證,一定要用加密的口令。

index cn,sn,uid index objectclass pres,eq index default none

這三句設置在數據庫中創建和維護怎樣的索引。“index cn,sn,uid)為cn、sn和uid屬性創建和維護索引, “index objectclass pres,eq”為objectclass屬性創建相等索引(equality indexes), “index default none”表示不為別的屬性創建索引。查看用戶手冊可以得到更多的信息。

“slapd.conf”文件中的最後一部分是和LDAP目錄的訪問控制相關的。

defaultaccess read
access to attr=userpassword
by self write
by dn="cn=admin, o=openarch, c=com" write
by * compare

這些設置對“o=openarch,c=com”子樹中的所有項都是有效的。任何人都有讀的權限,除了“userpasswd”屬性擁有這一項的用戶可以改變其它所有的屬性。“userpassword”屬性只能被admin修改,但是任何人都可以比較。查看用戶手冊可以得到更多的信息。

配置“/etc/rc.d/init.d/ldap”腳本文件
配置“/etc/rc.d/init.d/ldap”腳本文件用來啟動和停止ldap服務。

創建“ldap”腳本文件(toUCh /etc/rc.d/init.d/ldap)並加入:

#!/bin/sh
#
# ldap This shell script takes care of starting and stopping
# ldap servers (slapd and slurpd).
#
# chkconfig: - 70 40
# description: LDAP stands for Lightweight Directory Access Protocol, used
# for implementing the industry standard directory services.
# processname: slapd
# config: /etc/openldap/slapd.conf
# pidfile: /var/run/slapd.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/slapd ] exit 0
[ -f /usr/sbin/slurpd ] exit 0
RETVAL=0
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting ldap: "
daemon slapd
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
if grep -q "^replogfile" /etc/openldap/slapd.conf; then
daemon slurpd
RETVAL=$?
[ $RETVAL -eq 0 ] && pidof slurpd cut -f 1 -d " " > /var/run/slurpd
fi
fi
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ldap
;;
stop)
# Stop daemons.
echo -n "Shutting down ldap: "
killproc slapd
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
if grep -q "^replogfile" /etc/openldap/slapd.conf; then
killproc slurpd
RETVAL=$?
fi
fi
echo
if [ $RETVAL -eq 0 ]; then


rm -f /var/lock/subsys/ldap
rm -f /var/run/slapd.args
fi
;;
status)
status slapd
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
if grep -q "^replogfile" /etc/openldap/slapd.conf; then
status slurpd
RETVAL=$?
fi
fi
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
reload)
killproc -HUP slapd
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
if grep -q "^replogfile" /etc/openldap/slapd.conf; then
killproc -HUP slurpd
RETVAL=$?
fi
fi
;;
*)
echo "Usage: $0 startstoprestartstatus}"
exit 1
esac
exit $RETVAL

使得腳本可執行並改變它的權限:

[root@deep]# chmod 700 /etc/rc.d/init.d/ldap

在rc.d目錄中創建OpenLDAP腳本的符號鏈接:

[root@deep]# chkconfig --add ldap

當重新引導系統的時候,OpenLDAP腳本不會自動啟動slapd腳本。可以用下面的命令讓它可以自動啟動:

[root@deep]# chkconfig --level 345 ldap on

用下面的命令也可以手工啟動OpenLDAP服務器:

[root@deep]# /etc/rc.d/init.d/ldap start

更多的資料
如果想查找詳細的資料可以用man命令查幫助頁,讀取相關信息:

$ man ldapd ( - LDAP X.500 Protocol Daemon
$ man ldapdelete (1) - ldap delete entry tool
$ man ldapfilter.conf (5) - configuration file for LDAP get filter routines
$ man ldapfriendly (5) - data file for LDAP friendly routines
$ man ldapmodify, ldapadd (1) - ldap modify entry and ldap add entry tools
$ man ldapmodrdn (1) - ldap modify entry RDN tool
$ man ldappasswd (1) - change the password of an LDAP entry
$ man ldapsearch (1) - ldap search tool
$ man ldapsearchprefs.conf (5) - configuration file for LDAP search preference routines
$ man ldaptemplates.conf (5) - configuration file for LDAP display template routines
$ man ldif (5) - LDAP Data Interchange format
$ man slapd ( - Stand-alone LDAP Daemon
$ man slapd.conf (5) - configuration file for slapd, the stand-alone LDAP daemon
$ man slurpd ( - Standalone LDAP Update Replication Daemon
$ man ud (1) - interactive LDAP Directory Server query program

保證OpenLDAP的安全
使得重要的配置文件不可改變
設置不可改變位可以避免需要保護的文件被意外的刪除或者覆蓋。也可以防止有人創建這個文件的符號鏈接。一旦“slapd.conf”文件配置完成了之後,用下面的命令設置不可改變位:

[root@deep]# chattr +i /etc/openldap/slapd.conf

OpenLDAP的創建和維護工具
離線創建數據庫
如果一下子要創建成千上萬的項(entry),用這個方法最合適了,因為用“ldapadd”命令逐個添加要花費相當長的時間。這個工具讀取slapd的配置文件和用文本表示的包含所有需要添加的項的輸入文件。“ldif2ldbm”的命令語法如下:

[root@deep]# ldif2ldbm -i -f

表示純文本的LDIF輸入文件的文件名。表示slapd配置文件的文件名,這個配置文件設置在什麼地方創建索引、創建什麼索引,等等。

例如:

[root@deep]# ldif2ldbm -i my-data-file -f /etc/openldap/slapd.conf

純文本的輸入文件的文件名為“my-data-file”

注意:離線創建數據庫的時候slapd daemon不能運行。

IDIF輸入文件(用文本表示的輸入文件)
第一次安裝OpenLDAP必須把大量的數據存入OpenLDAP的數據庫裡。最好把這些數據都用純文本的文件表示出來,再用下面的命令把數據加入OpenLDAP數據庫中。

創建“my-data-file”文件(touch /tmp/my-data-file),下面加入的這些行可以作為參考:

dn: o=openarch, c=com
o: openarch
objectclass: organization
dn: cn=Ronald Smith, o=openarch, c=com
cn: Ronald Smith
sn: Smith
telephonenumber: (480) 757-5856
title: Operator.
objectclass: top



objectclass: person
dn: cn=Anthony Bay, o=openarch, c=com
cn: Anthony Bay
sn: Bay
homephone: (410) 896-3786
mobile: (410) 833-0590
mail: [email protected]
objectclass: top
objectclass: person
dn: cn=George Parker, o=openarch, c=com
cn: George Parker
sn: Parker
telephonenumber: (414) 389-5695
fax: (414) 778-8785
mobile: (414) 470-8669
description: E-Commerce.
objectclass: top
objectclass: person

上面的例子文件讓你了解了如何把數據庫中的信息裝成純文本的信息,再把這些信息加入OpenLDAP數據庫中。還有很多的設置選項可以滿足你的需要,請查看OpenLDAP的文檔或書籍,以獲得更多的信息。

為LDAP創建數據庫
就像可以往數據庫中加入記錄那樣,也可以用“ldapadd”命令在LDAP中加入項。例如:用“ldapadd”命令加入“Europe Mourani”這一項,先要創建“/tmp/newentry”文件:

創建“newentry”文件(touch /tmp/newentry),在文件中加入下面的內容:

cn=Europe Mourani, o=openarch, c=com
cn=Europe Mourani
sn=Mourani
[email protected]
description=Marketing relation.
objectClass=top
objectClass=person

用下面的命令在LDAP中加入這一項:

[root@deep]# ldapadd -f /tmp/newentry -D "cn=admin, o=openarch, c=com" -W

Enter LDAP Password :

上面的命令假定在配置文件中設置“rootdn”為“cn=admin, o=openarch, c=com”,“rootpw”設置為“secret”。命令還會提示輸入口令。

ldapmodify
“ldapmodify”命令建立到LDAP服務器的連接,綁定、修改和加入數據項。通過使用“-f”參數可以設置從標准輸入還是文件中得到數據項的信息。

用於“ldapmodify”命令的輸入文件的格式:

假定“/tmp/entry”文件存在,而且文件的內容是:

cn=Europe Mourani, o=openarch, c=com
- [email protected] # will delete the old mail address for Europe Mourani in the database.
[email protected] # will add the new mail address for Europe Mourani in the database.

用下面的命令改變LDAP中的數據項:

[root@deep]# ladpmodify -D ‘cn=Admin, o=openarch, c=com’ -W -f

這個命令改變了“Europe Mourani”數據項的mail屬性,把這個屬性值改為:[email protected]

OpenLDAP的用戶工具
下面列出的是一些我們經常要用到的命令,當然還有很多其它的命令,更詳細的信息可以查看man幫助頁或其它文檔。

搜索LDAP的數據項
“ldapsearch”命令建立到LDAP服務器的連接、綁定並用過濾器進行搜索。

用下面的命令搜索LDAP數據庫中的數據項:

[root@deep]# ldapsearch -b
[root@deep]# ldapsearch -b ‘o=openarch.com’ ‘cn=a*’

這個命令把所有以字母“a”開頭的數據項的信息顯示在道標准輸出上。

安裝到系統中的文件
> /etc/openldap
> /etc/openldap/ldap.conf
> /etc/openldap/ldap.conf.default
> /etc/openldap/ldapfilter.conf
> /etc/openldap/ldapfilter.conf.default
> /etc/openldap/ldaptemplates.conf
> /etc/openldap/ldaptemplates.conf.default
> /etc/openldap/ldapsearchprefs.conf
> /etc/openldap/ldapsearchprefs.conf.default
> /etc/openldap/slapd.conf
> /etc/openldap/slapd.conf.default
> /etc/openldap/slapd.at.conf
> /etc/openldap/slapd.at.conf.default
> /etc/openldap/slapd.oc.conf
> /etc/openldap/slapd.oc.conf.default
> /etc/openldap/ldapserver
> /etc/rc.d/init.d/ldap
> /etc/rc.d/rc0.d/K40ldap
> /etc/rc.d/rc1.d/K40ldap
> /etc/rc.d/rc2.d/K40ldap
> /etc/rc.d/rc3.d/S70ldap
> /etc/rc.d/rc4.d/S70ldap
> /etc/rc.d/rc5.d/S70ldap
> /etc/rc.d/rc6.d/K40ldap
> /usr/bin/ud


> /usr/bin/ldapsearch
> /usr/bin/ldapmodify
> /usr/bin/ldapdelete
> /usr/bin/ldapmodrdn
> /usr/bin/ldappasswd
> /usr/bin/ldapadd
> /usr/include/ldap.h
> /usr/include/lber.h
> /usr/include/ldap_cdefs.h
> /usr/man/man3/ldap_open.3
> /usr/man/man3/ldap_errlist.3
> /usr/man/man3/ldap_err2string.3
> /usr/man/man3/ldap_first_attribute.3
> /usr/man/man3/ldap_next_attribute.3
> /usr/man/man3/ldap_first_entry.3
> /usr/man/man3/ldap_next_entry.3
> /usr/man/man3/ldap_count_entries.3
> /usr/man/man3/ldap_friendly.3
> /usr/man/man3/ldap_friendly_name.3
> /usr/man/man3/ldap_free_friendlymap.3
> /usr/man/man3/ldap_get_dn.3
> /usr/man/man3/ldap_eXPlode_dn.3
> /usr/man/man3/ldap_explode_dns.3
> /usr/man/man3/ldap_dn2ufn.3
> /usr/man/man3/ldap_is_dns_dn.3
> /usr/man/man3/ldap_get_values.3
> /usr/man/man3/ldap_get_values_len.3
> /usr/man/man3/ldap_value_free.3
> /usr/man/man3/ldap_value_free_len.3
> /usr/man/man3/ldap_count_values.3
> /usr/man/man3/ldap_count_values_len.3
> /usr/man/man3/ldap_getfilter.3
> /usr/man/man3/ldap_init_getfilter.3
> /usr/man/man3/ldap_init_getfilter_buf.3
> /usr/man/man3/ldap_getfilter_free.3
> /usr/man/man3/ldap_getfirstfilter.3
> /usr/man/man3/ldap_getnextfilter.3
> /usr/man/man3/ldap_setfilteraffixes.3
> /usr/man/man3/ldap_build_filter.3
> /usr/man/man3/ldap_modify.3
> /usr/man/man3/ldap_modify_s.3
> /usr/man/man3/ldap_mods_free.3
> /usr/man/man3/ldap_modrdn.3
> /usr/include/disptmpl.h
> /usr/include/srchpref.h
> /usr/lib/liblber.so.1.0.0
> /usr/lib/liblber.so.1
> /usr/lib/liblber.so
> /usr/lib/liblber.la
> /usr/lib/liblber.a
> /usr/lib/libldap.so.1.0.0
> /usr/lib/libldap.so.1
> /usr/lib/libldap.so
> /usr/lib/libldap.la
> /usr/lib/libldap.a
> /usr/man/man1/ud.1
> /usr/man/man1/ldapdelete.1
> /usr/man/man1/ldapmodify.1
> /usr/man/man1/ldapadd.1
> /usr/man/man1/ldapmodrdn.1
> /usr/man/man1/ldappasswd.1
> /usr/man/man1/ldapsearch.1
> /usr/man/man3/cldap_close.3
> /usr/man/man3/cldap_open.3
> /usr/man/man3/cldap_search_s.3
> /usr/man/man3/cldap_setretryinfo.3
> /usr/man/man3/lber-decode.3
> /usr/man/man3/lber-encode.3
> /usr/man/man3/ldap.3
> /usr/man/man3/cldap.3
> /usr/man/man3/ldap_abandon.3
> /usr/man/man3/ldap_add.3
> /usr/man/man3/ldap_add_s.3
> /usr/man/man3/ldap_bind.3
> /usr/man/man3/ldap_bind_s.3
> /usr/man/man3/ldap_simple_bind.3
> /usr/man/man3/ldap_simple_bind_s.3
> /usr/man/man3/ldap_kerberos_bind_s.3


> /usr/man/man3/ldap_kerberos_bind1.3
> /usr/man/man3/ldap_kerberos_bind1_s.3
> /usr/man/man3/ldap_kerberos_bind2.3
> /usr/man/man3/ldap_kerberos_bind2_s.3
> /usr/man/man3/ldap_unbind.3
> /usr/man/man3/ldap_unbind_s.3
> /usr/man/man3/ldap_set_rebind_proc.3
> /usr/man/man3/ldap_cache.3
> /usr/man/man3/ldap_enable_cache.3
> /usr/man/man3/ldap_disable_cache.3
> /usr/man/man3/ldap_destroy_cache.3
> /usr/man/man3/ldap_flush_cache.3
> /usr/man/man3/ldap_uncache_entry.3
> /usr/man/man3/ldap_uncache_request.3
> /usr/man/man3/ldap_set_cache_options.3
> /usr/man/man3/ldap_charset.3
> /usr/man/man3/ldap_set_string_translators.3
> /usr/man/man3/ldap_enable_translation.3
> /usr/man/man3/ldap_translate_from_t61.3
> /usr/man/man3/ldap_translate_to_t61.3
> /usr/man/man3/ldap_t61_to_8859.3
> /usr/man/man3/ldap_8859_to_t61.3
> /usr/man/man3/ldap_compare.3
> /usr/man/man3/ldap_compare_s.3
> /usr/man/man3/ldap_delete.3
> /usr/man/man3/ldap_delete_s.3
> /usr/man/man3/ldap_disptmpl.3
> /usr/man/man3/ldap_modrdn_s.3
> /usr/man/man3/ldap_modrdn2.3
> /usr/man/man3/ldap_modrdn2_s.3
> /usr/man/man3/ldap_init.3
> /usr/man/man3/ldap_result.3
> /usr/man/man3/ldap_msgfree.3
> /usr/man/man3/ldap_search.3
> /usr/man/man3/ldap_search_s.3
> /usr/man/man3/ldap_search_st.3
> /usr/man/man3/ldap_searchprefs.3
> /usr/man/man3/ldap_init_searchprefs.3
> /usr/man/man3/ldap_init_searchprefs_buf.3
> /usr/man/man3/ldap_free_searchprefs.3
> /usr/man/man3/ldap_first_searchobj.3
> /usr/man/man3/ldap_next_searchobj.3
> /usr/man/man3/ldap_sort.3
> /usr/man/man3/ldap_sort_entries.3
> /usr/man/man3/ldap_sort_values.3
> /usr/man/man3/ldap_sort_strcasecmp.3
> /usr/man/man3/ldap_ufn.3
> /usr/man/man3/ldap_ufn_search_s.3
> /usr/man/man3/ldap_ufn_search_c.3
> /usr/man/man3/ldap_ufn_search_ct.3
> /usr/man/man3/ldap_ufn_setprefix.3
> /usr/man/man3/ldap_ufn_setfilter.3
> /usr/man/man3/ldap_ufn_timeout.3
> /usr/man/man3/ldap_url.3
> /usr/man/man3/ldap_is_ldap_url.3
> /usr/man/man3/ldap_url_parse.3
> /usr/man/man3/ldap_free_urldesc.3
> /usr/man/man3/ldap_url_search.3
> /usr/man/man3/ldap_url_search_s.3
> /usr/man/man3/ldap_url_search_st.3
> /usr/man/man5/ldap.conf.5
> /usr/man/man5/ldapfilter.conf.5
> /usr/man/man5/ldapfriendly.5
> /usr/man/man5/ldapsearchprefs.conf.5
> /usr/man/man5/ldaptemplates.conf.5
> /usr/man/man5/ldif.5
> /usr/man/man5/slapd.conf.5
> /usr/man/man5/slapd.replog.5
> /usr/man/man5/ud.conf.5
> /usr/man/man8/centipede.8
> /usr/man/man8/chlog2replog.8
> /usr/man/man8/edb2ldif.8
> /usr/man/man8/go500.8


> /usr/man/man8/go500gw.8
> /usr/man/man8/in.xfingerd.8
> /usr/man/man8/ldapd.8
> /usr/man/man8/ldbmcat.8
> /usr/man/man8/ldif.8
> /usr/man/man8/ldif2ldbm.8
> /usr/man/man8/ldif2index.8
> /usr/man/man8/ldif2id2entry.8
> /usr/man/man8/ldif2id2children.8
> /usr/man/man8/mail500.8
> /usr/man/man8/fax500.8
> /usr/man/man8/rcpt500.8
> /usr/man/man8/slapd.8
> /usr/man/man8/slurpd.8
> /usr/sbin/ldif
> /usr/sbin/in.xfingerd
> /usr/man/man3/ldap_init_templates.3
> /usr/man/man3/ldap_init_templates_buf.3
> /usr/man/man3/ldap_free_templates.3
> /usr/man/man3/ldap_first_disptmpl.3
> /usr/man/man3/ldap_next_disptmpl.3
> /usr/man/man3/ldap_oc2template.3
> /usr/man/man3/ldap_tmplattrs.3
> /usr/man/man3/ldap_first_tmplrow.3
> /usr/man/man3/ldap_next_tmplrow.3
> /usr/man/man3/ldap_first_tmplcol.3
> /usr/man/man3/ldap_next_tmplcol.3
> /usr/man/man3/ldap_entry2text.3
> /usr/man/man3/ldap_entry2text_search.3
> /usr/man/man3/ldap_vals2text.3
> /usr/man/man3/ldap_entry2Html.3
> /usr/man/man3/ldap_entry2html_search.3
> /usr/man/man3/ldap_vals2html.3
> /usr/man/man3/ldap_error.3
> /usr/man/man3/ldap_perror.3
> /usr/man/man3/ld_errno.3
> /usr/man/man3/ldap_result2error.3
> /usr/sbin/go500
> /usr/sbin/go500gw
> /usr/sbin/mail500
> /usr/sbin/rp500
> /usr/sbin/fax500
> /usr/sbin/xrpcomp
> /usr/sbin/rcpt500
> /usr/sbin/slapd
> /usr/sbin/ldif2ldbm
> /usr/sbin/ldif2index
> /usr/sbin/ldif2id2entry
> /usr/sbin/ldif2id2children
> /usr/sbin/ldbmcat
> /usr/sbin/centipede
> /usr/sbin/ldbmtest

具體啟動腳本時會遇到sladpd進程啟動不了的問題,建議用如下方法啟動:
#su root -c /usr/local/libexec/slapd -f myslapd.conf
其中slapd被安裝在配置文件指定的"libexecdir"目錄下,通常為/usr/local/libexec/slpad。
如果啟動成功,到同一網絡中的一台pc上運行Outlook,添加ldap目錄服務,然後搜索個人,應該能返回提示"沒有符合所搜索項目"之類的提示,說明已經連接到ldap服務器.

但我在用ldapadd添加郵件用戶時提示如下錯誤,請高手指點
#ldapadd -D "cn=manager,dc=openarch,dc=com" -W < mydif.ldif
Enter LDAP Password:
ldap_sasl_interactive_bind_s: No such attribute

哪位高手在redhat上配置過LDAP數據庫.我的OpenLdap已經配置好了.測試通過.但在創建庫時,.ldif文件中的數據用ldapadd命令導不進去!.ldif文件格式如下:
#----------------------------------------
dn=yourdomain,c=us
objectClass:dcObject
objectClassrgnization
o:yourdomain
dn:cn=Manager,o=yourdomain,c=us
objectClassrganizationlRole
cn:Manager
descriptionirectory Manager


#......
#---------------------------------------
執行ldapadd命令如下:
[root@linux_test openldap-ldbm]# ldapadd -f mail.ldif -x -D "cn=root,o=yourdomain,c=us" -w secret
提示:
adding new entry "o=yourdomain,c=us"
ldap_add: Already exists

ldif_record() = 68
請大家幫忙分析一下,能告訴我怎麼才能把.ldif中的條目添加到ldap庫裡嗎???謝謝

改正一點:
*--enable-shared ——————>enable=shared
*--with-gnu-ld -------------->with=gnu-ld
好像ldap的腳本不支持chkconfig!


基本解決了!!!原因是每次在向ldap庫裡添加記錄時首先添加記錄頭,就是adding new entry "o=yourdomain,c= us",如果不設置強制添加,則不會導入用戶記錄,所以必須在ldapadd後加上-c.才能成功導入數據.在outlook端能查找到你導入的用戶!!!!

謝謝samba!!!

我建議還是把slapd 和 slurpd拷貝到/usr/sbin下去。因為我看在腳本裡有
[ -f /usr/sbin/slapd ] exit 0
[ -f /usr/sbin/slurpd ] exit 0
這兩行程序,所以我以後可以直接用service ldap start 或 stop 或 restart 了!

PAM-Pluggable Authentication Modules 是Sun公司提出的一種認證機制。他將系統提供的服務和該服務的認證方式分開,使得系統管理員可以靈活的根據需要給不同的服務配置不同的認證方式而無需更該服務程序,同時也便於向系統中添加新的認證手段。PAM的出現徹底的改變了這種局面,他提供了一個Linux-PAM引擎(一些動態連接庫)和一套統一的編程接口(API),並且基於PAM應用程序的認證過程是通過配置文件來定義的,這樣不僅將決定權交給了管理員,而且大大的提高了使用的靈活性。PAM最初是集成在solaris裡,目前已經移植到其他的系統中,如: Linux,sunos,hp-ux9.0等等。在redhat7.0.和6.0中已經是默認安裝的。



Copyright © Linux教程網 All Rights Reserved