2016-10-15 19:57:54 +02:00
<!DOCTYPE html>
< html lang = "fr" dir = "ltr" >
< head >
< meta http-equiv = "content-type" content = "text/html; charset=UTF-8" >
< meta charset = "utf-8" / >
2017-02-07 17:35:26 +01:00
< title > documentation:2.0:sqlconfbackend< / title > <!-- //if:usedebianlibs
< link rel = "stylesheet" type = "text/css" href = "/javascript/bootstrap/css/bootstrap.min.css" / >
//elsif:useexternallibs
< link rel = "stylesheet" type = "text/css" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" > < / script >
//elsif:cssminified
< link rel = "stylesheet" type = "text/css" href = "/static/bwr/bootstrap/dist/css/bootstrap.min.css" / >
//else --><!-- //endif -->
2016-10-15 19:57:54 +02:00
< meta name = "generator" content = "DokuWiki" / >
< meta name = "robots" content = "index,follow" / >
< meta name = "keywords" content = "documentation,2.0,sqlconfbackend" / >
< link rel = "search" type = "application/opensearchdescription+xml" href = "lib/exe/opensearch.html" title = "LemonLDAP::NG" / >
< link rel = "start" href = "sqlconfbackend.html" / >
< link rel = "contents" href = "sqlconfbackend.html" title = "Sitemap" / >
< link rel = "stylesheet" type = "text/css" href = "lib/exe/css.php.t.bootstrap3.css" / >
2017-02-07 17:35:26 +01:00
< link rel = "stylesheet" type = "text/css" href = "/static/bwr/bootstrap/dist/css/bootstrap.css" / >
2016-10-15 19:57:54 +02:00
< script type = "text/javascript" > / * < ! [ C D A T A [ * / v a r N S = ' d o c u m e n t a t i o n : 2 . 0 ' ; v a r J S I N F O = { " i d " : " d o c u m e n t a t i o n : 2 . 0 : s q l c o n f b a c k e n d " , " n a m e s p a c e " : " d o c u m e n t a t i o n : 2 . 0 " } ;
/*!]]>*/< / script >
2017-02-07 17:35:26 +01:00
< script type = "text/javascript" charset = "utf-8" src = "lib/exe/js.php.t.bootstrap3.js" > < / script > <!-- //if:usedebianlibs
< script type = "text/javascript" src = "/javascript/jquery/jquery.min.js" > < / script >
//elsif:useexternallibs
< script type = "text/javascript" src = "http://code.jquery.com/jquery-2.2.0.min.js" > < / script >
//elsif:jsminified
< script type = "text/javascript" src = "/static/bwr/jquery/dist/jquery.min.js" > < / script >
//else -->
< script type = "text/javascript" src = "/static/bwr/jquery/dist/jquery.js" > < / script > <!-- //endif --> <!-- //if:usedebianlibs
< script type = "text/javascript" src = "/javascript/jquery-ui/jquery-ui.min.js" > < / script >
//elsif:useexternallibs
< script type = "text/javascript" src = "http://code.jquery.com/ui/1.10.4/jquery-ui.min.js" > < / script >
//elsif:jsminified
< script type = "text/javascript" src = "/lib/scripts/jquery-ui.min.js" > < / script >
//else -->
< script type = "text/javascript" src = "/lib/scripts/jquery-ui.js" > < / script > <!-- //endif -->
2016-10-15 19:57:54 +02:00
< / head >
< body >
< div class = "dokuwiki export container" > <!-- TOC START -->
< div id = "dw__toc" >
< h3 class = "toggle" > Table of Contents< / h3 >
< div >
< ul class = "toc" >
2018-02-21 22:17:33 +01:00
< li class = "level1" > < div class = "li" > < a href = "#mysql" > MySQL< / a > < / div >
2016-10-15 19:57:54 +02:00
< ul class = "toc" >
2018-02-21 22:17:33 +01:00
< li class = "level2" > < div class = "li" > < a href = "#perl_driver" > Perl Driver< / a > < / div > < / li >
< li class = "level2" > < div class = "li" > < a href = "#database_and_table_creation" > Database and table creation< / a > < / div >
2016-10-15 19:57:54 +02:00
< ul class = "toc" >
< li class = "level3" > < div class = "li" > < a href = "#rdbi" > RDBI< / a > < / div > < / li >
< li class = "level3" > < div class = "li" > < a href = "#cdbi" > CDBI< / a > < / div > < / li >
< / ul >
< / li >
2018-02-21 22:17:33 +01:00
< li class = "level2" > < div class = "li" > < a href = "#grant_access" > Grant access< / a > < / div > < / li >
< / ul >
< / li >
< li class = "level1" > < div class = "li" > < a href = "#connection_settings" > Connection settings< / a > < / div > < / li >
< li class = "level1" > < div class = "li" > < a href = "#postgresql" > PostGreSQL< / a > < / div >
< ul class = "toc" >
< li class = "level2" > < div class = "li" > < a href = "#perl_driver1" > Perl Driver< / a > < / div > < / li >
< li class = "level2" > < div class = "li" > < a href = "#database_and_table_creation1" > Database and table creation< / a > < / div >
< ul class = "toc" >
< li class = "level3" > < div class = "li" > < a href = "#rdbi1" > RDBI< / a > < / div > < / li >
< li class = "level3" > < div class = "li" > < a href = "#cdbi1" > CDBI< / a > < / div > < / li >
< / ul >
< / li >
< / ul >
< / li >
< li class = "level1" > < div class = "li" > < a href = "#connection_settings1" > Connection settings< / a > < / div > < / li >
2016-10-15 19:57:54 +02:00
< / ul >
< / div >
< / div > <!-- TOC END -->
< h1 class = "sectionedit1" id = "sql_configuration_backends" > Backends de configuration SQL< / h1 >
< div class = "level1" >
< p >
2018-02-21 22:17:33 +01:00
There is 2 types of SQL configuration backends for LemonLDAP::NG:
2016-10-15 19:57:54 +02:00
< / p >
< ul >
2018-02-21 22:17:33 +01:00
< li class = "level1" > < div class = "li" > < strong > CDBI< / strong > : very simple storage< / div >
2016-10-15 19:57:54 +02:00
< / li >
2018-02-21 22:17:33 +01:00
< li class = "level1" > < div class = "li" > < strong > RDBI< / strong > : triple store storage (recommended)< / div >
2016-10-15 19:57:54 +02:00
< / li >
< / ul >
2018-02-21 22:17:33 +01:00
< div class = "notetip" > 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.
< / div >
< p >
See < a href = "changeconfbackend.html" class = "wikilink1" title = "documentation:2.0:changeconfbackend" > how to change configuration backend< / a > .
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< / p >
< / div > <!-- EDIT1 SECTION "SQL configuration backends" [1 - 423] -->
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< h2 class = "sectionedit2" id = "mysql" > MySQL< / h2 >
2016-10-15 19:57:54 +02:00
< div class = "level2" >
2018-02-21 22:17:33 +01:00
< / div > <!-- EDIT2 SECTION "MySQL" [424 - 442] -->
< h3 class = "sectionedit3" id = "perl_driver" > Perl Driver< / h3 >
< div class = "level3" >
2016-10-15 19:57:54 +02:00
< p >
2018-02-21 22:17:33 +01:00
You need DBD::MySQL Perl module:
2016-10-15 19:57:54 +02:00
< / p >
< ul >
2018-02-21 22:17:33 +01:00
< li class = "level1" > < div class = "li" > Debian:< / div >
2016-10-15 19:57:54 +02:00
< / li >
2018-02-21 22:17:33 +01:00
< / ul >
< pre class = "code" > apt install libdbd-mysql-perl< / pre >
< ul >
< li class = "level1" > < div class = "li" > Red Hat:< / div >
2016-10-15 19:57:54 +02:00
< / li >
< / ul >
2018-02-21 22:17:33 +01:00
< pre class = "code" > yum install perl-DBD-MySQL< / pre >
< / div > <!-- EDIT3 SECTION "Perl Driver" [443 - 611] -->
< h3 class = "sectionedit4" id = "database_and_table_creation" > Database and table creation< / h3 >
< div class = "level3" >
2016-10-15 19:57:54 +02:00
< p >
2018-02-21 22:17:33 +01:00
Créer la base de données :
2016-10-15 19:57:54 +02:00
< / p >
2018-02-21 22:17:33 +01:00
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > DATABASE< / span > lemonldap< span class = "sy0" > -< / span > ng < span class = "kw1" > CHARACTER< / span > < span class = "kw1" > SET< / span > utf8;< / pre >
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< p >
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
Use database to create table:
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< / p >
< pre class = "code sql" > < span class = "kw1" > USE< / span > lemonldap< span class = "sy0" > -< / span > ng< / pre >
2016-10-15 19:57:54 +02:00
< / div >
< h4 id = "rdbi" > RDBI< / h4 >
< div class = "level4" >
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > TABLE< / span > lmConfig < span class = "br0" > (< / span >
cfgNum < span class = "kw1" > INT< / span > < span class = "br0" > (< / span > < span class = "nu0" > 11< / span > < span class = "br0" > )< / span > < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "sy0" > ,< / span >
< span class = "kw1" > FIELD< / span > < span class = "kw1" > VARCHAR< / span > < span class = "br0" > (< / span > < span class = "nu0" > 255< / span > < span class = "br0" > )< / span > < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "kw1" > DEFAULT< / span > < span class = "st0" > ''< / span > < span class = "sy0" > ,< / span >
2018-02-21 22:17:33 +01:00
< span class = "kw1" > VALUE< / span > longtext< span class = "sy0" > ,< / span >
2016-10-15 19:57:54 +02:00
< span class = "kw1" > PRIMARY< / span > < span class = "kw1" > KEY< / span > < span class = "br0" > (< / span > cfgNum< span class = "sy0" > ,< / span > < span class = "kw1" > FIELD< / span > < span class = "br0" > )< / span >
< span class = "br0" > )< / span > ;< / pre >
< / div >
< h4 id = "cdbi" > CDBI< / h4 >
< div class = "level4" >
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > TABLE< / span > lmConfig < span class = "br0" > (< / span >
cfgNum < span class = "kw1" > INT< / span > < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "kw1" > PRIMARY< / span > < span class = "kw1" > KEY< / span > < span class = "sy0" > ,< / span >
2018-02-21 22:17:33 +01:00
< span class = "kw1" > DATA< / span > longtext
2016-10-15 19:57:54 +02:00
< span class = "br0" > )< / span > ;< / pre >
2018-02-21 22:17:33 +01:00
< / div > <!-- EDIT4 SECTION "Database and table creation" [612 - 1104] -->
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< h3 class = "sectionedit5" id = "grant_access" > Grant access< / h3 >
2016-10-15 19:57:54 +02:00
< div class = "level3" >
< p >
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.
< / p >
2018-02-21 22:17:33 +01:00
< div class = "notetip" > You can use different dbiUser strings:< ul >
2016-10-15 19:57:54 +02:00
< li class = "level1" > < div class = "li" > une avec des droits en lecture/écriture pour les serveurs hébergeant le manager< / div >
< / li >
< li class = "level1" > < div class = "li" > une avec seulement des droits en lecture pour les autres serveurs< / div >
< / li >
< / ul >
< / div >
< p >
2018-02-21 22:17:33 +01:00
For example (suppose that our servers are in 10.0.0.0/24 network):
2016-10-15 19:57:54 +02:00
< / p >
2017-02-07 17:35:26 +01:00
< pre class = "code sql" > < span class = "kw1" > GRANT< / span > < span class = "kw1" > SELECT< / span > < span class = "sy0" > ,< / span > < span class = "kw1" > INSERT< / span > < span class = "sy0" > ,< / span > < span class = "kw1" > UPDATE< / span > < span class = "sy0" > ,< / span > < span class = "kw1" > DELETE< / span > < span class = "sy0" > ,< / span > < span class = "kw1" > LOCK< / span > < span class = "kw1" > TABLES< / span > < span class = "kw1" > ON< / span > lemonldap< span class = "sy0" > -< / span > ng< span class = "sy0" > .< / span > lmConfig
2018-02-21 22:17:33 +01:00
< span class = "kw1" > TO< / span > lemonldaprw@manager< span class = "sy0" > .< / span > host < span class = "kw1" > IDENTIFIED< / span > < span class = "kw1" > BY< / span > < span class = "st0" > 'mypassword'< / span > ;
2017-02-07 17:35:26 +01:00
< span class = "kw1" > GRANT< / span > < span class = "kw1" > SELECT< / span > < span class = "kw1" > ON< / span > lemonldap< span class = "sy0" > -< / span > ng< span class = "sy0" > .< / span > lmConfig
2018-02-21 22:17:33 +01:00
< span class = "kw1" > TO< / span > lemonldapro@< span class = "st0" > '10.0.0.%'< / span > < span class = "kw1" > IDENTIFIED< / span > < span class = "kw1" > BY< / span > < span class = "st0" > 'myotherpassword'< / span > ;< / pre >
< / div > <!-- EDIT5 SECTION "Grant access" [1105 - 1759] -->
< h2 class = "sectionedit6" id = "connection_settings" > Connection settings< / h2 >
< div class = "level2" >
< p >
Change configuration settings in < code > /etc/lemonldap-ng/lemonldap-ng.ini< / code > file (section configuration):
< / p >
< pre class = "code ini" > < span class = "re0" > < span class = "br0" > [< / span > configuration< span class = "br0" > ]< / span > < / span >
< span class = "re1" > type< / span > < span class = "sy0" > =< / span > < span class = "re2" > RDBI< / span >
< span class = "re1" > dbiChain< / span > < span class = "sy0" > =< / span > < span class = "re2" > DBI:mysql:database=lemonldap-ng< / span > < span class = "co0" > ;host=1.2.3.4< / span >
< span class = "re1" > dbiUser< / span > < span class = "sy0" > =< / span > < span class = "re2" > lemonldaprw< / span >
< span class = "re1" > dbiPassword< / span > < span class = "sy0" > =< / span > < span class = "re2" > mypassword< / span >
< span class = "co0" > ; optional< / span >
< span class = "re1" > dbiTable< / span > < span class = "sy0" > =< / span > < span class = "re2" > mytablename< / span > < / pre >
< / div > <!-- EDIT6 SECTION "Connection settings" [1760 - 2090] -->
< h2 class = "sectionedit7" id = "postgresql" > PostGreSQL< / h2 >
< div class = "level2" >
< / div > <!-- EDIT7 SECTION "PostGreSQL" [2091 - 2114] -->
< h3 class = "sectionedit8" id = "perl_driver1" > Perl Driver< / h3 >
< div class = "level3" >
< p >
You need DBD::Pg Perl module:
< / p >
< ul >
< li class = "level1" > < div class = "li" > Debian:< / div >
< / li >
< / ul >
< pre class = "code" > apt install libdbd-pg-perl< / pre >
< ul >
< li class = "level1" > < div class = "li" > Red Hat:< / div >
< / li >
< / ul >
< pre class = "code" > yum install perl-DBD-Pg< / pre >
< / div > <!-- EDIT8 SECTION "Perl Driver" [2115 - 2274] -->
< h3 class = "sectionedit9" id = "database_and_table_creation1" > Database and table creation< / h3 >
< div class = "level3" >
< p >
Créer la base de données :
< / p >
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > DATABASE< / span > lemonldap< span class = "sy0" > -< / span > ng;< / pre >
< p >
Use database to create table:
< / p >
< pre class = "code sql" > < span class = "kw1" > USE< / span > lemonldap< span class = "sy0" > -< / span > ng< / pre >
< / div >
< h4 id = "rdbi1" > RDBI< / h4 >
< div class = "level4" >
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > TABLE< / span > lmconfig < span class = "br0" > (< / span >
cfgnum < span class = "kw1" > INTEGER< / span > < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "sy0" > ,< / span >
< span class = "kw1" > FIELD< / span > text < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "sy0" > ,< / span >
< span class = "kw1" > VALUE< / span > text< span class = "sy0" > ,< / span >
< span class = "kw1" > PRIMARY< / span > < span class = "kw1" > KEY< / span > < span class = "br0" > (< / span > cfgNum< span class = "sy0" > ,< / span > < span class = "kw1" > FIELD< / span > < span class = "br0" > )< / span >
< span class = "br0" > )< / span > ;< / pre >
< / div >
< h4 id = "cdbi1" > CDBI< / h4 >
< div class = "level4" >
< pre class = "code sql" > < span class = "kw1" > CREATE< / span > < span class = "kw1" > TABLE< / span > lmConfig < span class = "br0" > (< / span >
cfgnum < span class = "kw1" > INTEGER< / span > < span class = "kw1" > NOT< / span > < span class = "kw1" > NULL< / span > < span class = "kw1" > PRIMARY< / span > < span class = "kw1" > KEY< / span > < span class = "sy0" > ,< / span >
< span class = "kw1" > DATA< / span > text
< span class = "br0" > )< / span > ;< / pre >
< / div > <!-- EDIT9 SECTION "Database and table creation" [2275 - 2725] -->
< h2 class = "sectionedit10" id = "connection_settings1" > Connection settings< / h2 >
< div class = "level2" >
< p >
Change configuration settings in < code > /etc/lemonldap-ng/lemonldap-ng.ini< / code > file (section configuration):
< / p >
< pre class = "code ini" > < span class = "re0" > < span class = "br0" > [< / span > configuration< span class = "br0" > ]< / span > < / span >
< span class = "re1" > type< / span > < span class = "sy0" > =< / span > < span class = "re2" > RDBI< / span >
< span class = "re1" > dbiChain< / span > < span class = "sy0" > =< / span > < span class = "re2" > DBI:Pg:database=lemonldap-ng< / span > < span class = "co0" > ;host=1.2.3.4< / span >
< span class = "re1" > dbiUser< / span > < span class = "sy0" > =< / span > < span class = "re2" > lemonldaprw< / span >
< span class = "re1" > dbiPassword< / span > < span class = "sy0" > =< / span > < span class = "re2" > mypassword< / span >
< span class = "co0" > ; optional< / span >
< span class = "re1" > dbiTable< / span > < span class = "sy0" > =< / span > < span class = "re2" > mytablename< / span > < / pre >
2016-10-15 19:57:54 +02:00
2018-02-21 22:17:33 +01:00
< / div > <!-- EDIT10 SECTION "Connection settings" [2726 - ] -->
2016-10-15 19:57:54 +02:00
< / div >
< / body >
< / html >