.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Lemonldap::NG::Handler 3pm" .TH Lemonldap::NG::Handler 3pm "2017-02-12" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Lemonldap::NG::Handler \- The Apache protection module part of Lemonldap::NG Web\-SSO system. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .SS "Configure Apache" .IX Subsection "Configure Apache" Call Handler in /apache\-dir/conf/httpd.conf: .PP .Vb 8 \& # Load your package \& PerlRequire /My/File \& # TOTAL PROTECTION \& PerlHeaderParserHandler Lemonldap::NG::Handler::DefaultHandler \& # OR SELECTED AREA \& \& PerlHeaderParserHandler Lemonldap::NG::Handler::DefaultHandler \& .Ve .PP The configuration is loaded only at Apache start. Create an \s-1URI\s0 to force configuration reload, so you don't need to restart Apache at each change: .PP .Vb 7 \& # /apache\-dir/conf/httpd.conf \& \& Order deny,allow \& Deny from all \& Allow from my.manager.com \& PerlHeaderParserHandler Lemonldap::NG::Handler::DefaultHandler\->refresh \& .Ve .PP To display the status page, add something like this : .PP .Vb 6 \& \& Order deny,allow \& Allow from 10.1.1.0/24 \& Deny from all \& PerlHeaderParserHandler Lemonldap::NG::Handler::DefaultHandler\->status \& .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" 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. .PP It manages both authentication and authorization and provides headers for accounting. So you can have a full \s-1AAA\s0 protection for your web space as described below. .PP The Apache module part works both with Apache 1.3.x and 2.x ie mod_perl 1 and 2 but \fBnot with mod_perl 1.99\fR. .SS "Authentication, Authorization, Accounting" .IX Subsection "Authentication, Authorization, Accounting" \fI\f(BIAuthentication\fI\fR .IX Subsection "Authentication" .PP If a user isn't authenticated and attempts 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 for more). .PP Lemonldap::NG use session cookies generated by Apache::Session so as secure as a 128\-bit random cookie. You may use the \f(CW\*(C`securedCookie\*(C'\fR options of Lemonldap::NG::Portal to avoid session hijacking. .PP You have to manage life of sessions by yourself since Lemonldap::NG knows nothing about the 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 \f(CW\*(C`_utime\*(C'\fR 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. .PP \fI\f(BIAuthorization\fI\fR .IX Subsection "Authorization" .PP Authorization is controlled only by handlers because the portal knows nothing about the way the user will choose. When configuring your Web-SSO, you have to: .IP "\(bu" 4 choose the ldap attributes you want to use to manage accounting and authorization (see \f(CW\*(C`exportedHeaders\*(C'\fR parameter in Lemonldap::NG::Portal documentation). .IP "\(bu" 4 create Perl expressions to define user groups (using ldap attributes) .IP "\(bu" 4 create an array foreach virtual host associating \s-1URI\s0 regular expressions and Perl expressions to use to grant access. .PP Example (See Lemonldap::NG::Manager to see how configuration is stored) .IX Subsection "Example (See Lemonldap::NG::Manager to see how configuration is stored)" .PP Exported variables (values will be stored in session database by Lemonldap::NG::Portal): .PP .Vb 5 \& exportedVars => { \& cn => "cn", \& departmentUID => "departmentUID", \& login => "uid", \& }, .Ve .PP User groups (values will be stored in session database by Lemonldap::NG::Portal): .PP .Vb 4 \& groups => { \& group1 => \*(Aq{ $departmentUID eq "unit1" or $login = "xavier.guimard" }\*(Aq, \& ... \& }, .Ve .PP Area protection: .PP .Vb 11 \& locationRules => { \& www1.domain.com => { \& \*(Aq^/protected/.*$\*(Aq => \*(Aq$groups =~ /\ebgroup1\eb/\*(Aq, \& default => \*(Aqaccept\*(Aq, \& }, \& www2.domain.com => { \& \*(Aq^/site/.*$\*(Aq => \*(Aq$uid eq "xavier.guimard" or $groups =~ /\ebgroup2\eb/\*(Aq, \& \*(Aq^/(js|css)\*(Aq => \*(Aqaccept\*(Aq, \& default => \*(Aqdeny\*(Aq, \& }, \& }, .Ve .PP Performance .IX Subsection "Performance" .PP You can use Perl expressions as complicated as you want and you can use all the exported \s-1LDAP\s0 attributes (and create your own attributes: with 'macros' mechanism. See Lemonldap::NG::Manager) in groups evaluations, area protections or custom \s-1HTTP\s0 headers (you just have to call them with a \*(L"$\*(R"). .PP You have to be careful when choosing your expressions: .IP "\(bu" 4 \&\f(CW\*(C`groups\*(C'\fR and \f(CW\*(C`macros\*(C'\fR are evaluated each time a user is redirected to the portal, .IP "\(bu" 4 \&\f(CW\*(C`locationRules\*(C'\fR and \f(CW\*(C`exportedheaders\*(C'\fR are evaluated for each request on a protected area. .PP It is also recommended to use the \f(CW\*(C`groups\*(C'\fR mechanism to avoid having to evaluate a long expression at each \s-1HTTP\s0 request: .PP .Vb 5 \& locationRules => { \& www1.domain.com => { \& \*(Aq^/protected/.*$\*(Aq => \*(Aq$groups =~ /\ebgroup1\eb/\*(Aq, \& }, \& }, .Ve .PP You can also use \s-1LDAP\s0 filters, or Perl expression or mixed expressions in \&\f(CW\*(C`groups\*(C'\fR parameter. Perl expressions has to be enclosed with \f(CW\*(C`{}\*(C'\fR: .IP "\(bu" 4 \&\f(CW\*(C`group1 => \*(Aq(|(uid=xavier.guimard)(ou=unit1))\*(Aq\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`group1 => \*(Aq{$uid eq "xavier.guimard" or $ou eq "unit1"}\*(Aq\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`group1 => \*(Aq(|(uid=xavier.guimard){$ou eq "unit1"})\*(Aq\*(C'\fR .PP It is also recommended to use Perl expressions to avoid requiring the \s-1LDAP\s0 server more than 2 times per authentication. .PP \fI\f(BIAccounting\fI\fR .IX Subsection "Accounting" .PP \fILogging portal access\fR .IX Subsection "Logging portal access" .PP Lemonldap::NG::Portal doesn't log anything by default, but it's easy to overload \&\f(CW\*(C`log\*(C'\fR method for normal portal access or using \f(CW\*(C`error\*(C'\fR method to know what was wrong if \f(CW\*(C`process\*(C'\fR method has failed. .PP \fILogging application access\fR .IX Subsection "Logging application access" .PP Because an handler knows nothing about the protected application, it can't do more than logging \s-1URL.\s0 As Apache does this fine, Lemonldap::NG::Handler gives it the name to used in logs. The \f(CW\*(C`whatToTrace\*(C'\fR parameters indicates which variable Apache has to use (\f(CW$uid\fR by default). .PP The real accounting has to be done by the application itself which knows the result of \s-1SQL\s0 transaction for example. .PP Lemonldap::NG can export \s-1HTTP\s0 headers either using a proxy or protecting directly the application. By default, the \f(CW\*(C`Auth\-User\*(C'\fR field is used but you can change it using the \f(CW\*(C`exportedHeaders\*(C'\fR parameters (stored in the configuration database). This parameters contains an associative array per virtual host: .IP "\(bu" 4 \&\fBkeys\fR are the names of the chosen headers .IP "\(bu" 4 \&\fBvalues\fR are Perl expressions where you can use user datas stored in the global store by calling them \f(CW\*(C`$\*(C'\fR. .PP Example: .PP .Vb 10 \& exportedHeaders => { \& www1.domain.com => { \& \*(AqAuth\-User\*(Aq => \*(Aq$uid\*(Aq, \& \*(AqUnit\*(Aq => \*(Aq$ou\*(Aq, \& }, \& www2.domain.com => { \& \*(AqAuthorization\*(Aq => \*(Aq"Basic ".encode_base64($employeeNumber.":dummy", "")\*(Aq, \& \*(AqRemote\-IP\*(Aq => \*(Aq$ip\*(Aq, \& }, \& } .Ve .SS "Session storage systems" .IX Subsection "Session storage systems" Lemonldap::NG use 3 levels of cache for authenticated users: .IP "\(bu" 4 an Apache::Session::* module choosed with the \f(CW\*(C`globalStorage\*(C'\fR parameter (completed with \f(CW\*(C`globalStorageOptions\*(C'\fR) and used by lemonldap::NG::Portal to store authenticated user parameters, .IP "\(bu" 4 a Cache::Cache module choosed with the \f(CW\*(C`localSessionStorage\*(C'\fR parameter (completed with \f(CW\*(C`localSessionStorageOptions\*(C'\fR) and used to share authenticated users between Apache's threads or processus and of course between virtual hosts, .IP "\(bu" 4 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 \s-1HTTP/1.1\s0 Keep-Alive system. .PP So the number of request to the central storage is limited to 1 per active user each 10 minutes. .PP Lemonldap::NG is very fast, but you can increase performance using a Cache::Cache module that does not use disk access. .SS "Logout system" .IX Subsection "Logout system" Lemonldap::NG provides a single logout system: you can use it by adding a link to the portal with \*(L"logout=1\*(R" parameter in the portal (See Lemonldap::NG::Portal) and/or by configuring handler to intercept some \s-1URL \&\s0(See Sinopsys). The logout system: .IP "\(bu" 4 delete session in the global session storage, .IP "\(bu" 4 replace Lemonldap::NG cookie by '', .IP "\(bu" 4 delete handler caches only if logout action was started from a protected application and only in the current Apache server. So in other servers, session is still in cache for 10 minutes maximum if the user was connected on it in the last 10 minutes. .PP You can also configure rules in the Manager interface to intercept logout \s-1URL.\s0 See Lemonldap::NG::Manager and Lemonldap::NG::Handler for more. .SH "USING LEMONLDAP::NG::HANDLER FOR DEVELOPMENT" .IX Header "USING LEMONLDAP::NG::HANDLER FOR DEVELOPMENT" Lemonldap::NG::Handler provides different modules: .IP "\(bu" 4 Lemonldap::NG::Handler::CGI: if you have only a few Perl \s-1CGI\s0 to protect, you can use this module in your \s-1CGI\s0 instead of protecting it under Lemonldap::NG::Handler::SharedConf. .IP "\(bu" 4 Lemonldap::NG::Handler::Proxy: this module isn't used to manage security but is written to create a reverse-proxy without using mod_proxy. In some case, mod_proxy does not manage correctly some redirections, that is why this module still exists. .PP All those modules are compatible both with Apache and mod_perl version 1 and 2, but \s-1NOT\s0 with mod_perl 1.99. If you use Linux distributions like Debian Sarge who provide mod_perl 1.99 for Apache2, you have to use Apache\-1.3 or to download a mod_perl2 backport. .SH "SEE ALSO" .IX Header "SEE ALSO" Lemonldap::NG::Handler::DefaultHandler, Lemonldap::NG::Portal, Lemonldap::NG::Manager, .SH "AUTHOR" .IX Header "AUTHOR" .IP "Clement Oudot, " 4 .IX Item "Clement Oudot, " .PD 0 .IP "François\-Xavier Deltombe, " 4 .IX Item "François-Xavier Deltombe, " .IP "Xavier Guimard, " 4 .IX Item "Xavier Guimard, " .PD .SH "BUG REPORT" .IX Header "BUG REPORT" Use \s-1OW2\s0 system to report bug or ask for features: .SH "DOWNLOAD" .IX Header "DOWNLOAD" Lemonldap::NG is available at .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" .IP "Copyright (C) 2005\-2012 by Xavier Guimard, " 4 .IX Item "Copyright (C) 2005-2012 by Xavier Guimard, " .PD 0 .IP "Copyright (C) 2012\-2015 by François\-Xavier Deltombe, " 4 .IX Item "Copyright (C) 2012-2015 by François-Xavier Deltombe, " .IP "Copyright (C) 2006\-2012 by Clement Oudot, " 4 .IX Item "Copyright (C) 2006-2012 by Clement Oudot, " .PD .PP This library is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program. If not, see .