Debian Codegraph @

doc/sources/admin/impersonation.rst

raw
1 Impersonation plugin
2 ====================
3
4 This plugin allows certain users to assume the identity of another user.
5 A privileged user first logs in with its real account and can then
6 choose another profile to appear as. This feature can be especially
7 useful for training/learning or development platforms.
8
9
10 .. attention::
11
12 This plugin should not be used on production instance,
13 prefer :doc:`ContextSwitching plugin<contextswitching>`.
14
15 Configuration
16 -------------
17
18 Just enable it in the Manager (section “plugins”) by setting a rule.
19 Impersonation can be allowed or denied for specific users. Furthermore,
20 specific identities like administrators or anonymous users can be
21 protected from being impersonated.
22
23 - **Parameters**:
24
25 - **Use rule**: Rule to allow/deny users to impersonate or define
26 which users may use this plugin.
27 - **Identities use rule**: Rule to define which identities can be
28 assumed. Useful to prevent impersonation of certain sensitive
29 identities like CEO, administrators or anonymous/protected users
30 - **Unrestricted users rule**: Rule to define which users can assume
31 ALL users. ``Identities use rule`` is bypassed.
32 - **Hidden attributes**: Attributes not displayed
33 - **Skip empty values**: Do not use empty profile attributes
34 - **Merge spoofed and real SSO groups**: Can be useful for
35 administrators to keep higher privileges. "Special rule" field can
36 be used to set SSO groups to merge if exist in real session.
37 Multivalue ``separator`` is used. By example :
38 ``su; admins; anonymous``
39
40
41 .. danger::
42
43 You HAVE TO modify **REMOTE_USER** to log both real AND
44 spoofed uid.
45
46 Set a macro like this :
47
48 ``_whatToTrace`` -> ``$real__user ? "$real__user/$_user" : "$_user/$_user"``
49
50 and set ``General Parameters > Logs > REMOTE_USER`` with ``_whatToTrace``
51
52
53
54 .. attention::
55
56 Both spoofed and real session attributes can be used to
57 set access rules, groups or macros.
58
59 By example : ``$real_uid && $real_uid eq 'dwho'`` or ``$real_groups && $real_groups =~ /\bsu\b/``
60
61 Keep in mind that real session is computed first. Afterward, if access
62 is granted, impersonated session is computed with real and spoofed
63 session attributes if Impersonation is allowed.
64 So, ``real_`` attributes are computed by second authentication process.
65 To avoid Perl warnings, you have to prefix regex with ``$real_var &&``.
66
67
68
69 .. attention::
70
71 By example, to prevent impersonation as 'dwho' set
72 **Identities use rule** like :
73
74 ``$uid ne 'dwho'``
75
76
77
78 impersonationPrefix is used to rename user's real profile attributes.
79 You can set real attributes prefix ('real\_' by default) by editing
80 ``lemonldap-ng.ini`` in section [portal]:
81
82 .. code-block:: ini
83
84 [portal]
85 impersonationPrefix = real_
86