Commit 5ffac300 authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : Change in configuration storage format (Closes: #307173) and documentation

parent d420e2bb
......@@ -19,23 +19,32 @@ portal
domain
'example.com'
whatToTrace
'$uid'
groups
'$data1 = {};'
macros
'$data1 = {};'
globalStorage
'Apache::Session::File'
globalStorageOptions
'BAcEMTIzNAQEBAgZAAEAAAAXBC90bXACCQAAAERpcmVjdG9yeQ=='
'$data1 = {&39;Directory&39; => &39;/tmp&39;};'
exportedHeaders
'BAcEMTIzNAQEBAgZAAEAAAAEGQABAAAAFwQkdWlkAgkAAABBdXRoLVVzZXICEAAAAHRlc3QuZXhhbXBsZS5jb20='
'$data1 = {&39;test.example.com&39; => {&39;Auth-User&39; => &39;$uid&39;}};'
exportedVars
'BAcEMTIzNAQEBAgZAAMAAAAXA3VpZAIDAAAAdWlkFwJjbgICAAAAY24XBG1haWwCBAAAAG1haWw='
'$data1 = {&39;uid&39; => &39;uid&39;,&39;cn&39; => &39;cn&39;,&39;mail&39; => &39;mail&39;};'
authentication
'ldap'
locationRules
'BAcEMTIzNAQEBAgZAAEAAAAEGQABAAAAFwZhY2NlcHQCBwAAAGRlZmF1bHQCEAAAAHRlc3QuZXhhbXBsZS5jb20='
'$data1 = {&39;test.example.com&39; => {&39;default&39; => &39;accept&39;}};'
cfgNum
1
......
......@@ -2,28 +2,19 @@ lemonldap-ng for Debian
-----------------------
Topics:
1 - Configuration storage
1 - Manager installation
2 - Portal installation
3 - Manager installation
4 - Area protection
3 - Area protection
4 - Configuration storage
I - LEMONLDAP::NG CONFIGURATION STORAGE
---------------------------------------
Package: liblemonldap-ng-conf-perl
Lemonldap::NG configuration is stored by default in /var/lib/lemonldap-ng/conf.
Modify /etc/lemonldap-ng/storage.conf to change configuration storage.
1.1 - Migrating from 'File' to 'DBI'
To use DBI mechanism to store configuration, you have to create database. An
example is given for MySQL in the file
/usr/share/doc/liblemonldap-ng-conf-perl/examples/lmConfig.mysql.
If you have a running configuration, use this to populate SQL database :
I - LEMONLDAP::NG MANAGER INSTALLATION
----------------------------------------
Package: liblemonldap-ng-manager-perl
perl /usr/share/lemonldap-ng/bin/lmConfig_File2MySQL \
/var/lib/lemonldap-ng/conf/lmConf-<last-number>
liblemonldap-ng-manager-perl installs files named manager-apache.conf and
manager-apache2.conf in /etc/lemonldap-ng/. Include it in apache configuration
and configure it (virtual host has to be adapt).
II - LEMONLDAP::NG PORTAL INSTALLATION
......@@ -32,23 +23,36 @@ Package: liblemonldap-ng-portal-perl
liblemonldap-ng-portal-perl installs files named portal-apache.conf and
portal-apache2.conf in /etc/lemonldap-ng/. Include it in apache configuration
and personalize files in /var/lib/lemonldap-ng/portal.
and configure it (virtual host has to be adapt). You can also customize
/var/lib/lemonldap-ng/portal/index.pl to adapt it to your site. This file is
protected against upgrade.
III - LEMONLDAP::NG MANAGER INSTALLATION
----------------------------------------
Package: liblemonldap-ng-manager-perl
liblemonldap-ng-manager-perl installs files named manager-apache.conf and
manager-apache2.conf in /etc/lemonldap-ng/. Include it in apache configuration
and personalize files in /var/lib/lemonldap-ng/manager.
IV - LEMONLDAP::NG AREA PROTECTION
III - LEMONLDAP::NG AREA PROTECTION
----------------------------------
Package: liblemonldap-ng-handler-perl
liblemonldap-ng-handler-perl installs a file named MyHandler.pm in
/var/lib/lemonldap-ng/handler/. See handler-apache.conf or handler-apache2.conf
in /usr/share/doc/liblemonldap-ng-handler-perl/examples/ to know how to use it.
in /etc/lemonldap-ng/ to know how to use it.
IV - LEMONLDAP::NG CONFIGURATION STORAGE
---------------------------------------
Package: liblemonldap-ng-conf-perl
Lemonldap::NG configuration is stored by default in /var/lib/lemonldap-ng/conf.
Modify /etc/lemonldap-ng/storage.conf to change configuration storage.
1.1 - Migrating from 'File' to 'DBI'
To use DBI mechanism to store configuration, you have to create database. An
example is given for MySQL in the file
/usr/share/doc/liblemonldap-ng-conf-perl/examples/lmConfig.mysql.
If you have a running configuration, use this to populate SQL database :
perl /usr/share/lemonldap-ng/bin/lmConfig_File2MySQL -c \
/var/lib/lemonldap-ng/conf/lmConf-<last-number>
"-c" options adds "create table" instruction.
lemonldap-ng (0.8.2.3) unstable; urgency=low
* Change configuration storage format (Storable bug).
Closes: #307173/objectweb.org
-- Xavier Guimard <x.guimard@free.fr> Wed, 13 Jun 2007 13:49:27 +0200
lemonldap-ng (0.8.2.2) unstable; urgency=low
* Debian packages modifications due to Lintian control.
......
......@@ -5,7 +5,9 @@
# Area protection
PerlHeaderParserHandler My::Package
# Configuration reload mechanism
# Configuration reload mechanism (only 1 per physical server is
# needed): choose your URL to avoid restarting Apache when
# configuration change
<Location /reload>
Order deny,allow
Deny from all
......@@ -13,7 +15,7 @@
PerlHeaderParserHandler My::Package->refresh
</Location>
# Optional interception of the logout URL
# Optional interception of the logout URL => single logout
<Location /logout>
PerlHeaderParserHandler My::Package->logout
</Location>
......
......@@ -6,7 +6,9 @@ PerlOptions +GlobalRequest
# Area protection
PerlHeaderParserHandler My::Package
# Configuration reload mechanism
# Configuration reload mechanism (only 1 per physical server is
# needed): choose your URL to avoid restarting Apache when
# configuration change
<Location /reload>
Order deny,allow
Deny from all
......@@ -14,7 +16,7 @@ PerlOptions +GlobalRequest
PerlHeaderParserHandler My::Package->refresh
</Location>
# Optional interception of the logout URL
# Optional interception of the logout URL => single logout
<Location /logout>
PerlHeaderParserHandler My::Package->logout
</Location>
......
......@@ -17,6 +17,6 @@ then
db_get liblemonldap-ng-conf-perl/$i || true
perl -000 -i -pe "s#^$i(\\n\\s+)('?)[^\\n]*?('?)\$#$i\${1}\${2}$RET\${3}#m" $FIRSTCONFFILE
done
perl -000 -i -pe "s#^(globalStorageOptions\\n\\s+)'[^\\n]*?'\$#\${1}\'BAcEMTIzNAQEBAgDAgAAAAofL3Zhci9saWIvbGVtb25sZGFwLW5nL3Nlc3Npb25zLwkAAABEaXJlY3RvcnkKJC92YXIvbGliL2xlbW9ubGRhcC1uZy9zZXNzaW9ucy9sb2NrLw0AAABMb2NrRGlyZWN0b3J5'#m" $FIRSTCONFFILE
perl -000 -i -pe "s#^(globalStorageOptions\\n\\s+)'[^\\n]*?'\$#\${1}\'\\\$data1 = {&39;Directory&39; => &39;/var/lib/lemonldap-ng/sessions/&39;,&39;LockDirectory&39; => &39;/var/lib/lemonldap-ng/sessions/lock/&39;};'#m" $FIRSTCONFFILE
fi
exit 0
......@@ -306,9 +306,9 @@ __PACKAGE__-&gt;init ( {
</ol>Pour le deuxi&egrave;me point, la modification est tr&egrave;s simple
: il faut remplacer <tt>$uid</tt> par <tt>$cn</tt> dans le champ
"Param&egrave;tres g&eacute;n&eacute;raux -&gt; Donn&eacute;e &agrave;
inscrire dans les journaux d'Apache (et v&eacute;rifier que cette variable
est d&eacute;clar&eacute;e dand les attributs &agrave; exporter). Le
changement de filtre de recherche n&eacute;cessite la surcharge d'une
inscrire dans les journaux d'Apache" (et v&eacute;rifier que cette
variable est d&eacute;clar&eacute;e dand les attributs &agrave; exporter).
Le changement de filtre de recherche n&eacute;cessite la surcharge d'une
m&eacute;thode dans le portail. Cette modification peut &ecirc;tre
effectu&eacute;e comme suit:
<pre>
......@@ -351,9 +351,7 @@ my $portal = Lemonldap::NG::Portal::SharedConf-&gt;new(
# on peut aussi utiliser mod_rewrite
# RewriteEngine On
# RewriteRule /(.*)$ <span class="nobr"><a href=
"http://serveur-reel/$1">http://serveur-reel/$1</a></span> <a class=
"wikicreatelink" href="/xwiki/bin/edit/NG/P?parent=NG.FAQ"><span class=
"wikicreatelinktext">P</span><span class="wikicreatelinkqm">?</span></a>
"http://serveur-reel/$1">http://serveur-reel/$1</a></span> [P]
&lt;/VirtualHost&gt;
</pre>
......
This diff is collapsed.
......@@ -6,6 +6,7 @@ use utf8;
my $docs = {
'http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/FAQ?language=fr' => 'faq-fr.html',
'http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/FAQ?language=en' => 'faq.html',
'http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/Presentation?language=en' => 'overview.html',
'http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/Presentation?language=fr' => 'overview-fr.html',
'http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/DocInstallExample?language=en' => 'install.html',
......
Revision history for Perl extension Lemonldap::NG::Manager.
0.7 Tue jun 12 22:20:54 2007
- Changing storage format due to a bug in Storable module
0.66 Tue May 15 19:53:40 2007
- Little bug correction: '-' is authorized in domain names
......
......@@ -16,7 +16,7 @@ use MIME::Base64;
our @ISA = qw(Lemonldap::NG::Manager::Base);
our $VERSION = '0.66';
our $VERSION = '0.7';
sub new {
my ( $class, $args ) = @_;
......
......@@ -2,11 +2,12 @@ package Lemonldap::NG::Manager::Conf;
use strict;
no strict 'refs';
use Storable qw(thaw freeze);
use MIME::Base64;
use Data::Dumper;
use Lemonldap::NG::Manager::Conf::Constants;
our $VERSION = 0.45;
$Data::Dumper::Indent = 0;
$Data::Dumper::Varname = "data";
our $VERSION = 0.5;
our @ISA;
sub new {
......@@ -43,8 +44,9 @@ sub saveConf {
my $fields;
while ( my ( $k, $v ) = each(%$conf) ) {
if ( ref($v) ) {
$fields->{$k} = "'" . encode_base64( freeze($v) ) . "'";
$fields->{$k} =~ s/[\r\n]//g;
$fields->{$k} = Dumper($v);
$fields->{$k} =~ s/'/&39;/g;
$fields->{$k} = "'$fields->{$k}'";
}
elsif ( $v =~ /^\d+$/ ) {
$fields->{$k} = "$v";
......@@ -73,8 +75,21 @@ sub getConf {
my $conf;
while ( my ( $k, $v ) = each(%$fields) ) {
$v =~ s/^'(.*)'$/$1/m;
if( $k =~ /^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions)$/ ) {
$conf->{$k} = thaw(decode_base64($v));
if( $k =~ /^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions)$/ ) {
my $data1;
if ( $v !~ /^\$/ ) {
print STDERR "Lemonldap::NG : Warning: configuration is in old format, you've to migrate !\n";
eval 'require Storable;require MIME::Base64;';
$conf->{$k} = Storable::thaw(MIME::Base64::decode_base64($v));
}
else {
my $data;
$v =~ s/^\$([_a-zA-Z][_a-zA-Z0-9]*) *=/\$data =/;
eval $v;
print STDERR "Lemonldap::NG : Error while reading configuration with $k key: $@\n" if($@);
$data =~ s/&39;/'/g;
$conf->{$k} = $data;
}
}
else {
$conf->{$k} = $v;
......
......@@ -2,11 +2,10 @@ package Lemonldap::NG::Manager::Conf::DBI;
use strict;
use DBI;
use Storable qw(freeze thaw);
use MIME::Base64;
use Lemonldap::NG::Manager::Conf::Constants;
our $VERSION = 0.14;
our $VERSION = 0.15;
BEGIN {
*Lemonldap::NG::Manager::Conf::dbh = \&dbh;
......
......@@ -367,7 +367,10 @@ sub store {
eval {
tie %h, $self->{globalStorage}, undef, $self->{globalStorageOptions};
};
return PE_APACHESESSIONERROR if ($@);
if ( $@ ) {
print STDERR "$@\n";
return PE_APACHESESSIONERROR;
}
$self->{id} = $h{_session_id};
$h{$_} = $self->{sessionInfo}->{$_}
foreach ( keys %{ $self->{sessionInfo} } );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment