[Date Prev][Date Next] [Chronological] [Thread] [Top]

OpenLDAP + MySQL BackEnd



Hello all,

Recently I've donwload the OpenLDAP 2.4.44 and enable mysql as followed.

apt-get install libssl-dev libdb-dev unixodbc-dev time
wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.26.tgz
tar xvfz openldap-*.tgz
cd openldap-*
./configure --enable-sql
make depend
make
make install

apt-get install mysql-server libmyodbc
# put mysql root password and confirm password that you want
mysql -u root -p
# put mysql root password

CREATE USER 'openldap'@'localhost' IDENTIFIED BY 'yourpassword';
CREATE DATABASE IF NOT EXISTS openldap;
GRANT ALL PRIVILEGES ON openldap.* TO 'openldap'@'localhost';
FLUSH PRIVILEGES;
exit

edit /etc/odbc.ini

[openldap]
Description         = Example for OpenLDAP's back-sql
Driver              = MySQL
Trace               = No
Database            = openldap
Servername          = localhost
UserName            = openldap
Password            = yourpassword
ReadOnly            = No
RowVersioning       = No
ShowSystemTables    = No
ShowOidColumn       = No
FakeOidIndex        = No
ConnSettings        =
SOCKET              = /var/run/mysqld/mysqld.sock

/etc/odbcinst.ini
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.soo
FileUsage       = 1

cd servers/slapd/back-sql/rdbms_depend/mysql/
mysql -u openldap -p openldap < backsql_create.sql
mysql -u openldap -p openldap < testdb_create.sql
mysql -u openldap -p openldap < testdb_data.sql
mysql -u openldap -p openldap < testdb_metadata.sql

/usr/local/etc/openldap/slapd.conf
# $OpenLDAP$
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include         /usr/local/etc/openldap/schema/core.schema
include         /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema
 
# Define global ACLs to disable default read access.
 
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral       ldap://root.openldap.org
 
pidfile         /usr/local/var/slapd.pid
argsfile        /usr/local/var/slapd.args
 
#######################################################################
# sql database definitions
#######################################################################
 
database        sql
suffix          "dc=example,dc=com"
rootdn          "cn=root,dc=example,dc=com"
rootpw          rootpassword
dbname          openldap
dbuser          openldap
dbpasswd        yourpassword
subtree_cond    "ldap_entries.dn LIKE CONCAT('%',?)"
insentry_stmt   "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) VALUES (?,?,?,?)"
has_ldapinfo_dn_ru      no

When I execute the following command 

/usr/local/libexec/slapd -d 1

I receive the following information

58eba756 backsql_db_open(): entry deletion SQL statement not specified (use "renentry_stmt" directive in slapd.conf)
58eba756 backsql_db_open(): setting "UPDATE ldap_entries SET dn=?,parent=?,keyval=? WHERE id=?" by default
58eba756 backsql_db_open(): objclasses deletion SQL statement not specified (use "delobjclasses_stmt" directive in slapd.conf)
58eba756 backsql_db_open(): setting "DELETE FROM ldap_entry_objclasses WHERE entry_id=?" by default
58eba756 ==>backsql_get_db_conn()
58eba756 ==>backsql_open_db_handle()
Floating point exception (core dumped)

Apparently there is no error.

When I execute the following command

ldapsearch -x -D cn=root,dc=example,dc=com -w rootpassword -s sub -b "dc=example,dc=com" "(objectClass=*)"

I receive the following error

root@DNS-TESTE:~# ldapsearch -x -D cn=root,dc=example,dc=com -w teste -s sub -b "dc=example,dc=com" "(objectClass=*)"
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Apparently after the installation of the ldap, the sldap demon wasn't created.

I'm doing something wrong? Is there another way to configure LDAP to support MySQL?

Regards

Alex