使用者工具

網站工具


tech:openldap

CentOS 5 安裝 OpenLdap 管理通訊錄

- 安裝套件

  • compat-openldap-2.3.27_2.2.29-5
  • openldap-2.3.27-5
  • openldap-devel-2.3.27-5
  • openldap-clients-2.3.27-5
  • openldap-servers-2.3.27-5
  • openldap-servers-sql-2.3.27-5

- 設定 LDAP Server

  • 透過 slappasswd 產生主要的密碼
[[email protected] ~]# slappasswd
New password:
Re-enter new password:
{SSHA}N3Xr7mUajfh9BY_________xx_WfWgb
  • vi /etc/openldap/slapd.conf
:
suffix          "dc=ichiayi,dc=com"
rootdn          "cn=Manager,dc=ichiayi,dc=com"
:
rootpw          {SSHA}N3Xr7mUajfh9BY_________xx_WfWgb
:

- 建立 LDAP 內組織結構

  • 將 DB_CONFIG.example → /var/lib/ldap/DB_CONFIG
cd /etc/openldap
cp DB_CONFIG.example /var/lib/ldap/DB_CONFIG
  • 編輯與匯入組織結構檔

root_unit.ldif

slapadd -v -l root_unit.ldif
----
[[email protected] openldap]# slapadd -v -l /tmp/root_unit.ldif
added: "dc=ichiayi,dc=com" (00000001)
added: "ou=login,dc=ichiayi,dc=com" (00000002)
added: "ou=user,ou=login,dc=ichiayi,dc=com" (00000003)
added: "ou=group,ou=login,dc=ichiayi,dc=com" (00000004)
added: "ou=company,dc=ichiayi,dc=com" (00000005)
added: "ou=unit,ou=company,dc=ichiayi,dc=com" (00000006)
added: "ou=hr,ou=unit,ou=company,dc=ichiayi,dc=com" (00000007)
added: "ou=mis,ou=unit,ou=company,dc=ichiayi,dc=com" (00000008)
added: "ou=tech,ou=unit,ou=company,dc=ichiayi,dc=com" (00000009)
added: "ou=customer,ou=company,dc=ichiayi,dc=com" (0000000a)
----
chown -R ldap /var/lib/ldap/*

- 啟動 LDAP Server 與確認匯入資料正確

  • service ldap start
  • ldapsearch -x -b “dc=ichiayi,dc=com”

實際過程

- 安裝 LDAP Web 管理介面系統 GOsa (尚未完成)

實際安裝過程

- 匯入現有 Thunderbird 通訊錄資料(尚未完成)

  • 將通訊錄資料會出成 jonathan.ldif
  • 使用 slapadd -v -l jonathan.ldif 匯入
[[email protected] tmp]# slapadd -v -l jonathan.ldif

bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=ichiayi,dc=com.
<= str2entry: str2ad(mozillaNickname): attribute type undefined
slapadd: could not parse entry (line=742)
[[email protected] tmp]#

[[email protected] openldap]# service ldap start
正在為 slapd 檢查設定檔案:  config file testing succeeded
                                                           [  確定  ]
正在啟動 slapd:                                            [  確定  ]
[[email protected] openldap]#

- 參考資料

tech/openldap.txt · 上一次變更: 2009/06/05 07:18 由 jonathan