在 centos 6 上設定一個 openldap 代理到另一個 LDAP 伺服器

在 centos 6 上設定一個 openldap 代理到另一個 LDAP 伺服器

我正在嘗試讓本地伺服器對其自己的 openldap 伺服器進行身份驗證,然後在本地找不到用戶時代理到公司 LDAP。

  1. 本地用戶工作
  2. 可以對本機 LDAP 伺服器進行身份驗證
  3. 無法對公司 LDAP 進行身份驗證
  4. 使用本機伺服器時,LDAP 搜尋可以正常運作(確認!?!)

使用者 = 公司 LDAP 帳號內部 ldap = 使用者 - internal.com 公司 ldap = 人員 - datacenter.corporate.com

注意:匿名綁定在企業上啟用。

oot@ sssd]# ldapsearch -h 127.0.0.1 -x -b "uid=user,ou=people,dc=datacenter,dc=corporate,dc=com"
# extended LDIF
#
# LDAPv3
# base <uid=user,ou=people,dc=datacenter,dc=corporate,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# user, People, datacenter.corporate.com
dn: uid=user,ou=People,dc=datacenter,dc=corporate,dc=com
uid: user
cn: 
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
shadowMax: 
shadowWarning: 
loginShell: /bin/bash
uidNumber: 
gidNumber: 
homeDirectory: /home/users/user
gecos: user
shadowLastChange: 16461

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

設定slap.d:

#######################################################################
# database definitions
#######################################################################

database bdb
suffix "dc=internal,dc=com"
checkpoint 1024 15
rootdn "cn=adm,dc=internal,dc=com"
rootpw {SSHA}aaaaa
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

# 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/[email protected]

#proxy ldap
database ldap
suffix "ou=People,dc=datacenter,dc=corp,dc=com"
uri "ldap://1.1.1.1:389/"

idassert-bind bindmethod=none

ldap.conf:

URI ldap://127.0.0.1
BASE dc=internal,dc=com

答案1

為可能找到此線程的任何人進行更新; openldap 文件非常缺乏代理設定。這是經過 48 小時的反覆試驗才發現的。

注意:我透過在 /etc/sysconfig/ldap SLAPD_OPTIONS="-f /etc/openldap/slapd.conf" 中新增以下內容切換回 slapd.conf

在 slapd 檔案中你會發現 4 個資料庫; 1. 用於LDAP AUTH 的本機資料庫(test.com) 2. 用於LDAP AUTH 的外部資料庫連接器(external.local -> corp.com) 3. 用於LDAP AUTH 的內部資料庫連接器(internal.local -> test.com) 4.將 2 個連接器組合到 1 個資料庫的元資料庫

無所不在的匿名綁定;讓事情變得更容易。

客戶端現在指向本機 LDAP 資料庫,並且可以無縫地對本機 LDAP 或公司 LDAP 進行驗證。

slapd.conf

#local database 
database        bdb
suffix  "dc=test,dc=com"
checkpoint      1024 15
rootdn  "cn=adm,dc=test,dc=com"
rootpw  {SSHA}aaa
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

#database meta
database meta
suffix  "dc=local"
rootdn  "cn=adm,dc=local"
rootpw  {SSHA}aaa

#dir1
uri      "ldap://corporate-ldap.com/ou=external,dc=local"
lastmod       off
suffixmassage   "ou=external,dc=local" "dc=datacenter,dc=corp,dc=com"

#dir2
uri      "ldap://127.0.0.1/ou=internal,dc=local"
lastmod       off
suffixmassage   "ou=internal,dc=local" "dc=test,dc=com"

相關內容