Table of Contents

Backends de configuration SQL

There is 2 types of SQL configuration backends for LemonLDAP::NG:

You can use any database engine if it provides a Perl Driver. You will find here examples for MySQL and PostGreSQL, but other engines may also work.

See how to change configuration backend.

MySQL

Perl Driver

You need DBD::MySQL Perl module:

apt install libdbd-mysql-perl
yum install perl-DBD-MySQL

Database and table creation

Créer la base de données :

CREATE DATABASE lemonldap-ng CHARACTER SET utf8;

Use database to create table:

USE lemonldap-ng

RDBI

CREATE TABLE lmConfig (
    cfgNum INT(11) NOT NULL,
    FIELD VARCHAR(255) NOT NULL DEFAULT '',
    VALUE longtext,
    PRIMARY KEY (cfgNum,FIELD)
    );

CDBI

CREATE TABLE lmConfig (
    cfgNum INT NOT NULL PRIMARY KEY,
    DATA longtext
);

Grant access

Il faut autoriser l'accès en lecture et écriture pour le manager. Les autres composants n'ont besoin que d'un accès en lecture. On peut également utiliser le même compte pour tous.

You can use different dbiUser strings:
  • une avec des droits en lecture/écriture pour les serveurs hébergeant le manager
  • une avec seulement des droits en lecture pour les autres serveurs

For example (suppose that our servers are in 10.0.0.0/24 network):

GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES ON lemonldap-ng.lmConfig
  TO lemonldaprw@manager.host IDENTIFIED BY 'mypassword';
GRANT SELECT ON lemonldap-ng.lmConfig
  TO lemonldapro@'10.0.0.%' IDENTIFIED BY 'myotherpassword';

Connection settings

Change configuration settings in /etc/lemonldap-ng/lemonldap-ng.ini file (section configuration):

[configuration]
type = RDBI
dbiChain    = DBI:mysql:database=lemonldap-ng;host=1.2.3.4
dbiUser     = lemonldaprw
dbiPassword = mypassword
; optional
dbiTable    = mytablename

PostGreSQL

Perl Driver

You need DBD::Pg Perl module:

apt install libdbd-pg-perl
yum install perl-DBD-Pg

Database and table creation

Créer la base de données :

CREATE DATABASE lemonldap-ng;

Use database to create table:

USE lemonldap-ng

RDBI

CREATE TABLE lmconfig (
    cfgnum INTEGER NOT NULL,
    FIELD text NOT NULL,
    VALUE text,
    PRIMARY KEY (cfgNum,FIELD)
    );

CDBI

CREATE TABLE lmConfig (
    cfgnum INTEGER NOT NULL PRIMARY KEY,
    DATA text
);

Connection settings

Change configuration settings in /etc/lemonldap-ng/lemonldap-ng.ini file (section configuration):

[configuration]
type = RDBI
dbiChain    = DBI:Pg:database=lemonldap-ng;host=1.2.3.4
dbiUser     = lemonldaprw
dbiPassword = mypassword
; optional
dbiTable    = mytablename