...
 
Commits (5)
The "Artistic License"
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
"Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
"Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder as specified below.
"Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
"You" is you, if you're thinking about copying or distributing
this Package.
"Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
"Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as uunet.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) give non-standard executables non-standard names, and clearly
document the differences in manual pages (or equivalent), together
with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this
Package. You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own. You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package. If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.
8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
LEMONLDAP::NG INSTALLATION
Lemonldap::NG is a modular Web-SSO based on Apache::Session modules. It
simplifies the build of a protected area with a few changes in the application.
It manages both authentication and authorization and provides headers for
accounting. So you can have a full AAA protection.
See README file to known how it works.
------------------------
I - EXAMPLE INSTALLATION
------------------------
The proposed example use a protected site named test.example.com. Non
authenticated users are redirected to auth.example.com.
1.1 - PREREQ
------------
1.1.1 - Software
To use Lemonldap::NG, you have to run a LDAP server and of course an Apache
server compiled with mod-perl (version 1.3 or 2.x). Generaly, the version of
Apache proposed with your Linux distribution match, but some distributions used
an experimental version of mod_perl with Apache2 (mod_perl-1.99) which does
not work with Lemonldap::NG. With such distributions (like Debian-3.1), you
have to use Apache-1.3 or to use a mod_perl backport (www.backports.org
package for Debian works fine).
1.1.2 - Perl prereq
Perl modules:
Apache::Session, Net::LDAP, MIME::Base64, CGI, LWP::UserAgent, Cache::Cache,
DBI, XML::Simple, SOAP::Lite (only if you want to use SOAP with the manager)
With Debian:
apt-get install libapache-session-perl libnet-ldap-perl libcache-cache-perl \
libdbi-perl perl-modules libwww-perl libcache-cache-perl \
libxml-simple-perl
# If you want to use SOAP with the manager:
apt-get install libsoap-lite-perl
1.2 - BUILDING
--------------
1.2.1 - Complete install
$ tar xzf lemonldap-ng-*.tar.gz
$ cd lemonldap-ng-*
$ make && make test
$ sudo make install
$ make example
1.2.2 - Install on Debian
$ tar xzf lemonldap-ng-*.tar.gz
$ cd lemonldap-ng-*
$ debuild
$ sudo dpkg -i ../lemonldap-ng*.deb
1.3 - EXAMPLE CONFIGURATION
---------------------------
If you have build Debian packages, configuration is done by Debconf. See
/usr/share/doc/liblemonldap-ng-conf/README.Debian to use it.
After build, you have a new file named example/apache.conf. You just have to
include this file in Apache configuration:
# in httpd.conf (with Apache1)
include /path/to/lemonldap-ng/source/example/apache.conf
# or in apache2.conf (with Apache2)
include /path/to/lemonldap-ng/source/example/apache2.conf
Modify your /etc/hosts file to include:
127.0.0.2 auth.example.com
127.0.0.3 test.example.com
127.0.0.4 manager.example.com
Edit /path/to/lemonldap-ng/source/example/conf/lmConfig-1 and specify your LDAP
settings. If you don't set managerDn and managerPassword, Lemonldap::NG will
use an anonymous bind to find user dn.
(Debian users: /var/lib/lemonldap-ng/conf/lmConfig-1)
WARNINGS:
* only few parameters can be set by hand in the configuration file. You have
to use the manager to change configuration, but since the example is yet
configured, you can edit directly the file
* each new configuration is saved by the manager in a new file (or a new
record with DBI) so you can recover an old configuration by removing
Next, restart Apache use your prefered browser and try to connect to
http://test.example.com/. You'll be redirect to auth.example.com. Try
to authenticate yourself with a valid account and the protected page will
appear. You will find other explanations on this page.
Configuration can be modified by connecting your browser to
http://manager.example.com/
-------------------------
2 - ADVANCED INSTALLATION
-------------------------
It is recommended to install the example first then to adapt it.
2.1 - PREREQ
2.1.1 - Apache
To use Lemonldap::NG, you have to run a LDAP server and of course an Apache
server compiled with mod-perl (version 1.3 or 2.x). Generaly, the version of
Apache proposed with your Linux distribution match, but some distributions used
an experimental version of mod_perl with Apache2 (mod_perl-1.99) which does
not work with Lemonldap::NG. With such distributions (like Debian-3.1), you
have to use Apache-1.3 or to use a mod_perl backport (www.backports.org
package for Debian works fine).
For Apache2, you can use both mpm-worker and mpm-prefork. Mpm-worker works
faster and Lemonldap::NG use the thread system for best performance. If you
have to use mpm-prefork (for example if you use PHP), Lemonldap::NG will work
anyway.
You can use Lemonldap::NG in an heterogene world: the authentication portal and
the manager can work in any version of Apache 1.3 or more even if mod_perl is
not compiled, with ModPerl::Registry or not... Only the handler (site protector)
need mod_perl. The different handlers can run on different servers with
different versions of Apache/mod_perl.
2.1.2 - Perl prereq
Warning: Handler and Portal parts both need Lemonldap::NG::Manager components
to access to configuration.
Manager:
-------
CGI, XML::Simple, DBI, LWP::UserAgent (and SOAP::Lite if you want to use SOAP)
With Debian:
apt-get install perl-modules libxml-simple-perl libdbi-perl libwww-perl
# If you want to use SOAP
apt-get install libsoap-lite-perl
Portal:
------
Apache::Session, Net::LDAP, CGI, Lemonldap::NG::Manager
With Debian:
apt-get install libapache-session-perl libnet-ldap-perl perl-modules
Handler:
-------
Apache::Session, LWP::UserAgent, Cache::Cache, Lemonldap::NG::Manager
With Debian:
apt-get install libapache-session-perl libwww-perl libcache-cache-perl
2.2 - SOFTWARE INSTALLATION
---------------------------
If you just want to install a handler or a portal or a manager:
$ tar xzf lemonldap-ng-*.tar.gz
$ cd lemonldap-ng-*/Lemonldap-NG-(Portal|Handler|Manager)
$ perl Makefile.PL && make && make test
$ sudo make install
else for a complete install:
$ tar xzf lemonldap-ng-*.tar.gz
$ cd lemonldap-ng-*
$ make && make test
$ sudo make install
See prereq in §1.1.2
2.3 - LEMONLDAP::NG INSTALLATION
--------------------------------
2.3.1 - Database configuration
2.3.1.1 - Lemonldap::NG Configuration database
If you use DBI or another system to share Lemonldap::NG configuration, you have
to initialize the database. An example is given in example/lmConfig.mysql for
MySQL.
2.3.1.2 - Apache::Session database
The choice of Apache::Session::* module is free. See Apache::Session::Store::*
or Apache::Session::* to know how to configure the module. For example, if you
want to use Apache::Session::MySQL, you can create the database like this:
CREATE DATABASE sessions (
id char(32),
a_session text
);
2.3.2 - Manager configuration
Copy example/manager.cgi and personalize it if you want (see
Lemonldap::NG::Manager). You have to set in particular configStorage. For
example with MySQL:
$my $manager = Lemonldap::NG::Manager->new ( {
dbiChain => "DBI:mysql:database=mybase;host=1.2.3.4",
dbiUser => "lemonldap-ng",
dbiPassword => "mypass",
} );
Securise Manager access with Apache: Lemonldap::NG does not securise the manager
itself yet:
SSLEngine On
Order Deny, Allow
Deny from all
Allow from admin-network/netmask
AuthType Basic
...
After configuration, you can also protect the manager with an Lemonldap::NG
handler.
2.3.3 - Configuration edition
Connect to the manager with your browser start configure your Web-SSO. You have
to set at least some parameters:
a) General parameters :
* Authentication parameters -> portal : URL to access to the authentication
portal
* Domain : the cookie domain. All protected VirtualHosts have to be under it
* LDAP parameters -> LDAP Server
* LDAP parameters -> LDAP Accout and password : required only if anonymous
binds are not accepted
* Session Storage -> Apache::Session module : how to store user sessions.
You can use all module that
inherit from Apache::Session
like Apache::Session::MySQL
* Session Storage -> Apache::Session Module parameters :
see Apache::Session::<Choosen module>
b) User groups :
Use the "New Group" button to add your first group. On the left, set the
keyword which will be used later and set on the right the corresponding rule:
you can use :
* an LDAP filter (it will be tested with the user uid)
or
* a Perl condition enclosed with {}. All variables declared in "General
parameters -> LDAP attributes" can be used with a "$". For example:
MyGroup / { $uid eq "foo" or $uid eq "bar" }
c) Virtual hosts
You have to create a virtual host for each Apache host (virtual or real)
protected by Lemonldap::NG even if just a sub-directory is protected. Else,
user who want to access to the protected area will be rejected with a "500
Internal Server Error" message and the apache logs will explain the problem.
Each virtual host has 2 groups of parameters:
* Headers: the headers added to the apache request. Default :
Auth-User => $uid
* Rules: subdivised in 2 categories:
* default : the default rule
* personalized rules: association of a Perl regular expression and
a condition. For example:
^/restricted.*$ / $groups =~ /\bMyGroup\b/
-------------
3 - DEBUGGING
-------------
Lemonldap::NG uses simply the Apache log system. So use LogLevel to choose
information to display.
#!/usr/bin/make
VERSION=`head -n1 changelog |sed -e 's/lemonldap-ng (//' -e 's/).*$$//'`
HANDLERDIR=lemonldap-ng-handler
PORTALDIR=lemonldap-ng-portal
MANAGERDIR=lemonldap-ng-manager
EXAMPLEDIRBUILD=`pwd`/example/
EXAMPLEDIR=$(EXAMPLEDIRBUILD)
EXAMPLECONFDIR=$(EXAMPLEDIR)conf/
EXAMPLELANG=en
all: handler manager portal
handler: handler_conf
$(MAKE) -C ${HANDLERDIR}
touch handler
portal: portal_conf
$(MAKE) -C ${PORTALDIR}
touch portal
manager: manager_conf
$(MAKE) -C ${MANAGERDIR}
touch manager
configure: handler_conf portal_conf manager_conf
handler_conf:
cd ${HANDLERDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
touch handler_conf
portal_conf:
cd ${PORTALDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
touch portal_conf
manager_conf:
cd ${MANAGERDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
touch manager_conf
test: manager_test handler_test portal_test
manager_test: manager
$(MAKE) -C ${MANAGERDIR} test
handler_test: handler
$(MAKE) -C ${HANDLERDIR} test INST_ARCHLIB=../${MANAGERDIR}/blib/lib/
portal_test: portal
$(MAKE) -C ${PORTALDIR} test INST_ARCHLIB=../${MANAGERDIR}/blib/lib/
install: handler_install portal_install manager_install
handler_install: handler
$(MAKE) -C ${HANDLERDIR} install
touch handler_install
portal_install: portal
$(MAKE) -C ${PORTALDIR} install
touch portal_install
manager_install: manager
$(MAKE) -C ${MANAGERDIR} install
touch manager_install
distclean: clean
clean: handler_clean portal_clean manager_clean
rm -rf example
find . -name '*.gz' -exec rm -vf {} \;
handler_clean:
- $(MAKE) -C ${HANDLERDIR} distclean
rm -vf handler*
portal_clean:
- $(MAKE) -C ${PORTALDIR} distclean
rm -vf portal*
manager_clean:
- $(MAKE) -C ${MANAGERDIR} distclean
rm -vf manager*
example: all
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
cp -a _example/* ${EXAMPLEDIRBUILD}
find ${EXAMPLEDIRBUILD} -type f -exec perl -i -pe 's#__DIR__/?#'${EXAMPLEDIR}'#g;s#__CONFDIR__/?#'${EXAMPLECONFDIR}'#g;' {} \;
@echo
@echo "Example is ready."
@echo
@echo "1 - Add this in your Apache configuration file:"
@echo " with Apache-1.3.x"
@echo
@echo " include ${EXAMPLEDIR}apache.conf"
@echo
@echo " or with Apache-2.x:"
@echo
@echo " include ${EXAMPLEDIR}apache2.conf"
@echo
@echo "2 - Add test.example.com and auth.example.com in your /etc/hosts or"
@echo " modify apache.conf to use NameVirtualHost, different port or"
@echo " address;"
@echo
@echo " cat ${EXAMPLEDIRBUILD}/for_etc_hosts >> /etc/hosts"
@echo
@echo "3 - Use the manager at http://manager.example.com/ (after apache restart)"
@echo " or edit ${EXAMPLEDIR}/conf/lmConf-1 and set ldapServer and ldapBase."
@echo
@echo "4 - Restart Apache (or Apache2)"
@echo
@echo "5 - Try to connect to http://test.example.com/"
uninstall: configure handler_uninstall portal_uninstall manager_uninstall
handler_uninstall: handler
$(MAKE) -C ${HANDLERDIR} uninstall
rm -vf handler_uninstall
portal_uninstall: portal
$(MAKE) -C ${PORTALDIR} uninstall
rm -vf portal_uninstall
manager_uninstall: manager
$(MAKE) -C ${MANAGERDIR} uninstall
rm -vf manager_uninstall
dist: clean
- $(MAKE) clean
mkdir -p lemonldap-ng-$(VERSION)
- cp -pR lemonldap-ng-manager/ lemonldap-ng-portal/ lemonldap-ng-handler/ * lemonldap-ng-$(VERSION)
- dir=lemonldap-ng-$(VERSION); find $$dir -name .svn -exec rm -rf {} \; 2>/dev/null
rm -rf lemonldap-ng-$(VERSION)/lemonldap-ng-$(VERSION)
tar czf lemonldap-ng-$(VERSION).tar.gz lemonldap-ng-$(VERSION)
rm -rf lemonldap-ng-$(VERSION)
cpan: clean configure handler_cpan portal_cpan manager_cpan
handler_cpan: handler_conf
$(MAKE) -C ${HANDLERDIR} dist
mv ${HANDLERDIR}/Lemonldap*.gz .
portal_cpan: portal_conf
$(MAKE) -C ${PORTALDIR} dist
mv ${PORTALDIR}/Lemonldap*.gz .
manager_cpan: manager_conf
$(MAKE) -C ${MANAGERDIR} dist
mv ${MANAGERDIR}/Lemonldap*.gz .
static_example: example
mkdir -p ${EXAMPLEDIRBUILD}/static
cd ${EXAMPLEDIRBUILD}/static/;ln -s ../manager/imgs;cd -
scripts/make_static_example.pl ${EXAMPLEDIRBUILD}/manager/index.pl ${EXAMPLEDIRBUILD}/static/index.html $(EXAMPLELANG)
documentation:
cd doc && ../scripts/doc.pl
Lemonldap-NG
====================
Lemonldap::NG is a modular Web-SSO based on Apache::Session modules. It
simplifies the build of a protected area with a few changes in the application.
It manages both authentication and authorization and provides headers for
accounting. So you can have a full AAA protection for your web space as
described below.
1 - Installation
2 - Authentication, Authorization and Accounting mechanisms
2.1 - Authentication
2.2 - Authorization
2.3 - Accounting
3 - Session storage system
4 - Author
5 - Copyright and licence
1 - INSTALLATION
================
Lemonldap::NG is a different project than Lemonldap and contains all you need
to use and administer it. So softwares, like Lemonldap webmin module, may not
work with Lemonldap::NG.
The Apache module part (Lemonldap::NG::Handler) works both with Apache 1.3.x
and 2.x ie mod_perl 1 and 2 (but not with mod_perl 1.99). Portal and Manager
act as CGI, so they can work everywhere.
See INSTALL file in the source tree for a complete installation documentation.
2 - AUTHENTICATION, AUTHORIZATION AND ACCOUNTING MECHANISMS
===========================================================
Warning: Lemonldap::NG configuration has to be edited using the manager unless
you know exactly what you are doing. The parameters discussed here are all in
the configuration tree.
2.1 - Authentication
If a user isn't authenticated and attemps to connect to an area protected by a
Lemonldap::NG compatible handler, he is redirected to a portal. The portal
authenticates user with a ldap bind by default, but you can also use another
authentication sheme like using x509 user certificates (see
Lemonldap::NG::Portal::AuthSSL(3) for more).
Lemonldap use session cookies generated by Apache::Session so as secure as a
128-bit random cookie. You may use the securedCookie options to avoid session
hijacking.
You have to manage life of sessions by yourself since Lemonldap::NG knows
nothing about the L<Apache::Session> module you've choosed, but it's very easy
using a simple cron script because Lemonldap::NG::Portal stores the start
time in the _utime field.
By default, a session stay 10 minutes in the local storage, so in the worth
case, a user is authorized 10 minutes after he lost his rights.
2.2 - Authorization
Authorization is controled only by handlers because the portal knows nothing
about the way the user will choose. When configuring your Web-SSO, you have to:
* choose the ldap attributes you want to use to manage accounting and
authorization.
* create Perl expressions to define user groups (using ldap attributes)
* create an array foreach virtual host associating URI regular expressions and
Perl expressions to use to grant access.
Example (See Lemonldap::NG::Manager::Conf(3) to see how configuration is stored
* Exported variables :
# Custom-Name => LDAP attribute
cn => cn
departmentUID => departmentUID
login => uid
* User groups :
# Custom-Name => group definition
group1 => { $departmentUID eq "unit1" or $login = "xavier.guimard" }
* Area protection:
# Each VirtualHost has its own configuration
# associating URL regexp to Perl expression
* www1.domain.com :
^/protected/.*$ => $groups =~ /\bgroup1\b/
default => accept
},
* www2.domain.com => {
^/site/.*$ => $uid eq "admin" or $groups =~ /\bgroup2\b/
^/(js|css) => accept
default => deny
},
},
2.2.1 - Performance
You can use Perl expressions as complicated as you want and you can use all
the exported LDAP attributes (and create your own attributes: with 'macros'
mechanism) in groups evaluations, area protections or custom HTTP headers
(you just have to call them with a "$").
You have to be careful when choosing your expressions:
* groups and macros are evaluated each time a user is redirected to the portal
* virtual host rules and exported headers are evaluated for each request on a
protected area.
It is also recommanded to use the groups mechanism to avoid having to evaluate
a long expression at each HTTP request:
# Virtual hosts :
...
www1.domain.com :
^/protected/.*$ => $groups =~ /\bgroup1\b/
You can also use LDAP filters, or Perl expression or mixed expressions in
groups definitions. Perl expressions has to be enclosed with {}:
* group1 => (|(uid=xavier.guimard)(ou=unit1))
* group1 => {$uid eq "xavier.guimard" or $ou eq "unit1"}
* group1 => (|(uid=xavier.guimard){$ou eq "unit1"})
It is also recommanded to use Perl expressions to avoid requiering the LDAP
server more than 2 times per authentication.
2.3 - Accounting
2.3.1 - Logging portal access>
Lemonldap::NG::Portal doesn't log anything by default, but it's easy to
overload log method for normal portal access.
2.3.2 - Logging application access
Because a Web-SSO knows nothing about the protected application, it can't do
more than logging URL. As Apache does this fine, L<Lemonldap::NG::Handler>
gives it the name to used in logs. The whatToTrace parameter indicates
which variable Apache has to use ($uid by default).
The real accounting has to be done by the application itself which knows the
result of SQL transaction for example.
Lemonldap::NG can export HTTP headers either using a proxy or protecting
directly the application. By default, the Auth-User field is used but you can
change it using the exportedHeaders parameters (in the Manager, each virtual
host as custom headers branch). This parameters contains an associative array
per virtual host:
* keys are the names of the choosen headers
* values are Perl expressions where you can use user datas stored in the
global storage.
Example:
* www1.domain.com :
Auth-User => $uid
Unit => $ou
* www2.domain.com :
Authorization => "Basic ".encode_base64($employeeNumber.":dummy")
Remote-IP => $ip
3 - SESSION STORAGE SYSTEM
Lemonldap::NG use 3 levels of cache for authenticated users:
* an Apache::Session::* module used by lemonldap::NG::Portal to store
authenticated user parameters,
* a Cache::Cache* module used by Lemonldap::NG::Handler to share authenticated
users between Apache's threads or processus and of course between virtual
hosts on the same machine
* Lemonldap::NG::Handler variables : if the same user use the same thread or
processus a second time, no request are needed to grant or refuse access.
This is very efficient with HTTP/1.1 Keep-Alive system.
So the number of request to the central storage is limited to 1 per active
user each 10 minutes.
Lemonldap::NG is very fast, but you can increase performance using a
Cache::Cache module that does not use disk access.
4 - AUTHOR
Xavier Guimard, x.guimard@free.fr
5 - COPYRIGHT AND LICENSE
Copyright (C) 2005-2007 by Xavier Guimard x.guimard@free.fr
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.4 or,
at your option, any later version of Perl 5 you may have available.
Lemonldap::NG TODO
------------------
TODO list for Lemonldap::NG development
- Priority: Normal Status: Planning Created: 2007\05\03 12-28-30
Modify example to use nameVirtualHost instead of 127.0.0.x adresses
- Priority: Low Status: In progress Created: 2007\05\03 10-41-36
Modify install to make a running example as debian install
- Priority: Low Status: Done Created: 2007\04\23 21-26-18 Done: 2007\10\24 10-17-47
TLS in LDAP connections
- Priority: Low Status: N/A Created: 2007\04\21 13-14-55
Simplified manager interface fo rules:
* simplified regexp (* instead of .*,...)
* simple combobox to choose groups
- Priority: Low Status: N/A Created: 2007\05\03 11-40-36
Delete buttons in virtualHosts if 'read"-"only'
- Priority: Low Status: N/A Created: 2007\05\03 11-47-42
Order rules :
* find a system to move up and down rules in manager interface
* split locationRules into 2 arrays
- Priority: Low Status: N/A Created: 2007\05\05 21-58-53
Documentation :
* Security document
* apply.conf Howto
* ldapGroupBase
CREATE TABLE sessions (
id char(32) not null primary key,
a_session text
);
include __DIR__/handler/lmH-apache.conf
#Listen 127.0.0.2:80
<VirtualHost 127.0.0.2:*>
ServerName auth.example.com
# DocumentRoot
DocumentRoot __DIR__/portal
<Directory __DIR__/portal>
Order allow,deny
Allow from all
Options +ExecCGI
</Directory>
# Portal and Manager must be interpreted by Perl
<Files *.pl>
SetHandler perl-script
PerlHandler Apache::Registry
</Files>
<IfModule mod_dir.c>
DirectoryIndex index.pl index.html
</IfModule>
</VirtualHost>
#Listen 127.0.0.4:80
<VirtualHost 127.0.0.4:*>
ServerName manager.example.com
# DocumentRoot
DocumentRoot __DIR__/manager
<Directory __DIR__/manager>
Order deny,allow
Deny from all
Allow from 127.0.0.0/8
Options +ExecCGI
</Directory>
# Portal and Manager must be interpreted by Perl
<Files *.pl>
SetHandler perl-script
PerlHandler Apache::Registry
</Files>
<IfModule mod_dir.c>
DirectoryIndex index.pl index.html
</IfModule>
</VirtualHost>
include __DIR__/handler/lmH-apache2.conf
PerlOptions +GlobalRequest
#Listen 127.0.0.2:80
<VirtualHost 127.0.0.2:*>
ServerName auth.example.com
# DocumentRoot
DocumentRoot __DIR__/portal
<Directory __DIR__/portal>
Order allow,deny
Allow from all
Options +ExecCGI
</Directory>
# Portal and Manager must be interpreted by Perl
<Files *.pl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Files>
<IfModule mod_dir.c>
DirectoryIndex index.pl index.html
</IfModule>
</VirtualHost>
#Listen 127.0.0.4:80
<VirtualHost 127.0.0.4:*>
ServerName manager.example.com
# DocumentRoot
DocumentRoot __DIR__/manager
<Directory __DIR__/manager>
Order deny,allow
Deny from all
Allow from 127.0.0.0/8
Options +ExecCGI
</Directory>
# Portal and Manager must be interpreted by Perl
<Files *.pl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Files>
<IfModule mod_dir.c>
DirectoryIndex index.pl index.html
</IfModule>
</VirtualHost>
ldapServer
'localhost'
ldapBase
'dc=example,dc=com'
ldapPort
389
managerDn
''
managerPassword
''
portal
'http://auth.example.com/'
domain
'example.com'
whatToTrace
'$uid'
groups
'$data1 = {};'
macros
'$data1 = {};'
globalStorage
'Apache::Session::File'
globalStorageOptions
'$data1 = {&39;Directory&39; => &39;/tmp&39;};'
exportedHeaders
'$data1 = {&39;test.example.com&39; => {&39;Auth-User&39; => &39;$uid&39;}};'
exportedVars
'$data1 = {&39;uid&39; => &39;uid&39;,&39;cn&39; => &39;cn&39;,&39;mail&39; => &39;mail&39;};'
authentication
'ldap'
locationRules
'$data1 = {&39;test.example.com&39; => {&39;default&39; => &39;accept&39;}};'
cfgNum
1
cookieName
'lemonldap'
securedCookie
0
127.0.0.2 auth.example.com
127.0.0.3 test.example.com
127.0.0.4 manager.example.com
#!/usr/bin/perl
use CGI;
my $cgi=CGI->new;
print $cgi->header;
print $cgi->start_html( 'Page protected by Lemonldap::NG' );
my($headers, $env)=({},{});
use Data::Dumper;
print "<pre>";
foreach(sort keys %ENV) {
if($_ =~ /^HTTP_/) {
($a=$_) =~ s/^HTTP_//i;
#$a =~ s/_/ /g;
#$a = ucfirst(lc($a));
#$a =~ s/ /-/g;
$a = join '-', map {ucfirst(lc)} split '_',$a;
$headers->{$a} = $_;
}
else {
$env->{$_} = $ENV{$_};
}
}
print "</pre>";
print qq#<h1>Authentication succeed</h1>
<a href="/logout">logout</a>
<p>Authenticated user : $ENV{HTTP_AUTH_USER}</p>
<p>To know who is connected in your applications, you can read HTTP headers :</p>
<table border="1" style="font-size: small;">\n
<tr><th>Header</th><th>Perl CGI</th><th>PHP script</th><th>Value</th></tr>
#;
foreach(sort keys %$headers) {
$style = $_ eq 'Auth-User' ? 'style="background-color: #FFEEEE;font-weight: bold;"' : '';
print "<tr>
<td $style>$_</td>
<td $style>\$ENV{$headers->{$_}}</td>
<td $style>\$_SERVER{$headers->{$_}}</td>
<td $style> $ENV{$headers->{$_}}</td>
</tr>\n"
}
print '</table>
<p>Note that Lemonldap::NG cookie is hidden. So that application developpers can
not spoof sessions.</p>
<p>You can access to any information (IP address or LDAP attribute) by customizing
exported headers with the
<a href="http://manager.example.com/">Lemonldap::NG Management interface</a></p>
<hr />';
print qq#<h2>Environment for Perl CGI :</h2>
<p>Be carefull, the \$ENV{REMOTE_USER} is set only if your script is in the
same server than Lemonldap::NG handler (\$whatToTrace parameter). If you use
it on a reverse-proxy, \$ENV{REMOTE_USER} is not set.</p>
<table border="0" style="font-size: small;">\n#;
foreach(sort keys %ENV) {
my $tmp = $ENV{$_};
$tmp =~ s/&/&amp;/g;
$tmp =~ s/>/&gt;/g;
$tmp =~ s/</&lt;/g;
print "<tr><td>$_</td><td>=&gt; $tmp</td></tr>\n";
}
print '</table>';
print $cgi->end_html;
CREATE TABLE lmConfig (
cfgNum int not null primary key,
locationRules text,
exportedHeaders text,
globalStorage text,
globalStorageOptions text,
macros text,
groups text,
portal text,
domain text,
ldapServer text,
ldapPort int,
ldapBase text,
securedCookie int,
cookieName text,
authentication text,
exportedVars text,
managerDn text,
managerPassword text,
timeout int,
whatToTrace text
);
lemonldap-ng (0.9) unstable; urgency=low
* Liberty Alliance module issued of the FederID project is now included.
-- Xavier Guimard <x.guimard@free.fr> Mon, 25 Feb 2008 15:05:08 +0100
lemonldap-ng (0.8.3.2) unstable; urgency=low
* purgeCentralCache was not correctly installed in Debian (Closes: #461572 /
bugs.debian.org)
* debconf translation for german and portuguese (Closes: #451820 and #462807
bugs.debian.org)
* HTML documentation update
* Option +ExecCGI was missing in
lemonldap-ng-handler/example/lmH-apache2.conf (Closes: #307891)
* Local overload was not taken in account in handlers
* Sessions could not be stored in SOAPServer (Closes: #308181)
* Attributes could not be deleted in SOAP session client (Closes: #308214)
* Sessions timeout can now be managed by the Manager
* AuthSSL doesn't work without SSLvar parameter
-- Xavier Guimard <x.guimard@free.fr> Fri, 08 Feb 2008 17:27:15 +0100
lemonldap-ng (0.8.3.1) unstable; urgency=low
* New feature: LDAP groups are now available in $groups
-- Xavier Guimard <x.guimard@free.fr> Wed, 07 Nov 2007 16:41:07 +0100
lemonldap-ng (0.8.3) unstable; urgency=high
* Syntax errors in configuration are now displayed
* Security fix: authentication could be replayed with another uid
* Debian package uses po-debconf
* TLS is now supported in LDAP connections (thanks to Baptiste Grenier)
* New logout system: logout urls can be now intercepted in Manager
* Documentation
-- Xavier Guimard <x.guimard@free.fr> Fri, 07 Sep 2007 07:14:35 +0200
lemonldap-ng (0.8.2.4) unstable; urgency=low
* Bug in manager javascript.
-- Xavier Guimard <x.guimard@free.fr> Tue, 19 Jun 2007 22:25:10 +0200
lemonldap-ng (0.8.2.3) unstable; urgency=low
* Change configuration storage format (Storable bug).
Closes: #307173/objectweb.org
* CDA little bug correction
* Documentation update
-- Xavier Guimard <x.guimard@free.fr> Wed, 13 Jun 2007 15:33:56 +0200
lemonldap-ng (0.8.2.2) unstable; urgency=low
* Debian packages modifications due to Lintian control.
* New Debian package: lemonldap-ng-doc
* Little bug correction in Portal/CDA.pm
* Bug between Handler dependencies and Debian organization:
Lemonldap::NG::Handler::SharedConf must not depend from
Lemonldap::NG::Manager but Lemonldap::NG::Manager::Conf
-- Xavier Guimard <x.guimard@free.fr> Tue, 01 June 2007 07:18:43 +0200
lemonldap-ng (0.8.2.1) unstable; urgency=low
* More documentation
* Virtual host names control
* Portal can now use more than one LDAP server
-- Xavier Guimard <x.guimard@free.fr> Mon, 14 May 2007 07:14:10 +0200
lemonldap-ng (0.8.2) unstable; urgency=low
* Little bug fix if whatToTrace parameter is not defined and display it in
Manager interface
* New: port is now checked in portal redirection
* Different configurations can now be used on the same server at the same
time
* Help in english
* 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
* Buttons to manage configurations in manager (next, previous, last,
delete). Closes: #306566 / forge.lemonldap.org.
* SOAP: HTTP basic authentication and little bug correction in 'sessions'
mode
-- Xavier Guimard <x.guimard@free.fr> Mon, 07 May 2007 19:06:52 +0200
lemonldap-ng (0.8.1.1) unstable; urgency=low
* Little bug fix in test
-- Xavier Guimard <x.guimard@free.fr> Fri, 20 Apr 2007 08:57:40 +0200
lemonldap-ng (0.8.1) unstable; urgency=low
* New features :
- Logout system
- Configuration check before saving in Manager
-- Xavier Guimard <x.guimard@free.fr> Sun, 15 Apr 2007 19:18:29 +0200
lemonldap-ng (0.8.0.7) unstable; urgency=low
* Bug fix in manager javascript (Closes: #306776 ?)
* Display bug fix in manager
-- Xavier Guimard <x.guimard@free.fr> Sun, 15 Apr 2007 13:21:43 +0200
lemonldap-ng (0.8.0.6) unstable; urgency=low
* Little bug fix in unprotect function
* Bug fix in authentication scheme different than default
-- Xavier Guimard <x.guimard@free.fr> Thu, 12 Apr 2007 07:03:51 +0200
lemonldap-ng (0.8.0.5) unstable; urgency=low
* i18n bug: Lemonldap::NG works does not fall in english but creates a bug
-- Xavier Guimard <x.guimard@free.fr> Wed, 28 Mar 2007 21:26:16 +0200
lemonldap-ng (0.8.0.4) unstable; urgency=low
* Multi-valued attributes in HTTP headers (Closes: #306792 /
forge.objectweb.org)
* Warning in Manager/Conf.pm: the same type of storage has to be used for
all Lemonldap::NG parts in a same server.
* Apache-1.3 configuration reload (Closes: #306761 / forge.objectweb.org)
-- Xavier Guimard <x.guimard@free.fr> Thu, 22 Mar 2007 22:42:23 +0100
lemonldap-ng (0.8.0.3) unstable; urgency=low
* New feature in Manager : "Delete VHost" button (Closes: #306761)
* Typo correction in Makefile : (Closes: #306775)
* Correction of build-depends : (Closes: #306773)
* Bug correction : existingSessions was not called in Portal.pm
-- Xavier Guimard <x.guimard@free.fr> Tue, 13 Mar 2007 07:55:42 +0100
lemonldap-ng (0.8.0.2) unstable; urgency=low
* Bug correction: lock doesn't work with File.pm (Closes: #306760 /
forge.objectweb.org)
-- Xavier Guimard <x.guimard@free.fr> Sun, 11 Mar 2007 21:08:38 +0100
lemonldap-ng (0.8.0.1) unstable; urgency=medium
* Closes: #306756 / forge.objectweb.org
-- Xavier Guimard <x.guimard@free.fr> Fri, 10 Mar 2007 08:49:01 +0100
lemonldap-ng (0.8) unstable; urgency=low
* Release 0.8:
- corrects differents little bugs issued from test in real life.
- on line documentation in english
-- Xavier Guimard <x.guimard@free.fr> Fri, 9 Mar 2007 20:29:01 +0100
lemonldap-ng (0.7b12) unstable; urgency=low
* New features:
- session access via SOAP
- authentication via CAS
- 'apply changes' button in Manager used to reload configuration in
handlers (by calling reload sub via HTTP) (Closes: #306565 /
forge.objectweb.org)
- i18n module in portal (for displaying errors)
- lock in DBI configuration system (NOT YET TESTED)
-- Xavier Guimard <x.guimard@free.fr> Sun, 4 Mar 2007 15:50:38 +0100
lemonldap-ng (0.7b11) unstable; urgency=low
* New features:
- Cross Domain Authentication
- SOAP configuration access
- READMEs and documentation update
-- Xavier Guimard <x.guimard@free.fr> Tue, 27 Feb 2007 15:01:09 +0100
lemonldap-ng (0.7b10) unstable; urgency=low
* Corrections in Manager issued from the first test in real life:
- Close #306573 / forge.objectweb.org
- Close #306574 / forge.objectweb.org
-- Xavier Guimard <x.guimard@free.fr> Wed, 17 Jan 2007 20:57:33 +0100
lemonldap-ng (0.7b9) unstable; urgency=low
* Internationalization of javascripts (close #306564 / forge.objectweb.org)
* Help in "General Parameters"
-- Xavier Guimard <x.guimard@free.fr> Sun, 14 Jan 2007 21:50:39 +0100
lemonldap-ng (0.7b8) unstable; urgency=low
* Correction of the use of Safe in portal: &share doesn't work with a
variable declared with my.
* New system in the configuration: 'macro' section can be used to add
custom exported variables. So configuration is more simple in heavy case.
-- Xavier Guimard <x.guimard@free.fr> Sat, 13 Jan 2007 20:19:19 +0100
lemonldap-ng (0.7b7) unstable; urgency=low
* Correction of a bug in internal redirections: now internal
redirections are not examined: for example,http://test.example.com/ is
internaly redirected to /index.pl, but only the first request (/) is
tested.
* Help in french
-- Xavier Guimard <x.guimard@free.fr> Fri, 5 Jan 2007 18:22:32 +0100
lemonldap-ng (0.7b6) unstable; urgency=low
* Help system skeleton
-- Xavier Guimard <x.guimard@free.fr> Thu, 4 Jan 2007 09:04:05 +0100
lemonldap-ng (0.7b5) unstable; urgency=low
* Localization in Manager interface (only fr and en)
-- Xavier Guimard <x.guimard@free.fr> Sun, 31 Dec 2006 16:39:06 +0100
lemonldap-ng (0.7b4) unstable; urgency=low
* Safe jail runs now
* example runs now
-- Xavier Guimard <x.guimard@free.fr> Sun, 31 Dec 2006 14:00:08 +0100
lemonldap-ng (0.7b3) unstable; urgency=low
* Replacement of eval by Safe for external expressions
-- Xavier Guimard <x.guimard@free.fr> Sat, 30 Dec 2006 22:23:22 +0100
lemonldap-ng (0.7b) unstable; urgency=low
* Corrections in example
* Example installation in debian
* Revision in documentation
-- Xavier Guimard <x.guimard@free.fr> Sun, 17 Dec 2006 18:37:39 +0100
lemonldap-ng (0.6) unstable; urgency=low
* Initial release built starting from the three modules of the CPAN.
-- Xavier Guimard <x.guimard@free.fr> Sun, 17 Dec 2006 17:46:47 +0100
lemonldap-ng for Debian
-----------------------
Topics:
1 - Manager installation
2 - Portal installation
3 - Area protection
4 - Configuration storage
I - 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 configure it (virtual host has to be adapt).
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 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 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 /etc/lemonldap-ng/ to know how to use it.
You can also copy /usr/share/doc/lemonldap-ng/examples/test.pl into
/var/lib/lemonldap-ng/index.pl to see how to use Lemonldap::NG with a Perl or
PHP application.
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.9-0) unstable; urgency=low
* Local build
-- Xavier Guimard <x.guimard@free.fr> Mon, 22 Oct 2007 21:34:23 +0200
#!/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(<F>) {
next if(/^\s*$/ or /^\s*#/);
chomp;
s/\r//g;
/^\s*([\w]+)(?:\s*[:=]\s*|\s+)(["']?)([\S].*[\S])\2.*$/ or next;
$configStorage->{$1} = $3;
my $k = $1;
if($configStorage->{$k} =~ /^([{\[]).*[}\]]$/) {
eval "\$configStorage->{$k} = $configStorage->{$k}";
}
}
close F;
}
1;
Source: lemonldap-ng
Section: perl
Priority: extra
Maintainer: Xavier Guimard <x.guimard@free.fr>
Build-Depends: debhelper (>= 4.1.16), po-debconf
Build-Depends-Indep:libapache-session-perl, libnet-ldap-perl, libdbi-perl, libwww-perl, libcache-cache-perl, libxml-simple-perl
Standards-Version: 3.7.3
Package: lemonldap-ng
Architecture: all
Depends: liblemonldap-ng-handler-perl (= ${binary:Version}), liblemonldap-ng-manager-perl (= ${binary:Version}), liblemonldap-ng-portal-perl (= ${binary:Version})
Description: Lemonldap::NG Web-SSO system
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
or directly on application apache servers.
.
This package is a meta package that install handler, manager and portal.
Package: lemonldap-ng-doc
Section: doc
Architecture: all
Description: Lemonldap::NG Web-SSO system documentation
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
or directly on application apache servers.
.
This package contains html documentation.
Package: liblemonldap-ng-handler-perl
Architecture: all
Depends: libapache-session-perl, libwww-perl, libcache-cache-perl, liblemonldap-ng-conf-perl (>=0.8.2.3)