Showing posts with label LDAP. Show all posts
Showing posts with label LDAP. Show all posts

phpLDAPadmin at CentOS 5.2 for LDAP


LDAP的GUI瀏覽工具及管理工具在網路上有非常的多,其中最多人使用的應該是phpldapadmin這一套基於web的瀏覽管理工具,其安裝也很簡單。

先到官方網站下載套件http://phpldapadmin.sourceforge.net/至網頁根目錄

#wget http://nchc.dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-1.1.0.5.tar.gz
//下載

#tar zxvf phpldapadmin-1.1.0.5.tar.gz //解壓縮套件

#mv phpldapadmin-1.1.0.5 pla //修改資料夾名稱

#cd pla //進入pla

#cp config/config.php.example config/config.php //複製config裡的sample成config.php

#vim config/config.php //修改設定檔的設定
修改以下設定
-----略------
$ldapservers->SetValue($i,'server','name','LDAP Server');
$ldapservers->SetValue($i,'server','host','127.0.0.1');
$ldapservers->SetValue($i,'server','port','389');
$ldapservers->SetValue($i,'server','base',array('cn=Manager,dc=domain,dc=com'));
$ldapservers->SetValue($i,'server','auth_type','cookie');
$ldapservers->SetValue($i,'login','dn','cn=Manager,dc=domain,dc=com');
$ldapservers->SetValue($i,'login','pass','password');
-----略------

修改之後存檔,接著在瀏覽器URL上連結http://host.domain.com/pla
Login的帳號就是cn=Manager,dc=domain,dc=com這一串喔!

enjoy....

LDAP Account Manager(LAM)安裝 at CentOS 5.2

(圖片取自LAM官方網站)
LDAP Account Manager( LAM )在我架好LDAP Server at CentOS 5.2之後裝的GUI的管理介面,安裝的方法很簡單:

首先,先至官方網站下載最新版本的LAM:Source code - ldap-account-manager-2.3.0.tar.gz
至網頁根目錄,或是您要執行的網頁目錄。

#wget http://nchc.dl.sourceforge.net/sourceforge/lam/ldap-account-manager-2.3.0.tar.gz
//下載

#tar zxvf ldap-account-manager-2.3.0.tar.gz //解壓縮套件

#mv ldap-account-manager-2.3.0 lam //修改資料夾名稱(可以不用改)

#cd lam //進入LAM資料夾

#cp config/config.cfg_sample config/config.cfg //複製一份config.cfg

#cp config/lam.conf_sample config/lam.conf //複製一份lam.conf設定檔

#chown apache.apache sess/ tmp/ lib/ config/config.cfg
//修改sess/、tmp/、lib/、config/config.cfg這四個資料夾及檔案的屬性,使apache能使用它們,如果想要使用LAM修改lam.conf檔,還要修改lam.conf屬性,指令同上。

#vim /config/lam.conf //修改lam.conf設定檔
修改以下幾個設定:
------------略--------------
admins: cn=Manager,dc=domain,dc=com
passwd: **********
treesuffix: dc=domain,dc=com
defaultLanguage: zh_TW.utf8:UTF-8:繁體中文(台灣)
-----------略------------

接著修改php.ini
#vim php.ini
修改
memory_limit = 64M

#service httpd restart

這樣就完成了,接下來只要使用瀏覽器連結 http://host.doamin.com/lam
用上面所填的admin :cn=Manager來當作帳號,還有passwd的密碼登入即可。

enjoy...

LDAP 的suffix問題

從開始學LDAP到現在已經不知道看過多少書跟多少文章與document,可是到最後總是有問題,不能建帳號或是搜尋之類的,到最近我才發現我的問題所在,媽呀!為什麼沒有一篇有說清楚的,還是我太笨了?!

在slapd.conf裡,最重要的就是設定suffix與rootdn,假設你所可以管理的最base的domain是domain.tp.edu.tw,那麼suffix及root裡的dc.....就得是dc=,domain,dc=tp,dc=edu,dc=tw。一開始我一直覺得自己很聰明,我都設成dc=localhost,dc=,domain,dc=tp,dc=edu,dc=tw。所以一直會有問題,而且更無法與Samba網域結合,直到我改成dc=,domain,dc=tp,dc=edu,dc=tw之後才行。不過至少學到了很多,哈!

LDAP Error: Warning - No DB_CONFIG file found in directory

#service ldap restart
之後顯示如下訊息:

正在停止 slapd: [ 確定 ]
正在為 slapd 檢查設定檔案: bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=taes,dc=tp,dc=edu,dc=tw. config file testing [ 確定 ]
正在啟動 slapd: [ 確定 ]

上面的所顯示的錯誤訊息裡的DB_CONFIG file 在/etc/openldap/DB_CONFIG.example,複製到/var/lib/ldap裡,改成DB_CONFIG,然後重新啟動LDAP即可。

LDAP: smbldap-populate error

初始資料庫時,下了
# smbldap-populate
結果出現以下的錯誤訊息,找了很久,在網路上搜尋了很久也沒有結果,雖然知道是驗證方面出了問題,但是不知道哪裡錯了?因為每個相關檔案都檢查無誤。最後,發現的原因真是令人噴飯。解決方法在文章最底部!

Use of uninitialized value in substitution (s///) at /usr/lib/perl5/vendor_perl/5.8.8/smbldap_tools.pm line 135, line 73.
Populating LDAP directory for domain taes (S-1-5-21-947298777-4161204931-40633681)
(using builtin directory structure)

adding new entry: dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 2.
adding new entry: ou=Users,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 3.
adding new entry: ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 4.
adding new entry: ou=Computers,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 5.
adding new entry: ou=Idmap,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 6.
adding new entry: uid=root,ou=Users,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 7.
adding new entry: uid=nobody,ou=Users,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 8.
adding new entry: cn=Domain Admins,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 9.
adding new entry: cn=Domain Users,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 10.
adding new entry: cn=Domain Guests,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 11.
adding new entry: cn=Domain Computers,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 12.
adding new entry: cn=Administrators,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 16.
adding new entry: cn=Account Operators,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 18.
adding new entry: cn=Print Operators,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 19.
adding new entry: cn=Backup Operators,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 20.
adding new entry: cn=Replicators,ou=Groups,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 21.
adding new entry: sambaDomainName=taes,dc=taes,dc=tp,dc=edu,dc=tw
failed to add entry: modifications require authentication at /usr/sbin/smbldap-populate line 499, line 21
Please provide a password for the domain root:
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/vendor_perl/5.8.8/smbldap_tools.pm line 135, line 73.
No such object at /usr/lib/perl5/vendor_perl/5.8.8/smbldap_tools.pm line 353.

解決的方法很簡單,修改/etc/openldap/slapd.conf這個檔案裡的rootpw位置,rootpw前面不能有空格,有的話就會出現以上的錯誤訊息,拿掉就好了!