From 0835ae9806627cd063d1bbb0626ce19f21690f32 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Tue, 1 May 2007 14:53:26 +0000 Subject: [PATCH] LEMONLDAP::NG : Better Debian structure and debconf management --- build/lemonldap-ng/Makefile | 4 +- build/lemonldap-ng/TODO | 4 + build/lemonldap-ng/debian/README.Debian | 52 ++++++++++- build/lemonldap-ng/debian/changelog | 7 +- build/lemonldap-ng/debian/configStorage.pm | 21 +++++ build/lemonldap-ng/debian/control | 8 +- build/lemonldap-ng/debian/dirs | 1 - build/lemonldap-ng/debian/docs | 0 build/lemonldap-ng/debian/handler-apache.conf | 20 ++++ .../lemonldap-ng/debian/handler-apache2.conf | 21 +++++ build/lemonldap-ng/debian/lemonldap-ng.docs | 1 + .../lemonldap-ng/debian/lemonldap-ng.examples | 2 +- .../liblemonldap-ng-conf-perl.conffiles | 1 + .../debian/liblemonldap-ng-conf-perl.config | 25 +++++ .../debian/liblemonldap-ng-conf-perl.dirs | 4 + .../debian/liblemonldap-ng-conf-perl.docs | 2 + .../debian/liblemonldap-ng-conf-perl.examples | 3 + .../debian/liblemonldap-ng-conf-perl.install | 7 ++ .../debian/liblemonldap-ng-conf-perl.postinst | 21 +++++ .../liblemonldap-ng-conf-perl.templates | 92 +++++++++++++++++++ .../debian/liblemonldap-ng-handler-perl.dirs | 3 + .../debian/liblemonldap-ng-handler-perl.docs | 2 + .../liblemonldap-ng-handler-perl.examples | 4 +- .../liblemonldap-ng-handler-perl.postinst | 20 ++++ .../liblemonldap-ng-manager-conf-perl.config | 7 -- .../liblemonldap-ng-manager-conf-perl.dirs | 2 - ...liblemonldap-ng-manager-conf-perl.examples | 3 - .../liblemonldap-ng-manager-conf-perl.install | 5 - ...liblemonldap-ng-manager-conf-perl.postinst | 10 -- ...iblemonldap-ng-manager-conf-perl.templates | 5 - .../liblemonldap-ng-manager-perl.conffiles | 3 + .../debian/liblemonldap-ng-manager-perl.dirs | 3 + .../debian/liblemonldap-ng-manager-perl.docs | 2 + .../liblemonldap-ng-manager-perl.examples | 5 +- .../liblemonldap-ng-manager-perl.install | 5 + .../liblemonldap-ng-manager-perl.postinst | 21 +++++ .../liblemonldap-ng-portal-perl.conffiles | 2 + .../debian/liblemonldap-ng-portal-perl.cron.d | 4 + .../debian/liblemonldap-ng-portal-perl.dirs | 4 + .../debian/liblemonldap-ng-portal-perl.docs | 2 + .../liblemonldap-ng-portal-perl.examples | 2 +- .../liblemonldap-ng-portal-perl.install | 1 + .../liblemonldap-ng-portal-perl.postinst | 29 ++++++ build/lemonldap-ng/debian/manager-apache.conf | 24 +++++ .../lemonldap-ng/debian/manager-apache2.conf | 24 +++++ build/lemonldap-ng/debian/portal-apache.conf | 23 +++++ build/lemonldap-ng/debian/portal-apache2.conf | 23 +++++ build/lemonldap-ng/debian/rules | 16 +++- build/lemonldap-ng/debian/storage.conf | 28 ++++++ .../lemonldap-ng-handler/example/MyHandler.pm | 3 + modules/lemonldap-ng-manager/MANIFEST | 16 ++-- modules/lemonldap-ng-portal/MANIFEST | 2 + .../example/scripts/purgeCentralCache | 88 ++++++++++++++++++ .../example/scripts/purgeCentralCache.cron.d | 4 + 54 files changed, 632 insertions(+), 59 deletions(-) create mode 100644 build/lemonldap-ng/debian/configStorage.pm delete mode 100644 build/lemonldap-ng/debian/dirs delete mode 100644 build/lemonldap-ng/debian/docs create mode 100644 build/lemonldap-ng/debian/handler-apache.conf create mode 100644 build/lemonldap-ng/debian/handler-apache2.conf create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.conffiles create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.config create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.dirs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.docs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.examples create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.install create mode 100755 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.postinst create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.templates create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.dirs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.docs create mode 100755 build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.postinst delete mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.config delete mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.dirs delete mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.examples delete mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.install delete mode 100755 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.postinst delete mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.templates create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.conffiles create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.dirs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.docs create mode 100755 build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.postinst create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.conffiles create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.cron.d create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.dirs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.docs create mode 100644 build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.postinst create mode 100644 build/lemonldap-ng/debian/manager-apache.conf create mode 100644 build/lemonldap-ng/debian/manager-apache2.conf create mode 100644 build/lemonldap-ng/debian/portal-apache.conf create mode 100644 build/lemonldap-ng/debian/portal-apache2.conf create mode 100644 build/lemonldap-ng/debian/storage.conf create mode 100755 modules/lemonldap-ng-portal/example/scripts/purgeCentralCache create mode 100644 modules/lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d diff --git a/build/lemonldap-ng/Makefile b/build/lemonldap-ng/Makefile index e32fb07b9..5dfcbcf25 100644 --- a/build/lemonldap-ng/Makefile +++ b/build/lemonldap-ng/Makefile @@ -81,8 +81,8 @@ manager_clean: rm -vf manager* example: all - mkdir -p example/portal example/manager example/handler example/conf - chmod 1777 example/conf + mkdir -p ${EXAMPLEDIRBUILD}/portal ${EXAMPLEDIRBUILD}/manager ${EXAMPLEDIRBUILD}/handler ${EXAMPLEDIRBUILD}/conf + chmod 1777 ${EXAMPLEDIRBUILD}/conf cp -a ${HANDLERDIR}/example/* ${EXAMPLEDIRBUILD}/handler cp -a ${PORTALDIR}/example/* ${EXAMPLEDIRBUILD}/portal cp -a ${MANAGERDIR}/example/* ${EXAMPLEDIRBUILD}/manager diff --git a/build/lemonldap-ng/TODO b/build/lemonldap-ng/TODO index 821d15bd4..a8a6cfc73 100644 --- a/build/lemonldap-ng/TODO +++ b/build/lemonldap-ng/TODO @@ -12,3 +12,7 @@ Simplified manager interface fo rules: * simple combobox to choose groups - Priority: Low Status: Planning Created: 2007\04\23 21-26-18 TLS in LDAP connection. SSL works, but start_tls cannot yet be called. +- Priority: Normal Status: Planning Created: 2007\05\01 08-59-18 +Time"-"out system +- Priority: Normal Status: In progress Created: 2007\05\01 08-59-46 +Debconf : LDAP parameters + session directory diff --git a/build/lemonldap-ng/debian/README.Debian b/build/lemonldap-ng/debian/README.Debian index 711a9a2bf..ce0094cf3 100644 --- a/build/lemonldap-ng/debian/README.Debian +++ b/build/lemonldap-ng/debian/README.Debian @@ -1,4 +1,54 @@ lemonldap-ng for Debian ----------------------- - -- Xavier Guimard Sun, 17 Dec 2006 17:46:47 +0100 +Topics: + 1 - Configuration storage + 2 - Portal installation + 3 - Manager installation + 4 - Area protection + + +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 : + + perl /usr/share/lemonldap-ng/bin/lmConfig_File2MySQL \ + /var/lib/lemonldap-ng/conf/lmConf- + + +II - LEMONLDAP::NG PORTAL INSTALLATION +-------------------------------------- +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. + + +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 +---------------------------------- +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. + diff --git a/build/lemonldap-ng/debian/changelog b/build/lemonldap-ng/debian/changelog index 5168df43d..bab5a2629 100644 --- a/build/lemonldap-ng/debian/changelog +++ b/build/lemonldap-ng/debian/changelog @@ -5,10 +5,11 @@ lemonldap-ng (0.8.1.2) unstable; urgency=low * New: port is now checked in portal redirection * Different configurations can now be used on the same server at the same time - * New debian structure: lemonldap-ng is splitted in 5 packages and default - configuration file has moved to /var/lib/lemonldap-ng/conf/ + * New debian structure: lemonldap-ng is splitted in 5 packages, default + configuration file has moved to /var/lib/lemonldap-ng/conf/ and first + configuration file is managed by debconf - -- Xavier Guimard Sun, 29 Apr 2007 14:00:39 +0200 + -- Xavier Guimard Tue, 01 May 2007 16:18:47 +0200 lemonldap-ng (0.8.1.1) unstable; urgency=low diff --git a/build/lemonldap-ng/debian/configStorage.pm b/build/lemonldap-ng/debian/configStorage.pm new file mode 100644 index 000000000..136e461a6 --- /dev/null +++ b/build/lemonldap-ng/debian/configStorage.pm @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +package Lemonldap::NG::Conf; + +our $configStorage; + +BEGIN { + open F, '/etc/lemonldap-ng/storage.conf' or die "/etc/lemonldap-ng/storage.conf: $!"; + while() { + next if(/^\s*$/ or /^\s*#/); + chomp; + /^\s*([\w]+)[\s=:]+(["']?)([\S].*[\S])\2.*$/ or next; + $configStorage->{$1} = $3; + my $k = $1; + if($configStorage->{$k} =~ /^([{\[]).*[}\]]$/) { + eval "\$configStorage->{$k} = $configStorage->{$k}"; + } + } + close F; +} +1; diff --git a/build/lemonldap-ng/debian/control b/build/lemonldap-ng/debian/control index d6b217baa..a711ce59d 100644 --- a/build/lemonldap-ng/debian/control +++ b/build/lemonldap-ng/debian/control @@ -14,12 +14,12 @@ Description: Lemonldap::NG Web-SSO system Package: liblemonldap-ng-handler-perl Architecture: all -Depends: libapache-session-perl, libwww-perl, libcache-cache-perl, liblemonldap-ng-manager-conf-perl +Depends: libapache-session-perl, libwww-perl, libcache-cache-perl, liblemonldap-ng-conf-perl Description: Lemonldap::NG apache module part Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies or directly on application apache servers. -Package: liblemonldap-ng-manager-conf-perl +Package: liblemonldap-ng-conf-perl Architecture: all Depends: libdbi-perl Recommends: libsoap-lite-perl @@ -29,7 +29,7 @@ Description: Lemonldap::NG apache manager part Package: liblemonldap-ng-manager-perl Architecture: all -Depends: libxml-simple-perl, liblemonldap-ng-manager-conf-perl +Depends: libxml-simple-perl, liblemonldap-ng-conf-perl Recommends: libcache-cache-perl, libapache-session-perl, libsoap-lite-perl Description: Lemonldap::NG apache manager part Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies @@ -37,7 +37,7 @@ Description: Lemonldap::NG apache manager part Package: liblemonldap-ng-portal-perl Architecture: all -Depends: libapache-session-perl, libnet-ldap-perl, liblemonldap-ng-manager-conf-perl +Depends: libapache-session-perl, libnet-ldap-perl, liblemonldap-ng-conf-perl Recommends: liblasso-perl Description: Lemonldap::NG apache authentication portal part Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies diff --git a/build/lemonldap-ng/debian/dirs b/build/lemonldap-ng/debian/dirs deleted file mode 100644 index dd222dbfa..000000000 --- a/build/lemonldap-ng/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -usr/share diff --git a/build/lemonldap-ng/debian/docs b/build/lemonldap-ng/debian/docs deleted file mode 100644 index e69de29bb..000000000 diff --git a/build/lemonldap-ng/debian/handler-apache.conf b/build/lemonldap-ng/debian/handler-apache.conf new file mode 100644 index 000000000..0231dedd3 --- /dev/null +++ b/build/lemonldap-ng/debian/handler-apache.conf @@ -0,0 +1,20 @@ + + ServerName protected.example.com + PerlRequire /var/lib/lemonldap-ng/handler/MyHandler.pm + + # Area protection + PerlHeaderParserHandler My::Package + + # Configuration reload mechanism + + Order deny,allow + Deny from all + Allow from 127.0.0.0/8 + PerlHeaderParserHandler My::Package->refresh + + + # Optional interception of the logout URL + + PerlHeaderParserHandler My::Package->logout + + diff --git a/build/lemonldap-ng/debian/handler-apache2.conf b/build/lemonldap-ng/debian/handler-apache2.conf new file mode 100644 index 000000000..62f0ffbe1 --- /dev/null +++ b/build/lemonldap-ng/debian/handler-apache2.conf @@ -0,0 +1,21 @@ +PerlOptions +GlobalRequest + + ServerName protected.example.com + PerlRequire /var/lib/lemonldap-ng/handler/MyHandler.pm + + # Area protection + PerlHeaderParserHandler My::Package + + # Configuration reload mechanism + + Order deny,allow + Deny from all + Allow from 127.0.0.0/8 + PerlHeaderParserHandler My::Package->refresh + + + # Optional interception of the logout URL + + PerlHeaderParserHandler My::Package->logout + + diff --git a/build/lemonldap-ng/debian/lemonldap-ng.docs b/build/lemonldap-ng/debian/lemonldap-ng.docs index df82a86cf..1cd855d36 100644 --- a/build/lemonldap-ng/debian/lemonldap-ng.docs +++ b/build/lemonldap-ng/debian/lemonldap-ng.docs @@ -1,3 +1,4 @@ +debian/README.Debian doc/* README INSTALL diff --git a/build/lemonldap-ng/debian/lemonldap-ng.examples b/build/lemonldap-ng/debian/lemonldap-ng.examples index 0bbe99ef5..9cfb2c667 100644 --- a/build/lemonldap-ng/debian/lemonldap-ng.examples +++ b/build/lemonldap-ng/debian/lemonldap-ng.examples @@ -1 +1 @@ -example/* +debian/tmp/var/lib/lemonldap-ng/test.pl diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.conffiles b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.conffiles new file mode 100644 index 000000000..1a7ced884 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.conffiles @@ -0,0 +1 @@ +/etc/lemonldap-ng/storage.conf diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.config b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.config new file mode 100644 index 000000000..66f806920 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.config @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e +. /usr/share/debconf/confmodule + +db_input high liblemonldap-ng-conf-perl/newDirInfo || true + +db_input medium liblemonldap-ng-conf-perl/domain || true + +db_input medium liblemonldap-ng-conf-perl/ldapServer || true + +db_input medium liblemonldap-ng-conf-perl/ldapPort || true + +db_input medium liblemonldap-ng-conf-perl/ldapBase || true + +db_input medium liblemonldap-ng-conf-perl/managerDn || true + +db_input medium liblemonldap-ng-conf-perl/managerPassword || true + +db_input medium liblemonldap-ng-conf-perl/portal || true + +db_input medium liblemonldap-ng-conf-perl/howto || true + +db_go || true + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.dirs b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.dirs new file mode 100644 index 000000000..5ee0105a1 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.dirs @@ -0,0 +1,4 @@ +/etc/lemonldap-ng +/usr/share +/usr/share/lemonldap-ng/bin +/var/lib/lemonldap-ng diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.docs b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.docs new file mode 100644 index 000000000..cfdc3012c --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.docs @@ -0,0 +1,2 @@ +debian/README.Debian + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.examples b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.examples new file mode 100644 index 000000000..44a07d148 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.examples @@ -0,0 +1,3 @@ +debian/tmp/var/lib/lemonldap-ng/apache-session-mysql.sql +debian/tmp/var/lib/lemonldap-ng/lmConfig.mysql +debian/tmp/var/lib/lemonldap-ng/conf diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.install b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.install new file mode 100644 index 000000000..bd78275da --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.install @@ -0,0 +1,7 @@ +debian/tmp/usr/share/perl5/Lemonldap/NG/Manager/Conf* +debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager::Conf* +debian/tmp/usr/share/man/man1/lmConfig_File2MySQL.1p +debian/tmp/usr/bin/lmConfig* /usr/share/lemonldap-ng/bin +debian/configStorage.pm /usr/share/lemonldap-ng +debian/storage.conf /etc/lemonldap-ng +debian/tmp/var/lib/lemonldap-ng/conf /var/lib/lemonldap-ng diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.postinst b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.postinst new file mode 100755 index 000000000..78bebb7de --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.postinst @@ -0,0 +1,21 @@ +#!/bin/bash +# Maintainer: #DEBHELPER# + +. /usr/share/debconf/confmodule + +FIRSTCONFFILE=/var/lib/lemonldap-ng/conf/lmConf-1 + +if [ "$1" == "configure" ] +then + chown -R www-data.www-data /var/lib/lemonldap-ng/conf + chmod 750 /var/lib/lemonldap-ng/conf + chmod 640 /var/lib/lemonldap-ng/conf/* + chgrp www-data /etc/lemonldap-ng/storage.conf + chmod 640 /etc/lemonldap-ng/storage.conf + + for i in domain ldapServer ldapPort ldapBase managerDn managerPassword portal; do + 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 +fi +exit 0 diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.templates b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.templates new file mode 100644 index 000000000..851e6577b --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-conf-perl.templates @@ -0,0 +1,92 @@ +Template: liblemonldap-ng-conf-perl/newDirInfo +Type: note +Description: Lemonldap::NG default configuration directory has moved to /var/lib/lemondap-ng/conf/ +Description-fr: Le répertoire de configuration par défaut est maintenant /var/lib/lemondap-ng/conf/ + +Template: liblemonldap-ng-conf-perl/ldapServer +Type: string +Default: localhost +Description: LDAP server + Set here name or IP address of the LDAP server that has to be used by + Lemonldap::NG. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Serveur LDAP + Indiquez ici le nom ou l'adresse IP du serveur LDAP que Lemonldap::NG utilisera. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/domain +Type: string +Default: example.com +Description: Lemonldap::NG DNS domain + Set here the main domain protected by Lemonldap::NG. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Domaine DNS de Lemonldap::NG + Indiquez ici le domaine principal protégé par lemonldap::NG. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/portal +Type: string +Default: http://auth.example.com/ +Description: Lemonldap::NG portal + Set here the Lemonldap::NG portal URL. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Port du serveur LDAP + Indiquez ici l'URL du portail Lemonldap::NG. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/ldapPort +Type: string +Default: 389 +Description: LDAP server port + Set here the port used by the LDAP server. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Port du serveur LDAP + Indiquez ici le numéro du port du serveur LDAP. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/ldapBase +Type: string +Default: dc=example,dc=com +Description: LDAP search base + Set here the search base to use in LDAP queries. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Base de recherche LDAP + Indiquez ici la base de recherche des requêtes LDAP. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/managerDn +Type: string +Description: LDAP account + Set here the account that Lemonldap::NG has to use for its LDAP requests. + Leaving it blank causes Lemonldap::NG to use anonymous connections. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Compte LDAP + Indiquez ici le compte que Lemonldap::NG doit utiliser pour ses requêtes + LDAP. Laissez le champ vide pour utiliser des connexions anonymes. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/managerPassword +Type: string +Description: LDAP password + Set here the password for the Lemonldap::NG LDAP account. + You can modify this value later using the Lemonldap::NG manager. +Description-fr: Mot de passe LDAP + Indiquez ici le mot de passe du compte LDAP de Lemonldap::NG. + Vous pourrez modifier cette valeur ultérieurement dans le gestionnaire + Lemonldap::NG. + +Template: liblemonldap-ng-conf-perl/howto +Type: note +Description: Lemonldap::NG is ready + Lemonldap::NG is ready to work. See + /usr/share/liblemonldap-ng-conf-perl/README.Debian to see how to activate it. +Description-fr: Lemonldap::NG est prêt + Lemonldap::NG est prêt à fonctionner. Reportez-vous au fichier + /usr/share/liblemonldap-ng-conf-perl/README.Debian pour voir comment l'activer + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.dirs b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.dirs new file mode 100644 index 000000000..f14fe0d10 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.dirs @@ -0,0 +1,3 @@ +/usr/share +/var/lib/lemonldap-ng/handler +/var/lib/lemonldap-ng/sessions diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.docs b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.docs new file mode 100644 index 000000000..cfdc3012c --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.docs @@ -0,0 +1,2 @@ +debian/README.Debian + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.examples b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.examples index 6e3f4834e..bb1b629e3 100644 --- a/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.examples +++ b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.examples @@ -1 +1,3 @@ -example/handler/ +debian/tmp/var/lib/lemonldap-ng/handler/autoProtectedCGI.pl +debian/tmp/var/lib/lemonldap-ng/handler/MyHandler*.pm +debian/handler-apache*.conf diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.postinst b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.postinst new file mode 100755 index 000000000..a268958b5 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-handler-perl.postinst @@ -0,0 +1,20 @@ +#!/bin/bash +# Maintainer: #DEBHELPER# + +. /usr/share/debconf/confmodule + +EXAMPLEHANDLERFILE=/usr/share/doc/liblemonldap-ng-handler-perl/examples/MyHandler.pm +HANDLERFILE=/var/lib/lemonldap-ng/handler/MyHandler.pm +SESSIONSDIR=/var/lib/lemonldap-ng/sessions + +if [ "$1" == "configure" ] +then + [ -e $HANDLERFILE ] || \ + perl -000 -pe 's/(configStorage\s*=>\s*){[^}]+}/$1\$Lemonldap::NG::Conf::configStorage/; + s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \ + $EXAMPLEHANDLERFILE >$HANDLERFILE + chmod 770 $SESSIONSDIR; + chown www-data.www-data $SESSIONSDIR; +fi + + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.config b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.config deleted file mode 100644 index 428c13612..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.config +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e -. /usr/share/debconf/confmodule -db_input high liblemonldap-ng-manager-conf-perl/newDirInfo || true -db_go || true - diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.dirs b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.dirs deleted file mode 100644 index ecae2caf4..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.dirs +++ /dev/null @@ -1,2 +0,0 @@ -/var/lib/lemonldap-ng - diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.examples b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.examples deleted file mode 100644 index cf61061d7..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.examples +++ /dev/null @@ -1,3 +0,0 @@ -example/conf/ -example/apache-session-mysql.sql -example/lmConfig.mysql diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.install b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.install deleted file mode 100644 index ab57f565a..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.install +++ /dev/null @@ -1,5 +0,0 @@ -debian/tmp/usr/share/perl5/Lemonldap/NG/Manager/Conf* -debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager::Conf* -debian/tmp/usr/share/man/man1/lmConfig_File2MySQL.1p -debian/tmp/usr/bin/lmConfig* -example/conf /var/lib/lemonldap-ng/ diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.postinst b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.postinst deleted file mode 100755 index a21814e24..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.postinst +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# Maintainer: #DEBHELPER# - -. /usr/share/debconf/confmodule - -if [ "$1" == "configure" ] -then - chown -R www-data /var/lib/lemonldap-ng/conf -fi - diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.templates b/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.templates deleted file mode 100644 index 8c1fc0365..000000000 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-conf-perl.templates +++ /dev/null @@ -1,5 +0,0 @@ -Template: liblemonldap-ng-manager-conf-perl/newDirInfo -Type: note -Description: Lemonldap::NG default configuration directory has moved to /var/lib/lemondap-ng/conf/ -Description-fr: Le répertoire de configuration par défaut est maintenant /var/lib/lemondap-ng/conf/ - diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.conffiles b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.conffiles new file mode 100644 index 000000000..85a898541 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.conffiles @@ -0,0 +1,3 @@ +/etc/lemonldap-ng/apply.conf +/etc/lemonldap-ng/manager-apache.conf +/etc/lemonldap-ng/manager-apache2.conf diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.dirs b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.dirs new file mode 100644 index 000000000..c474874a7 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.dirs @@ -0,0 +1,3 @@ +/etc/lemonldap-ng +/usr/share/lemonldap-ng/bin +/var/lib/lemonldap-ng/manager diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.docs b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.docs new file mode 100644 index 000000000..cfdc3012c --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.docs @@ -0,0 +1,2 @@ +debian/README.Debian + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.examples b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.examples index 301491514..e4ac9379e 100644 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.examples +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.examples @@ -1 +1,4 @@ -example/manager +debian/tmp/var/lib/lemonldap-ng/manager/apply.conf +debian/tmp/var/lib/lemonldap-ng/manager/index.pl +debian/tmp/var/lib/lemonldap-ng/manager/lmConfig.mysql +debian/tmp/var/lib/lemonldap-ng/manager/soapserver.pl diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.install b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.install index 9c9785bde..08e8debe0 100644 --- a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.install +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.install @@ -11,3 +11,8 @@ debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager.3pm debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager::SOAPServer.3pm debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager::Apache::Session::SOAP.3pm debian/tmp/usr/share/man/man3/Lemonldap::NG::Manager::Restricted.3pm +debian/tmp/var/lib/lemonldap-ng/manager/apply.conf /etc/lemonldap-ng +debian/manager-apache*.conf /etc/lemonldap-ng +debian/tmp/var/lib/lemonldap-ng/manager/imgs +debian/tmp/var/lib/lemonldap-ng/manager/lemonldap-ng-manager.js +debian/tmp/var/lib/lemonldap-ng/manager/scripts/lmConfigEditor /usr/share/lemonldap-ng/bin diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.postinst b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.postinst new file mode 100755 index 000000000..c167ec8eb --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-manager-perl.postinst @@ -0,0 +1,21 @@ +#!/bin/bash +# Maintainer: #DEBHELPER# + +. /usr/share/debconf/confmodule + +EXAMPLEMANAGERFILE=/usr/share/doc/liblemonldap-ng-manager-perl/examples/index.pl +MANAGERFILE=/var/lib/lemonldap-ng/manager/index.pl + +if [ "$1" == "configure" ] +then + [ -e $MANAGERFILE ] || \ + perl -000 -pe 's/(configStorage\s*=>\s*){[^}]+}/$1\$Lemonldap::NG::Conf::configStorage/; + s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m; + s#(applyConfFile\s*=>\s*)(['"'"'"]).*?\2#$1$2/etc/lemonldap-ng/apply.conf$2#' \ + $EXAMPLEMANAGERFILE >$MANAGERFILE + chmod +x $MANAGERFILE + chgrp www-data /etc/lemonldap-ng/apply.conf + chmod 640 /etc/lemonldap-ng/apply.conf +fi + + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.conffiles b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.conffiles new file mode 100644 index 000000000..bed9c06ad --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.conffiles @@ -0,0 +1,2 @@ +/etc/lemonldap-ng/portal-apache.conf +/etc/lemonldap-ng/portal-apache2.conf diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.cron.d b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.cron.d new file mode 100644 index 000000000..6406c66b0 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.cron.d @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the Lemonldap::NG portal +# +*/10 * * * * www-data test -x /usr/share/lemonldap-ng/bin/purgeCentralCache diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.dirs b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.dirs new file mode 100644 index 000000000..e2f2d11d3 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.dirs @@ -0,0 +1,4 @@ +/etc/lemonldap-ng +/usr/share/lemonldap-ng/bin +/var/lib/lemonldap-ng/portal +/var/lib/lemonldap-ng/sessions diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.docs b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.docs new file mode 100644 index 000000000..cfdc3012c --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.docs @@ -0,0 +1,2 @@ +debian/README.Debian + diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.examples b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.examples index e3d2151b0..3440e1bde 100644 --- a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.examples +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.examples @@ -1 +1 @@ -example/portal +debian/tmp/var/lib/lemonldap-ng/portal/* diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.install b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.install index 4da24ec6f..e4cb40034 100644 --- a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.install +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.install @@ -1,3 +1,4 @@ debian/tmp/usr/share/perl5/Lemonldap/NG/Portal* debian/tmp/usr/share/perl5/auto/Lemonldap/NG/Portal debian/tmp/usr/share/man/man3/Lemonldap::NG::Portal* +debian/portal-apache*.conf /etc/lemonldap-ng diff --git a/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.postinst b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.postinst new file mode 100644 index 000000000..2baff07b2 --- /dev/null +++ b/build/lemonldap-ng/debian/liblemonldap-ng-portal-perl.postinst @@ -0,0 +1,29 @@ +#!/bin/bash +# Maintainer: #DEBHELPER# + +. /usr/share/debconf/confmodule + +EXAMPLEPORTALFILE=/usr/share/doc/liblemonldap-ng-portal-perl/examples/index.pl +PORTALFILE=/var/lib/lemonldap-ng/portal/index.pl +EXAMPLECLEANERFILE=/usr/share/doc/liblemonldap-ng-portal-perl/examples/scripts/purgeCentralCache +CLEANERFILE=/usr/share/lemonldap-ng/bin/purgeCentralCache +SESSIONSDIR=/var/lib/lemonldap-ng/sessions + +if [ "$1" == "configure" ] +then + [ -e $PORTALFILE ] || \ + perl -000 -pe 's/(configStorage\s*=>\s*){[^}]+}/$1\$Lemonldap::NG::Conf::configStorage/; + s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \ + $EXAMPLEPORTALFILE >$PORTALFILE + [ -e $CLEANERFILE ] || \ + perl -000 -pe 's/(configStorage\s*=>\s*){[^}]+}/$1\$Lemonldap::NG::Conf::configStorage/; + s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \ + $EXAMPLECLEANERFILE >$CLEANERFILE + chmod +x $PORTALFILE + chmod +x $CLEANERFILE + chmod 770 $SESSIONSDIR; + chown www-data.www-data $SESSIONSDIR; +fi + + + diff --git a/build/lemonldap-ng/debian/manager-apache.conf b/build/lemonldap-ng/debian/manager-apache.conf new file mode 100644 index 000000000..d1038bf4b --- /dev/null +++ b/build/lemonldap-ng/debian/manager-apache.conf @@ -0,0 +1,24 @@ + + ServerName manager.example.com + + # DocumentRoot + DocumentRoot /var/lib/lemonldap-ng/manager + + Order deny,allow + Deny from all + Allow from 127.0.0.0/8 + Options +ExecCGI + + + # Manager must be interpreted by Perl + + SetHandler perl-script + PerlHandler Apache::Registry + + + + DirectoryIndex index.pl index.html + + + + diff --git a/build/lemonldap-ng/debian/manager-apache2.conf b/build/lemonldap-ng/debian/manager-apache2.conf new file mode 100644 index 000000000..aa953214e --- /dev/null +++ b/build/lemonldap-ng/debian/manager-apache2.conf @@ -0,0 +1,24 @@ + + ServerName manager.example.com + + # DocumentRoot + DocumentRoot /var/lib/lemonldap-ng/manager + + Order deny,allow + Deny from all + Allow from 127.0.0.0/8 + Options +ExecCGI + + + # Manager must be interpreted by Perl + + SetHandler perl-script + PerlResponseHandler ModPerl::Registry + + + + DirectoryIndex index.pl index.html + + + + diff --git a/build/lemonldap-ng/debian/portal-apache.conf b/build/lemonldap-ng/debian/portal-apache.conf new file mode 100644 index 000000000..482f1a4c0 --- /dev/null +++ b/build/lemonldap-ng/debian/portal-apache.conf @@ -0,0 +1,23 @@ + + ServerName auth.example.com + + # DocumentRoot + DocumentRoot /var/lib/lemonldap-ng/portal + + Order allow,deny + Allow from all + Options +ExecCGI + + + # Portal must be interpreted by Perl + + SetHandler perl-script + PerlHandler Apache::Registry + + + + DirectoryIndex index.pl index.html + + + + diff --git a/build/lemonldap-ng/debian/portal-apache2.conf b/build/lemonldap-ng/debian/portal-apache2.conf new file mode 100644 index 000000000..cc2d523f0 --- /dev/null +++ b/build/lemonldap-ng/debian/portal-apache2.conf @@ -0,0 +1,23 @@ + + ServerName auth.example.com + + # DocumentRoot + DocumentRoot /var/lib/lemonldap-ng/portal + + Order allow,deny + Allow from all + Options +ExecCGI + + + # Portal must be interpreted by Perl + + SetHandler perl-script + PerlResponseHandler ModPerl::Registry + + + + DirectoryIndex index.pl index.html + + + + diff --git a/build/lemonldap-ng/debian/rules b/build/lemonldap-ng/debian/rules index 4ae0f1f77..34368b6f8 100755 --- a/build/lemonldap-ng/debian/rules +++ b/build/lemonldap-ng/debian/rules @@ -49,8 +49,12 @@ install: build # Add here commands to install the package into debian/lemonldap-ng. $(MAKE) test $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr - $(MAKE) example EXAMPLEDIR=/usr/share/doc/lemonldap-ng/examples/ EXAMPLECONFDIR=/var/lib/lemonldap-ng/conf - + $(MAKE) example EXAMPLEDIRBUILD=debian/tmp/var/lib/lemonldap-ng EXAMPLEDIR=/var/lib/lemonldap-ng/ EXAMPLECONFDIR=/var/lib/lemonldap-ng/conf + cp debian/tmp/var/lib/lemonldap-ng/handler/MyHandler.pm debian/tmp/var/lib/lemonldap-ng/handler/MyHandler-Debian.pm + mv debian/tmp/var/lib/lemonldap-ng/index.pl debian/tmp/var/lib/lemonldap-ng/test.pl + perl -000 -i -pe 's/(new\s*\(\s*){[^}]+}/$$1\$$Lemonldap::NG::Conf::configStorage/; s#^use#\nrequire "/usr/share/lemonldap-ng/configStorage.pm";\nuse#m;' \ + debian/tmp/var/lib/lemonldap-ng/manager/scripts/lmConfigEditor \ + debian/tmp/var/lib/lemonldap-ng/handler/MyHandler-Debian.pm # Build architecture-independent files here. binary-indep: build install @@ -62,7 +66,12 @@ binary-arch: build install dh_testroot dh_installchangelogs dh_installdocs + mkdir debian/tmp/var/lib/lemonldap-ng/protected + cp _example/index.pl debian/tmp/var/lib/lemonldap-ng/protected + find debian/tmp/var/lib/lemonldap-ng -type f -perm /111 -exec chmod -x {} \; + chmod +x debian/tmp/var/lib/lemonldap-ng/manager/scripts/lmConfigEditor dh_installexamples + find debian/lemonldap-ng -type f -exec perl -i -pe 's#__DIR__/?#'/var/lib/lemonldap-ng'#g;s#__CONFDIR__/?#'/var/lib/lemonldap-ng/conf'#g;' {} \; dh_install # dh_installmenu dh_installdebconf @@ -72,13 +81,12 @@ binary-arch: build install # dh_installmime # dh_python # dh_installinit -# dh_installcron + dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress - gunzip $(CURDIR)/debian/lemonldap-ng/usr/share/doc/lemonldap-ng/examples/manager/lemonldap-ng-manager.js.gz dh_fixperms # dh_perl # dh_makeshlibs diff --git a/build/lemonldap-ng/debian/storage.conf b/build/lemonldap-ng/debian/storage.conf new file mode 100644 index 000000000..1bea664a5 --- /dev/null +++ b/build/lemonldap-ng/debian/storage.conf @@ -0,0 +1,28 @@ +# +# This file contains parameters used by Lemonldap::NG to find its configuration +# +# +# 1 - Type +# +# You can use one of the following: +# * File: you have to set 'dirName' parameter. Example: +# type = File +# dirName = /var/lib/lemonldap-ng/conf +# +# * DBI : you have to set 'dbiChain' (required) and 'dbiUser' and 'dbiPassword' +# if needed. Example: +# type = DBI +# dbiChain = DBI:mysql:database=lemonldap-ng,host=1.2.3.4 +# dbiUser = lemonldap +# dbiPassword = password +# +# * SOAP: SOAP configuration access is a sort of proxy: the SOAP server that +# runs Lemonldap::NG::Manager::SOAPServer is configured to use the real +# session storage type (DBI or File for example). +# You have to set 'proxy' parameter. Example +# type = SOAP +# proxy = https://manager.example.com/soapmanager.pl +# proxyOptions = { timeout => 5 } + +type = File +dirName = /var/lib/lemonldap-ng/conf diff --git a/modules/lemonldap-ng-handler/example/MyHandler.pm b/modules/lemonldap-ng-handler/example/MyHandler.pm index 272cad44e..03a88a3a4 100644 --- a/modules/lemonldap-ng-handler/example/MyHandler.pm +++ b/modules/lemonldap-ng-handler/example/MyHandler.pm @@ -7,6 +7,9 @@ __PACKAGE__->init ( { localStorageOptions => { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, + 'directory_umask' => '007', + 'cache_root' => '/tmp', + 'cache_depth' => 5, }, configStorage => { diff --git a/modules/lemonldap-ng-manager/MANIFEST b/modules/lemonldap-ng-manager/MANIFEST index 9de5529fa..58524ff05 100644 --- a/modules/lemonldap-ng-manager/MANIFEST +++ b/modules/lemonldap-ng-manager/MANIFEST @@ -44,16 +44,16 @@ example/imgs/plus5.gif example/imgs/plus_ar.gif example/imgs/tombs.gif example/imgs/tombs_mag.gif +example/index.pl example/lemonldap-ng-manager.js example/lmConfig.mysql -example/index.pl -example/scripts/lmSessionDump example/scripts/lmConfigEditor +example/scripts/lmSessionDump example/soapserver.pl lib/Lemonldap/NG/Manager.pm -lib/Lemonldap/NG/Manager/Apache/Session/SOAP.pm lib/Lemonldap/NG/Manager/_HTML.pm lib/Lemonldap/NG/Manager/_i18n.pm +lib/Lemonldap/NG/Manager/Apache/Session/SOAP.pm lib/Lemonldap/NG/Manager/Base.pm lib/Lemonldap/NG/Manager/Conf.pm lib/Lemonldap/NG/Manager/Conf/Constants.pm @@ -68,11 +68,11 @@ MANIFEST META.yml Module meta-data (added by MakeMaker) README scripts/lmConfig_File2MySQL -TODO -t/Lemonldap-NG-Manager.t -t/Lemonldap-NG-Manager_en.t -t/Lemonldap-NG-Manager_fr.t -t/Lemonldap-NG-Manager-Conf.t t/Lemonldap-NG-Manager-Conf-DBI.t t/Lemonldap-NG-Manager-Conf-File.t t/Lemonldap-NG-Manager-Conf-SOAP.t +t/Lemonldap-NG-Manager-Conf.t +t/Lemonldap-NG-Manager.t +t/Lemonldap-NG-Manager_en.t +t/Lemonldap-NG-Manager_fr.t +TODO diff --git a/modules/lemonldap-ng-portal/MANIFEST b/modules/lemonldap-ng-portal/MANIFEST index c44a15e24..ea302c7af 100644 --- a/modules/lemonldap-ng-portal/MANIFEST +++ b/modules/lemonldap-ng-portal/MANIFEST @@ -1,5 +1,7 @@ Changes example/index.pl +example/scripts/purgeCentralCache +example/scripts/purgeCentralCache.cron.d example/slavePortal.pl lib/Lemonldap/NG/Portal.pm lib/Lemonldap/NG/Portal/_i18n.pm diff --git a/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache b/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache new file mode 100755 index 000000000..63dd0d410 --- /dev/null +++ b/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache @@ -0,0 +1,88 @@ +#!/usr/bin/perl + +# Cleaner for Lemonldap::NG : removes old sessions from Apache::Session +# +# This module is written to be used by cron to clean old sessions from +# Apache::Session. +# +# WARNING: only Apache::Session::File and Apache::Session::MySQL can be used +# here + +BEGIN { + + sub Apache::Session::get_all_sessions { + return 0; + } + + sub Apache::Session::MySQL::get_all_sessions { + my $class = shift; + my $args = shift; + my $dbh = + DBI->connect( $args->{DataSource}, $args->{UserName}, + $args->{Password} ) + or die("$!$@"); + my $sth = $dbh->prepare('SELECT id from sessions'); + $sth->execute; + my @res; + while ( my @row = $sth->fetchrow_array ) { + push @res, @row; + } + return @res; + } + + sub Apache::Session::File::get_all_sessions { + my $class = shift; + my $args = shift; + $args->{Directory} ||= '/tmp'; + unless ( opendir DIR, $args->{Directory} ) { + die "Cannot open directory $args->{Directory}\n"; + } + my @t = + grep { -f "$args->{Directory}/$_" and /^[A-Za-z0-9@\-]+$/ } + readdir(DIR); + closedir DIR; + return @t; + } +} + +use Lemonldap::NG::Manager::Conf; +use Lemonldap::NG::Manager::Conf::Constants; +use strict; +use DBI; + +my $lmconf = Lemonldap::NG::Manager::Conf->new( + { + type => 'File', + dirName => '__CONFDIR__', + } +); + +my $conf = $lmconf->getConf or die "Unable to get configuration ($!)"; + +my $tmp = $conf->{globalStorage}; + +eval "use $tmp"; +die $@ if ($@); + +$conf->{globalStorageOptions}->{timeout} ||= 7200; + +my @t = $tmp->get_all_sessions( $conf->{globalStorageOptions} ); + +for my $id (@t) { + my %h; + eval { tie %h, $tmp, $id, $conf->{globalStorageOptions} }; + if ($@) { + next; + } + else { + if ( time - $h{_utime} > $conf->{globalStorageOptions}->{timeout} ) { + tied(%h)->delete; + } + else { + untie %h; + } + } +} + +1; + diff --git a/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d b/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d new file mode 100644 index 000000000..6406c66b0 --- /dev/null +++ b/modules/lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the Lemonldap::NG portal +# +*/10 * * * * www-data test -x /usr/share/lemonldap-ng/bin/purgeCentralCache