LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Problems configuring Open ldap (https://www.linuxquestions.org/questions/linux-server-73/problems-configuring-open-ldap-771647/)

otaku1 11-26-2009 01:45 AM

Problems configuring Open ldap
 
hi i have been configuring my server following the how to manual CentOS 5.x Samba Domain Controller With LDAP

http://www.howtoforge.com/centos-5.x...h-ldap-backend

but for some reason after i get to slapcat i get an error

This is the error

[root@localhost openldap]# slapcat
bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap/otaku.local: (2)
Expect poor performance for suffix dc=otaku,dc=local.
bdb_db_open: db_open(/var/lib/ldap/otaku.local/id2entry.bdb) failed: No such file or directory (2)
bdb(dc=otaku,dc=local): Unknown locker ID: 0
backend_startup_one: bi_db_open failed! (2)
slap_startup failed


----------------------------------------------------------------
this is the configuration file slapp.conf help
----------------------------------------------------------------

[root@localhost openldap]# more slapd.conf
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/samba.schema

# Allow LDAPv2 client connections. This is NOT the default.
allow bind_v2

pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args

# Load dynamic backend modules:
# modulepath /usr/lib/openldap

# modules available in openldap-servers-overlays RPM package:
# moduleload accesslog.la
# moduleload auditlog.la
# moduleload denyop.la
# moduleload dyngroup.la
# moduleload dynlist.la
# moduleload lastmod.la
# moduleload pcache.la
# moduleload ppolicy.la
# moduleload refint.la
# moduleload retcode.la
# moduleload rwm.la
# moduleload smbk5pwd.la
# moduleload syncprov.la
# moduleload translucent.la
# moduleload unique.la
# moduleload valsort.la

# modules available in openldap-servers-sql RPM package:
# moduleload back_sql.la

# The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
# /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
# slapd.pem so that the ldap user or group can read it. Your client software
# may balk at self-signed certificates, however.
# TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
# TLSCertificateFile /etc/pki/tls/certs/slapd.pem
# TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem

# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

#######################################################################
# ldbm and/or bdb database definitions
#######################################################################

database bdb
suffix "dc=otaku,dc=local"
rootdn "cn=root,dc=otaku,dc=local"
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw secret
rootpw {SSHA}irqpbZm9FOFpepzhOLNrpqdlfkuLAJfo
password-hash {SSHA}

# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
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
index cn,sn,uid,displayName pres,sub,eq
index uidNumber,gidNumber eq
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
index objectClass pres,eq
index default 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/ldap-master.example.com@EXAMPLE.COM
[root@localhost openldap]#

bathory 11-27-2009 12:15 AM

Hi,

slapcat is looking in the wrong directory (/var/lib/ldap/otaku.local), for the database. Are you sure you're using the slapd.conf you've posted? Becaue according to that, the database directory should be /var/lib/ldap. You can use the following:
slapcat -v -f /etc/openldap/slapd.conf -l file.ldif

otaku1 11-27-2009 04:55 AM

Yeap it was looking in the wrong file /var/lib/ldap/otaku.local i change to /var/lib/ldap
also use slapcat -v -f /etc/openldap/slapd.conf -l file.ldif it work

but now i tried to do ldapsearch -x -b "dc=otaku,dc=local" it returns it like this
it cant find the otaku.local

[root@otakudns openldap]# ldapsearch -x -b "dc=otaku,dc=local"
# extended LDIF
#
# LDAPv3
# base <dc=otaku,dc=local> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

bathory 11-27-2009 05:07 AM

It looks like that the "dn: dc=otaku,dc=local" does not exist.
Are you sure you've populated ldap with data? What was in the file you got from slapcat?

otaku1 11-27-2009 08:39 PM

so far these are the configuration files that i have modified

------------------
/etc/hosts
------------------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

192.168.1.80 otakudns
192.168.1.80 otaku.local
192.168.1.80 otakudns.otaku.local

--------------------------------
/etc/openldap/slapd.conf
---------------------------------
[root@otakudns openldap]# more slapd.conf
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/samba.schema

# Allow LDAPv2 client connections. This is NOT the default.
allow bind_v2


# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args

# Load dynamic backend modules:
# modulepath /usr/lib/openldap

# modules available in openldap-servers-overlays RPM package:
# moduleload accesslog.la
# moduleload auditlog.la
# moduleload denyop.la
# moduleload dyngroup.la
# moduleload dynlist.la
# moduleload lastmod.la
# moduleload pcache.la
# moduleload ppolicy.la
# moduleload refint.la
# moduleload retcode.la
# moduleload rwm.la
# moduleload smbk5pwd.la
# moduleload syncprov.la
# moduleload translucent.la
# moduleload unique.la
# moduleload valsort.la

# modules available in openldap-servers-sql RPM package:
# moduleload back_sql.la

# The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
# /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
# slapd.pem so that the ldap user or group can read it. Your client software
# may balk at self-signed certificates, however.
# TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
# TLSCertificateFile /etc/pki/tls/certs/slapd.pem
# TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem

# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64

# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

#access to #attrs=userPassword,sambaLMPassword,sambaNTPassword,shadowLastChange
#by dn.children=.ou=root,dc=otaku,dc=local. write
#by self write
#by anonymous auth
#by * none
#access to *
#by dn.children=.ou=root,dc=otaku,dc=local. write
#by * read

#######################################################################
# ldbm and/or bdb database definitions
#######################################################################

database bdb
suffix "dc=otaku,dc=local"
rootdn "cn=root,dc=otaku,dc=local"
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
rootpw {SSHA}f0wfcEs0PUFFX0FC5HePLPO1ZVm4U0Ho
password-hash {SSHA}

# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
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
index cn,sn,uid,displayName pres,sub,eq
index uidNumber,gidNumber eq
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq
ndex objectClass pres,eq
index default 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/ldap-master.example.com@EXAMPLE.COM

-------------------------------------------
/etc/openldap/init.ldif
--------------------------------------------
[root@otakudns openldap]# more init.ldif
dn: dc=otaku,dc=local
objectclass: dcObject
objectclass: organization
o: CentOS Directory Server
dc: dc=otaku,dc=local
dn: cn=root,dc=otaku,dc=local
objectclass: organizationalRole
cn: root

--------------------------------
/etc/sysconfig
--------------------------------
[root@otakudns sysconfig]# more network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=otakudns.otaku.local
GATEWAY=192.168.1.1

bathory 11-28-2009 01:23 AM

You didn't say if you have added the ldif file: /etc/openldap/init.ldif in ldap, but I guess you didn't.
Stop slapd and run:
Code:

slapadd -l /etc/openldap/init.ldif
Then start slapd and do your ldapsearch.

Regards

otaku1 11-28-2009 04:52 AM

yeeeeeeeeeeeaaaa is working at last

i have to fix the int.ldif
like this so it accpeted the command: slapadd -l /etc/openldap/init.ldif
leaving the space between and in the dc area only goes the name nothing more


intfile

dn: dc=otaku,dc=local
objectclass: dcObject
objectclass: organization
o: Otaku Directory Server
dc: otaku

dn: cn=root,dc=otaku,dc=local
objectclass: organizationalRole
cn: root

Many Thanks bathory


All times are GMT -5. The time now is 03:01 PM.