Debian Codegraph @

doc/sources/admin/presentation.rst

raw
1 Presentation
2 ============
3
4 LemonLDAP::NG is a modular WebSSO (Single Sign On) written in Perl.
5
6 It is highly customizable, and can be deployed in many different environments
7 and for many different uses. It manages both authentication and authorization
8 and provides customizable logging for accounting. So you can have a full AAA
9 protection for your applications.
10
11 Architecture
12 ------------
13
14 |image0|
15
16 Main components
17 ~~~~~~~~~~~~~~~
18
19 - **Manager**: used to manage LemonLDAP::NG configuration and to
20 explore sessions. Dedicated to administrators
21 - :doc:`Portal<portal>`: used to authenticate
22 users, display applications list and provides identity provider
23 service (`SAML <http://en.wikipedia.org/wiki/SAML>`__,
24 `OpenID <http://en.wikipedia.org/wiki/OpenID>`__,
25 `CAS <http://en.wikipedia.org/wiki/Central_Authentication_Service>`__).
26 Futhermore, Portal offers many other features (see
27 :doc:`portal<portal>` for more)
28 - :doc:`Handler<index_handler>`: used to protect applications which can read HTTP headers
29 or environment variables to get user information
30
31 Databases
32 ~~~~~~~~~
33
34 .. attention::
35
36 We use "database" as a generic term for backends that are not included with
37 LemonLDAP::NG but that we need in order to provide the SSO service.
38 They can be a LDAP directory, a SQL database server, or even a simple local
39 file.
40
41 We split databases in two categories:
42
43 - **External databases**: are not managed by LemonLDAP::NG. Data is externally
44 provided and LemonLDAP::NG generally just needs to read it.
45 - **Internal databases**: its data is controlled by LemonLDAP::NG
46
47 Main
48 :ref:`external databases<start-authentication-users-and-password-databases>`
49 are:
50
51 - **Authentication**: how users are authentified (password, certificate, etc.)
52 - **User**: where to find user attributes
53 - **Password**: how user passwords are changed
54 - **Registration**: where new users are created
55 - **Second factors**: how second factors are validated
56
57 Main internal databases are:
58
59 - :ref:`Configuration<start-configuration-database>`:
60 where configuration is stored. This does not include web server
61 configuration which is not managed by LemonLDAP::NG
62 - :ref:`Sessions<start-sessions-database>`:
63 where sessions are stored.
64 - :doc:`Notifications<notifications>`:
65 messages displayed to connected users
66 - **Cache**: cache for configuration and sessions
67
68
69 .. _presentation-kinematics:
70
71 Kinematics
72 ----------
73
74 .. _presentation-login:
75
76 Handler protection
77 ~~~~~~~~~~~~~~~~~~
78
79 |image1|
80
81 #. User tries to access a protected application, his request is caught by Handler
82 #. :doc:`SSO cookie<ssocookie>` is not detected, so Handler redirects user to Portal
83 #. User authenticates on Portal
84 #. Portal checks authentication
85 #. If authentication succeeds, Portal collects user data
86 #. Portal creates a session to store user data
87 #. Portal gets the session Id
88 #. Portal creates :doc:`SSO cookie<ssocookie>` with the session Id as value
89 #. User is redirected on protected application, with a SSO cookie
90 #. Handler reads session Id from the cookie and retrieves user session data
91 #. Handler stores user data in its cache
92 #. Handler checks access rules and sends headers to the protected application
93 #. Protected application sends response to Handler
94 #. Handler forwards the response to the user
95
96 Then handler will check :doc:`SSO cookies<ssocookie>` for each HTTP request.
97
98 Logout
99 ~~~~~~
100
101 Default use case:
102
103 #. User clicks on the logout link in Portal
104 #. Portal destroys session and redirects user on itself with an empty
105 :doc:`SSO cookies<ssocookie>`
106 #. User is redirected on portal and his :doc:`SSO cookies<ssocookie>` is empty
107
108 LemonLDAP::NG is also able to
109 :doc:`catch logout request<writingrulesand_headers>`
110 on protected applications, with different behavior:
111
112 - **SSO logout**: the request is not forwarded to application, only the
113 SSO session is closed
114 - **Application logout**: the request is forwarded to application but
115 SSO session is not closed
116 - **SSO and Application logout**: the request is forwarded to
117 application and SSO session is closed
118
119 After logout process, the user is redirected on portal, or on a configured URL.
120
121 Session expiration
122 ~~~~~~~~~~~~~~~~~~
123
124 The session expires after 20 hours by default.
125 This duration can be set in the manager's Configuration tab (General Parameters > Sessions > Sessions Timeout).
126
127 .. attention::
128
129 - Handlers have a session cache, with a default lifetime of 10 minutes.
130 So for Handlers embedded by different physical servers than the Portal, a user
131 with an expired session can still be authorized until the cache expiration.
132 - Sessions are deleted by a scheduled task. Do not forget to install cron files!
133
134
135
136 .. _cda:
137
138 Cross Domain Authentication (CDA)
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
141
142 .. note::
143
144 For security reason, a cookie provided for a domain cannot be sent
145 to another domain. To extend SSO on several domains, a cross-domain
146 mechanism is implemented in LemonLDAP::NG.
147
148 #. User owns
149 :doc:`SSO cookies<ssocookie>` on the
150 main domain (see :ref:`Login kinematics<presentation-login>`)
151 #. User tries to access a protected application in a different domain
152 #. Handler does not see
153 :doc:`SSO cookies<ssocookie>`
154 (because it is not in main domain) and redirects user on Portal
155 #. Portal recognizes the user with its
156 :doc:`SSO cookies<ssocookie>`, and
157 see he is coming from a different domain
158 #. Portal redirects user on protected application with a token as URL
159 parameter. The token is linked to a session which contains the real
160 session ID
161 #. Handler detects URL parameter, gets the real session ID, delete the
162 token session and creates a
163 :doc:`SSO cookies<ssocookie>` on its
164 domain, with session ID as value
165
166 Authentication, Authorization and Accounting (AAA) mechanisms
167 -------------------------------------------------------------
168
169 Authentication
170 ~~~~~~~~~~~~~~
171
172 If a user is not authenticated and attempts to connect to an area
173 protected by a LemonLDAP::NG compatible Handler, he is redirected to the
174 portal.
175
176 Authentication process main steps are:
177
178 - **Control asked URL**: prevent XSS attacks and bad redirections
179 - **Control existing session**: detect SSO session, apply configured
180 constraints (1 session per user, 1 session per IP, ...)
181 - **Extract form info**: get login/password, certificate, environment
182 variable (depending on authentication module)
183 - **Get user info**: contact user database to collect attributes
184 - **Ask for second factor if required**: TOTP, Webauthn key, etc...
185 - **Set macros**: compute configured macros
186 - **Set groups**: request user database to find groups
187 - **Set local groups**: compute configured groups
188 - **Authenticate**: contact authentication database to check
189 credentials
190 - **Grant session**: check rights to open SSO session
191 - **Store**: store user info in session database
192 - **Build cookie**: build
193 :doc:`SSO cookies<ssocookie>` with
194 session ID
195 - **Redirect**: redirect user on protected application or on Portal
196 (applications menu)
197
198 LemonLDAP::NG
199 :doc:`SSO cookies<ssocookie>` are
200 generated by
201 `Apache::Session <http://search.cpan.org/perldoc?Apache::Session>`__,
202 they are as secure as a 128-bit random cookie. You may use the
203 :doc:`securedCookie<ssocookie>` options
204 to avoid session hijacking. (since version 1.4.0 you can use SHA256 for
205 generating safer cookies)
206
207 Authorization
208 ~~~~~~~~~~~~~
209
210 Authorization is controlled only by Handlers. An authorization is
211 defined by:
212
213 - An URL pattern (or ``default`` to match other URLs)
214 - An access rule
215
216
217 .. note::
218
219 Authorizations are defined inside a virtualhost and takes effect
220 only on it. There are no *global* authorizations except the right to
221 open a session in the portal.
222
223 Access rules values can be:
224
225 - ``accept``: all authenticated users can pass
226 - ``deny``: nobody is welcomed
227 - ``skip``: all is open!
228 - ``unprotect``: all is open, but authenticated users are seen as
229 authenticated
230 - ``logout_sso``, ``logout_app``, ``logout_app_sso``: catch logout
231 request
232 - Perl expression: perl code snippet that returns 0 or 1
233
234 Some examples:
235
236 - Accept all authenticated users:
237
238 - URL pattern: ``default``
239 - Access rule: ``accept``
240
241 - Restrict /admin to administrators group
242
243 - URL pattern: ``^/admin/``
244 - Access rule: ``$groups =~ /\badministrators\b/``
245
246
247 .. tip::
248
249 \ ``\b`` means start or end of a word in PCRE (Perl Compatible
250 Regular Expressions)
251
252 See
253 :doc:`Writing rules and headers<writingrulesand_headers>`
254 chapter.
255
256 Accounting
257 ~~~~~~~~~~
258
259 Logging portal access
260 ^^^^^^^^^^^^^^^^^^^^^
261
262 Portal produce a ``notice`` message in
263 :doc:`Web server logs or syslog<logs>` when a user
264 authenticates (or fails to authenticate) and logs out.
265
266 Logging application access
267 ^^^^^^^^^^^^^^^^^^^^^^^^^^
268
269 Handler informs Web server of connected user (parameter
270 ``whatToTrace``), so you can see user login in Web server access logs.
271
272 The real accounting has to be done by the application itself since SSO
273 logs can not understand transactions.
274
275 LemonLDAP::NG can export
276 :ref:`HTTP headers<headers>`
277 either using a proxy or protecting directly the application.
278
279 An HTTP header is defined by:
280
281 - A name
282 - A value
283
284
285 .. note::
286
287 Headers are defined inside a virtualhost and take effect only on
288 it. There are no *global* headers.
289
290 The header value is a Perl expression, returning a string.
291
292 Some examples:
293
294 - Send login in Auth-User:
295
296 - Name: ``Auth-User``
297 - Value: ``$uid``
298
299 - Send "Lastname, firstname" in Auth-Name:
300
301 - Name: ``Auth-Name``
302 - Value: ``$sn + ", " + $gn``
303
304 See
305 :doc:`Writing rules and headers<writingrulesand_headers>`
306 for more.
307
308 .. |image0| image:: documentation/lemonldap-ng-architecture.png
309 :class: align-center
310 :width: 600px
311 .. |image1| image:: documentation/lemonldapng-sso.png
312 :class: align-center
313 :width: 800px