日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenLDAP的安装测试及管理

發布時間:2023/12/10 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenLDAP的安装测试及管理 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
簡介:LDAP(輕量級目錄服務訪問協議,Lightweight Directory Access Protocol)基于X.500標準,支持TCP/IP,使用簡單方便。現在越來越多的網絡應用系統都支持LDAP。 ?
?  目錄是一個為查詢、瀏覽和搜索而優化的專業分布式數據庫,它成樹狀結構組織數據,就好象Linux/Unix系統中的文件目錄一樣。目錄數據庫和關系數據庫不同,它有優異的讀性能,但寫性能差,并且沒有事務處理、回滾等復雜功能,不適于存儲修改頻繁的數據。所以目錄天生是用來查詢的,就好象它的名字一樣。目錄服務是由目錄數據庫和一套訪問協議組成的系統。類似以下的信息適合儲存在目錄中: ?企業員工和企業客戶之類人員信息;公用證書和安全密鑰;郵件地址、網址、IP等電腦信息;電腦配置信息。
?  而且在我們的日常生活中,很多的應用都是基于LDAP的,比如Microsoft服務器的AD管理以及IBM的郵件Lotus都是基于LDAP的,并且Linux下的Postfix也可以設計成支持LDAP的形式,這篇文單權當是入門之用吧.以前有試過做基于Mysql的Postfix郵件系統( ?[url]http://waringid.blog.51cto.com/65148/58580[/url]),也打算用LDAP來實現,我會把我的安裝經歷整理出來的.支持軟件:安裝OpenLDAP的相關支持軟件是Berkeley ?DB,有了它就可以進行了,當然,如果你要求Sasl的支持的話那cyrus-sasl這個支持包也是少不了的.不過這個軟件包一般系統中會自帶,而且OpenLDAP在編譯時默認會加入此功能支持.這些軟件的下載地址可以參考我以前寫過的一篇文章( ?[url]http://waringid.blog.51cto.com/65148/58144[/url]),其中有列出下載地址.而OpenLDAP的下載地址則是: ?[url]ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release[/url]系統相關:在Linux下不同版本的系統在設置上可能會有很小的差異,所以這里交待一下我的系統:RedHat AS ?4,安裝時所選的系統組件只有"開發工具",其它的所有軟件包都沒有選取.如果你是Linux新手,對裝系統還有一些困難的話,請參考這篇文章([url]http://waringid.blog.51cto.com/65148/47655[/url]).
下載相關軟件:查詢并卸載系統中原有的相關軟件:rpm -qa |grep ldap rpm -e --nodeps 顯示的組件安裝BerkeleyDB:tar zxvf db-4.5.20.tar.gz cd db-4.5.20/build_unix ../dist/configure --prefix=/usr/local/BerkeleyDB make make install echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf ldconfig -v安裝Cyrus-Sasl:tar zxvf cyrus-sasl-2.1.21.tar.gz cd cyrus-sasl-2.1.21 ./configure --prefix=/usr/local/sasl --enable-cram --enable-plain \ --enable-digest --disable-anon --enable-krb4 --enable-ntlm make make install echo "/usr/local/sasl/lib/" >> /etc/ld.so.conf ldconfig -v ln -sv /usr/local/sasl/include/sasl/* /usr/local/include/ ln -sv /usr/local/sasl/lib/* /usr/local/lib/ ln -sv /usr/local/sasl/lib/sasl2/* /usr/local/lib/安裝OpenLDAP:gunzip -c openldap-2.4.9.tgz | tar xvfB - cd openldap-2.4.9 env CPPFLAGS="-I/usr/local/BerkeleyDB/include" LDFLAGS="-L/usr/local/BerkeleyDB/lib" \ ./configure --prefix=/usr/local/openldap --sysconfdir=/etc --enable-ldbm \ --enable-lmpasswd --enable-spasswd --enable-bdb --enable-ldap make depend make make install echo /usr/local/openldap/lib >> /etc/ld.so.conf ldconfig -v配置LADP:LDAP的配置中,我們要實現的功能如圖所示.需要增加一個用戶"Ben".生成LDAP管理密碼:/usr/local/openldap/sbin/slappasswd -h {md5} {MD5}X03MO1qnZdYdgyfeuILPmQ==##此密碼是LDAP管理密碼,和系統密碼無關增加相關查詢記錄:echo "127.0.0.1 ldap.test.com" >> /etc/hosts echo "127.0.0.1 ldap-master.test.com" >> /etc/hosts設置slapd.conf文件:vi /etc/openldap/slapd.conf include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args database bdb suffix "dc=test,dc=com" rootdn "cn=Manager,dc=test,dc=com" rootpw {MD5}X03MO1qnZdYdgyfeuILPmQ== directory /var/lib/ldap設置ldap.conf文件:vi /etc/openldap/ldap.conf HOST 127.0.0.1 BASE dc=test,dc=com URI ldap://ldap.test.comldap://ldap-master.test.com:389 SIZELIMIT 12 TIMELIMIT 15 DEREF nerver啟動LDAP:/usr/local/openldap/libexec/slapd增加用戶資料:vi test.ldif #root node ##建立DN dn:dc=test,dc=com dc:test objectclass:dcObject objectclass:organizationalUnit ou:test Dot com #login top ##建立RDN dn:ou=login,dc=test,dc=com ou:login objectclass:organizationalUnit #user,uid,password dn:ou=user,ou=login,dc=test,dc=com ou:user objectclass:organizationalUnit #group dn:ou=group,ou=login,dc=test,dc=com ou:group objectclass:organizationalUnit #company organization top dn:ou=company,dc=test,dc=com ou:company objectclass:organizationalUnit #for company organization(unit) dn:ou=unit,ou=company,dc=test,dc=com ou:unit objectclass:organizationalUnit #human resource(under unit) dn:ou=hr,ou=unit,ou=company,dc=test,dc=com ou:hr objectclass:organizationalUnit #MIS(under unit) dn:ou=mis,ou=unit,ou=company,dc=test,dc=com ou:mis objectclass:organizationalUnit #Editorial(under unit) dn:ou=editorial,ou=unit,ou=company,dc=test,dc=com ou:editorial objectclass:organizationalUnit vi user.ldif ##建立用戶數據#User-Ben Chan dn:cn=ben,ou=editorial,ou=unit,ou=company,dc=test,dc=com cn:ben sn:chan objectclass:organizationalUnit givenName:ben mail:ming@test.com telephoneNumber:1234678 mobile:98765432 postalAddress:dongguan postalCode:86 ou:editorial o:test Corp labeledURL:[url]http://waringid.blog.51cto.com[/url] title:Editor postalCode: 區號 ou:部門 o:機構 title:職位解決中文符號問題:dos2unix user.ldif iconv -f gb2312 -t UTF-8 -o user.ldif.utf8 user.ldif file user.ldif.utf8 ldapmodify -D "cn=Manager,dc=test,dc=com" -w secret -x -a -f user.ldif.utf8測試:ldapsearch -x -b "ou=unit,ou=company,dc=test,dc=com"通過web方式管理LADP:以命令的方式來管理LDAP是最快最直接的方法,但是需要用戶有一定的Linux管理能力及對LDAP結構深入的理解.還有一種方式就是通過WEB的方式進行管理,這種方式和phpmyadmin管理mysql差不多,用它則是最方便訊速了.下載地址為: ?[url]http://sourceforge.net/project/showfiles.php?group_id=61828[/url].它的配置方法和phpmyadmin的配置方法差不多,這里就不過多描述了,參考以前的文件應可以自行設置( ?[url]http://waringid.blog.51cto.com/65148/58210[/url]),需要注意的是要將配置文件從config目錄中copy到它的上一級目錄,然后需要設置以下一些地方:
$ldapservers->SetValue($i,'server','auth_type','session'); $ldapservers->SetValue($i,'login','dn','cn=Manager,dc=test.com'); $ldapservers->SetValue($i,'login','pass','');

總結

以上是生活随笔為你收集整理的OpenLDAP的安装测试及管理的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。