我试图按照这教程设置一个基本的LDAD服务器(OpenLDAP),用于cleint身份验证,但我仍然停留在添加后端配置的步骤上。
我已经按照指定的方式创建了我的backend.ldif文件,并且我尝试用以下方式添加它:
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.ldif
但我明白:
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=module,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
additional info: <olcModuleLoad> handler exited with 1
完整的LDIF是:
#Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb
# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=mydomain,dc=us
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=mydomain,dc=us
olcRootPW: dmx512
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn="cn=admin,dc=mydomain,dc=us" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=admin,dc=mydomain,dc=us" write by * read
对如何排除故障有任何建议吗?我对LDAP服务器一无所知,这是我的第一次。
我已经开始了一个全新的11.04服务器安装。
我做了以下工作:
hostname ldap.mycompany.com
nano /etc/hosts (set to ldap.mycompany.com)
nano /etc/hostname (set to ldap.mycompany.com)
sudo apt-get install slapd ldap-utils
我尝试加载第一个模式:
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
我得到:
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=cosine,cn=schema,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
additional info: olcAttributeTypes: Duplicate attributeType: "0.9.2342.19200300.100.1.2"
我尝试了下面建议的命令:
root@ldap:~# cat /etc/ldap/slapd.d/cn\=config/cn\=module\{0\}.ldif
dn: cn=module{0}
objectClass: olcModuleList
cn: module{0}
olcModulePath: /usr/lib/ldap
olcModuleLoad: {0}back_hdb
structuralObjectClass: olcModuleList
entryUUID: 3bedbe64-e4b2-1030-832a-17900c7b3644
creatorsName: cn=config
createTimestamp: 20120206020131Z
entryCSN: 20120206020131.785958Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20120206020131Z
但这一次它没有补充一个模块,而是抱怨一个“重复的attributeType”。
因此,我需要一个命令,上面写着“显示加载的属性类型”,以查看列表中是否已经有“余弦”?
好吧,我假设:
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif
都是不必要的,因为它们都产生了相同的错误。
因此,我继续添加~/backend.ldif。我从顶部删除了加载模式线,因为模块似乎已经加载了。
现在,当我试图添加:
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.ldif
我得到:
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "olcDatabase=hdb,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
additional info: <olcSuffix> namingContext "dc=mycompany,dc=us" already served by a preceding hdb database
这是没有意义的,因为这是计算机上唯一的数据库,这是我要添加的第一个条目。
发布于 2012-02-05 15:57:59
错误消息表明back_hdb
模块已经包含在配置中。您可以使用命令验证这一点。
cat /etc/ldap/slapd.d/cn\=config/cn\=module\{0\}.ldif
如果这包括类似于以下内容的行,那么它已经包括在内:
olcModulePath: /usr/lib/ldap
olcModuleLoad: {0}back_hdb
如果是这样的话,只需从backend.ldif
中删除前六行,然后再试一次。
如果您想从头开始,可以使用以下命令
apt-get purge slapd ldap-utils
以摆脱包括所有数据文件在内的完整ldap安装。
之后,您需要使用相应的命令重新安装OpenLDAP。
apt-get install slapd ldap-utils
顺便说一句,我只是遵循了本教程(同时使用了他们脚本中的所有默认值),这在一个新创建的Lucid上运行得很好。
好吧,在你的另一篇文章中,你谈到了10.04。实际上,11.04中用于slapd
的自动配置要比10.04好得多。它对您所做的是关于模式文件和backend.ldif的教程中的所有内容,甚至是前端的一部分:您可以从fronted.ldif中删除以下行并尝试从那里继续:
# Create top-level object in domain
dn: dc=tuxnetworks,dc=com
objectClass: top
objectClass: dcObject
objectclass: organization
o: Tuxnetworks
dc: Tuxnetworks
description: LDAP Server
# Admin user.
dn: cn=admin,dc=tuxnetworks,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: mypassword
进一步的提示: OpenLDAP (cn=config
)的后端配置只不过是相当于LDAP结构的文件系统结构中的LDIF文件的集合。您可以在/etc/ldap/slapd.d
中自己浏览它。10.04只有最低限度才能让slapd
工作,而11.04则准备好了一切,这样您就可以马上开始工作了。
发布于 2014-10-06 05:59:36
将.la添加到back_hdb末尾
LDIF现在应改为
#Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb.la
# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=mydomain,dc=us
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=mydomain,dc=us
olcRootPW: dmx512
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn="cn=admin,dc=mydomain,dc=us" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=admin,dc=mydomain,dc=us" write by * read
解释:http://ubuntuforums.org/archive/index.php/t-1594138.html
https://serverfault.com/questions/356912
复制相似问题