LemonLDAP::NG

- Architecture
- Kinematics
- Authentication, Authorization and Accounting mechanisms
- Installation
- Session storage system
- Author
- Copyright and licence
Architecture
Lemonldap::NG est composed by 3 elements and 3 databases :
- the Manager used to manage Lemonldap::NG configuration,
- the Portal used to authenticate users,
- Apache modules used to protect applications. They can protect an Apache area which can be a reverse-proxy. In this case, it is recommended to securise the link between the reverse-proxy and the hidden server because access can be done without authentication to this server. A simple .htaccess or an SSL handshake can be used depending on the security level of the host network.
- the configuration database : by default, it's a simple directory, but you can use a network database to share configuration if all the Lemonldap::NG components aren't on the same physical server,
- the LDAP server : in addition to the authentications (that can be done by another mechanism as X509 certificates), it is used to load user attributes and calculate the rights,
- the sessions database : Lemonldap::NG uses Apache::Session modules to manage sessions. By default, it uses Apache::Session::File module and so, this database is a simple directory. Using Apache::Session::MySQL for example, the database can be used on a network so Lemonldap::NG can works on several physical servers.
Kinematics

- 1 and 2 : non-authenticated users (ie without valid cookie) are redirected to the portal,
- 3 : authentication request (login password validated on LDAP server or other mechanism),
- 4 : recovery ok user attributes,
- 5 : calculation of the additional attributes asked in the configuration (macros and groups) and storage of the user datas in the sessions database,
- 6 : cookie generation and redirection to the asked URL,
- 7 : interception of the cookie by the agent of protection (Apache module) and recovery of the user datas,
- 8 : checking of the access authorization to the asked URL and transmission to the application (real application or reverse-proxy) if granted,
- 9 and 10 : other request are treated directly with the use datas stored in the local cache. Access grant is calculated at each request.
Authentication, Authorization and Accounting mechanisms
All parameters described here can be edited by the administration interface (See Manager demonstration).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 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.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.
- Exported variables :
# Custom-Name => LDAP attribute cn => cn departmentUID => departmentUID login => uid
- User groups :
# Custom-Name => group definition group1 => { $departmentUID eq "unit1" or $login = "user1" }
- 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
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 "$"). ou 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.
^/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"})
Accounting
Logging portal access
Lemonldap::NG::Portal doesn't log anything by default, but it's easy to overload log method for normal portal access.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, Lemonldap::NG::Handler(3) 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.
- www1.domain.com :
Auth-User => $uid Unit => $ou
- www2.domain.com :
Authorization => "Basic ".encode_base64($employeeNumber.":dummy") Remote-IP => $ip
Installation
Warnings :- 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.
- Lemonldap::NG configuration has to be edited using the manager unless you know exactly what you are doing. The parameters discussed below are all in the configuration tree.
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.