Debian Codegraph @

doc/sources/admin/applications/alfresco.rst

raw
1 Alfresco
2 ========
3
4 |image0|
5
6 Presentation
7 ------------
8
9 `Alfresco <https://www.alfresco.com/>`__ is an ECM/BPM software.
10
11 Since 4.0 release, it offers an easy way to configure SSO thanks to
12 authentication subsystems.
13
14 Authentication against LL::NG can be done through:
15
16 - HTTP headers (LL::NG Handler)
17 - SAML 2 (LL::NG as SAML2 IDP)
18
19
20 .. tip::
21
22 Alfresco now recommends SAML2 method
23
24 HTTP headers
25 ------------
26
27 .. _alfresco-1:
28
29 Alfresco
30 ~~~~~~~~
31
32
33 .. tip::
34
35 The official documentation can be found here:
36 http://docs.alfresco.com/4.0/tasks/auth-alfrescoexternal-sso.html\
37
38 You need to find the following files in your Alfresco installation:
39
40 - ``alfresco-global.properties`` (ex:
41 ``tomcat/shared/classes/alfresco-global.properties``)
42 - ``share-config-custom.xml`` (ex:
43 ``tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml``)
44
45 The first will allow one to configure SSO for the alfresco webapp, and
46 the other for the share webapp.
47
48 Edit first ``alfresco-global.properties`` and add the following:
49
50 .. code-block:: properties
51
52 ### SSO ###
53 authentication.chain=external1:external
54 external.authentication.enabled=true
55 external.authentication.defaultAdministratorUserNames=
56 external.authentication.proxyUserName=
57 external.authentication.proxyHeader=Auth-User
58 external.authentication.userIdPattern=
59
60 Edit then ``share-config-custom.xml`` and uncomment the last part. In
61 the ``<endpoint>``, change ``<connector-id>`` value to
62 ``alfrescoHeader`` and change the ``<userHeader>`` value to
63 ``Auth-User``:
64
65 .. code-block:: xml
66
67 <config evaluator="string-compare" condition="Remote">
68 <remote>
69 <keystore>
70 <path>alfresco/web-extension/alfresco-system.p12</path>
71 <type>pkcs12</type>
72 <password>alfresco-system</password>
73 </keystore>
74
75 <connector>
76 <id>alfrescoCookie</id>
77 <name>Alfresco Connector</name>
78 <description>Connects to an Alfresco instance using cookie-based authentication</description>
79 <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
80 </connector>
81
82 <connector>
83 <id>alfrescoHeader</id>
84 <name>Alfresco Connector</name>
85 <description>Connects to an Alfresco instance using header and cookie-based authentication</description>
86 <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
87 <userHeader>Auth-User</userHeader>
88 </connector>
89
90 <endpoint>
91 <id>alfresco</id>
92 <name>Alfresco - user access</name>
93 <description>Access to Alfresco Repository WebScripts that require user authentication</description>
94 <connector-id>alfrescoHeader</connector-id>
95 <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
96 <identity>user</identity>
97 <external-auth>true</external-auth>
98 </endpoint>
99 </remote>
100 </config>
101
102 You need to restart Tomcat to apply changes.
103
104
105 .. danger::
106
107 Now you can log in with a simple HTTP header. You need to
108 restrict access to Alfresco to LL::NG.
109
110 LL::NG
111 ~~~~~~
112
113 Headers
114 ^^^^^^^
115
116 Just set the ``Auth-User`` header with the attribute that carries the
117 user login, for example ``$uid``.
118
119 Rules
120 ^^^^^
121
122 Set the default rule to what you need.
123
124 Other rules:
125
126 - Unprotect access to some resources
127
128 - ``^/share/s => unprotect``
129 - ``^/share/res => unprotect``
130 - ``^/share/noauth => unprotect``
131 - ``^/share/proxy/alfresco-noauth => unprotect``
132
133 - Catch logout: ``^/share/page/dologout => logout_app_sso``
134
135 SAML2
136 -----
137
138 .. _alfresco-2:
139
140 Alfresco
141 ~~~~~~~~
142
143 Install SAML Alfresco module package:
144
145 ::
146
147 cp alfresco-saml-repo-1.0.1.amp <ALFRESCO_HOME>/amps
148 cp alfresco-saml-share-1.0.1.amp <ALFRESCO_HOME>/amps_share
149 ./bin/apply_amp.sh
150
151 Generate SAML certificate:
152
153 ::
154
155 keytool -genkeypair -alias my-saml-key -keypass change-me -storepass change-me -keystore my-saml.keystore -storetype JCEKS
156
157 Export the keystore:
158
159 ::
160
161 mv my-saml.keystore alf_data/keystore
162 cat <<EOT > alf_data/keystore/my-saml.keystore-metadata.properties
163 aliases=my-saml-key
164 keystore.password=change-me
165 my-saml-key.password=change-me
166 EOT
167 cat <<EOT >> tomcat/shared/classes/alfresco-global.properties
168
169 saml.keystore.location=\${dir.keystore}/my-saml.keystore
170 saml.keystore.keyMetaData.location=\${dir.keystore}/my-saml.keystore-metadata.properties
171 EOT
172
173 Edit then ``share-config-custom.xml``:
174
175 .. code-block:: xml
176
177 ...
178 <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
179
180
181
182 <!--
183 If using https make a CSRFPolicy with replace="true" and override the properties section.
184 Note, localhost is there to allow local checks to succeed.
185
186
187
188 I.e.
189 <properties>
190 <token>Alfresco-CSRFToken</token>
191 <referer>https://your-domain.com/.*|http://localhost:8080/.*</referer>
192 <origin>https://your-domain.com|http://localhost:8080</origin>
193 </properties>
194 -->
195
196
197
198 <filter>
199
200
201
202 <!-- SAML SPECIFIC CONFIG - START -->
203
204
205
206 <!--
207 Since we have added the CSRF filter with filter-mapping of "/*" we will catch all public GET to avoid them
208 having to pass through the remaining rules.
209 -->
210 <rule>
211 <request>
212 <method>GET</method>
213 <path>/res/.*</path>
214 </request>
215 </rule>
216
217
218
219 <!-- Incoming posts from IDPs do not require a token -->
220 <rule>
221 <request>
222 <method>POST</method>
223 <path>/page/saml-authnresponse|/page/saml-logoutresponse|/page/saml-logoutrequest</path>
224 </request>
225 </rule>
226
227
228
229 <!-- SAML SPECIFIC CONFIG - STOP -->
230
231
232
233 <!-- EVERYTHING BELOW FROM HERE IS COPIED FROM share-security-config.xml -->
234
235
236
237 <!--
238 Certain webscripts shall not be allowed to be accessed directly form the browser.
239 Make sure to throw an error if they are used.
240 -->
241 <rule>
242 <request>
243 <path>/proxy/alfresco/remoteadm/.*</path>
244 </request>
245 <action name="throwError">
246 <param name="message">It is not allowed to access this url from your browser</param>
247 </action>
248 </rule>
249
250
251
252 <!--
253 Certain Repo webscripts should be allowed to pass without a token since they have no Share knowledge.
254 TODO: Refactor the publishing code so that form that is posted to this URL is a Share webscript with the right tokens.
255 -->
256 <rule>
257 <request>
258 <method>POST</method>
259 <path>/proxy/alfresco/api/publishing/channels/.+</path>
260 </request>
261 <action name="assertReferer">
262 <param name="referer">{referer}</param>
263 </action>
264 <action name="assertOrigin">
265 <param name="origin">{origin}</param>
266 </action>
267 </rule>
268
269
270
271 <!--
272 Certain Surf POST requests from the WebScript console must be allowed to pass without a token since
273 the Surf WebScript console code can't be dependent on a Share specific filter.
274 -->
275 <rule>
276 <request>
277 <method>POST</method>
278 <path>/page/caches/dependency/clear|/page/index|/page/surfBugStatus|/page/modules/deploy|/page/modules/module|/page/api/javascript/debugger|/page/console</path>
279 </request>
280 <action name="assertReferer">
281 <param name="referer">{referer}</param>
282 </action>
283 <action name="assertOrigin">
284 <param name="origin">{origin}</param>
285 </action>
286 </rule>
287
288
289
290 <!-- Certain Share POST requests does NOT require a token -->
291 <rule>
292 <request>
293 <method>POST</method>
294 <path>/page/dologin(\?.+)?|/page/site/[^/]+/start-workflow|/page/start-workflow|/page/context/[^/]+/start-workflow</path>
295 </request>
296 <action name="assertReferer">
297 <param name="referer">{referer}</param>
298 </action>
299 <action name="assertOrigin">
300 <param name="origin">{origin}</param>
301 </action>
302 </rule>
303
304
305
306 <!-- Assert logout is done from a valid domain, if so clear the token when logging out -->
307 <rule>
308 <request>
309 <method>POST</method>
310 <path>/page/dologout(\?.+)?</path>
311 </request>
312 <action name="assertReferer">
313 <param name="referer">{referer}</param>
314 </action>
315 <action name="assertOrigin">
316 <param name="origin">{origin}</param>
317 </action>
318 <action name="clearToken">
319 <param name="session">{token}</param>
320 <param name="cookie">{token}</param>
321 </action>
322 </rule>
323
324
325
326 <!-- Make sure the first token is generated -->
327 <rule>
328 <request>
329 <session>
330 <attribute name="_alf_USER_ID">.+</attribute>
331 <attribute name="{token}"/>
332 <!-- empty attribute element indicates null, meaning the token has not yet been set -->
333 </session>
334 </request>
335 <action name="generateToken">
336 <param name="session">{token}</param>
337 <param name="cookie">{token}</param>
338 </action>
339 </rule>
340
341
342
343 <!-- Refresh token on new "page" visit when a user is logged in -->
344 <rule>
345 <request>
346 <method>GET</method>
347 <path>/page/.*</path>
348 <session>
349 <attribute name="_alf_USER_ID">.+</attribute>
350 <attribute name="{token}">.+</attribute>
351 </session>
352 </request>
353 <action name="generateToken">
354 <param name="session">{token}</param>
355 <param name="cookie">{token}</param>
356 </action>
357 </rule>
358
359
360
361 <!--
362 Verify multipart requests from logged in users contain the token as a parameter
363 and also correct referer & origin header if available
364 -->
365 <rule>
366 <request>
367 <method>POST</method>
368 <header name="Content-Type">multipart/.+</header>
369 <session>
370 <attribute name="_alf_USER_ID">.+</attribute>
371 </session>
372 </request>
373 <action name="assertToken">
374 <param name="session">{token}</param>
375 <param name="parameter">{token}</param>
376 </action>
377 <action name="assertReferer">
378 <param name="referer">{referer}</param>
379 </action>
380 <action name="assertOrigin">
381 <param name="origin">{origin}</param>
382 </action>
383 </rule>
384
385
386
387 <!--
388 Verify that all remaining state changing requests from logged in users' requests contains a token in the
389 header and correct referer & origin headers if available. We "catch" all content types since just setting it to
390 "application/json.*" since a webscript that doesn't require a json request body otherwise would be
391 successfully executed using i.e."text/plain".
392 -->
393 <rule>
394 <request>
395 <method>POST|PUT|DELETE</method>
396 <session>
397 <attribute name="_alf_USER_ID">.+</attribute>
398 </session>
399 </request>
400 <action name="assertToken">
401 <param name="session">{token}</param>
402 <param name="header">{token}</param>
403 </action>
404 <action name="assertReferer">
405 <param name="referer">{referer}</param>
406 </action>
407 <action name="assertOrigin">
408 <param name="origin">{origin}</param>
409 </action>
410 </rule>
411 </filter>
412 </config>
413 ...
414
415 Configure SAML service provider using the Alfresco admin console
416 (/alfresco/s/enterprise/admin/admin-saml).
417
418 Set the following parameters:
419
420 - Enable SAML Authentication (SSO): on
421 - Authentication service URL:
422 https://auth.example.com/saml/singleSignOn
423 - Single Logout URL: https://auth.example.com/saml/singleLogout
424 - Single logout return URL:
425 https://auth.example.com/saml/singleLogoutReturn
426 - Entity identification: http://alfresco.myecm.org:8080/share
427 - User ID mapping: Subject/NameID
428
429 To finish with Alfresco configuration, tick the “Enable SAML
430 authentication (SSO)” box.
431
432 .. _llng-1:
433
434 LL::NG
435 ~~~~~~
436
437 Configure SAML service and set a certificate as signature public key in
438 metadata.
439
440 Export Alfresco SAML Metadata from admin console and import them in
441 LL::NG.
442
443 In the authentication response option, set:
444
445 - Default NameID Format: Unspecified
446 - Force NameID session key: uid
447
448 And you can define these exported attributes:
449
450 - GivenName
451 - Surname
452 - Email
453
454 Other resources
455 ---------------
456
457 - `DevCon 2012: Unlocking the Secrets of Alfresco Authentication, Mehdi
458 Belmekki <https://www.youtube.com/watch?v=5tS0XrC_-rw>`__
459 - `Setting up Alfresco SAML authentication with
460 LemonLDAP::NG <https://community.alfresco.com/blogs/alfresco-premier-services/2017/08/03/setting-up-alfresco-saml-authentication-lemonldapng>`__
461
462 .. |image0| image:: /applications/alfresco_logo.png
463 :class: align-center
464