lemonldap-ng/doc/sources/admin/impersonation.rst

87 lines
2.8 KiB
ReStructuredText
Raw Normal View History

2020-05-14 23:29:41 +02:00
Impersonation plugin
====================
This plugin allows certain users to assume the identity of another user.
A privileged user first logs in with its real account and can then
choose another profile to appear as. This feature can be especially
useful for training/learning or development platforms.
2020-05-21 15:13:24 +02:00
.. attention::
2020-05-14 23:29:41 +02:00
This plugin should not be used on production instance,
prefer :doc:`ContextSwitching plugin<contextswitching>`.
Configuration
-------------
Just enable it in the Manager (section “plugins”) by setting a rule.
Impersonation can be allowed or denied for specific users. Furthermore,
specific identities like administrators or anonymous users can be
protected from being impersonated.
- **Parameters**:
- **Use rule**: Rule to allow/deny users to impersonate or define
which users may use this plugin.
- **Identities use rule**: Rule to define which identities can be
assumed. Useful to prevent impersonation of certain sensitive
identities like CEO, administrators or anonymous/protected users
2020-05-20 22:48:54 +02:00
- **Unrestricted users rule**: Rule to define which users can assume
ALL users. ``Identities use rule`` is bypassed.
2020-05-14 23:29:41 +02:00
- **Hidden attributes**: Attributes not displayed
- **Skip empty values**: Do not use empty profile attributes
- **Merge spoofed and real SSO groups**: Can be useful for
administrators to keep higher privileges. "Special rule" field can
be used to set SSO groups to merge if exist in real session.
Multivalue ``separator`` is used. By example :
``su; admins; anonymous``
2020-05-21 15:13:24 +02:00
.. danger::
2020-05-14 23:29:41 +02:00
You HAVE TO modify **REMOTE_USER** to log both real AND
spoofed uid.
2020-05-18 09:56:39 +02:00
2020-05-14 23:29:41 +02:00
Set a macro like this :
2020-05-18 09:56:39 +02:00
2020-05-21 15:13:24 +02:00
``_whatToTrace`` -> ``$real__user ? "$real__user/$_user" : "$_user/$_user"``
2020-05-18 09:56:39 +02:00
2020-05-21 15:13:24 +02:00
and set ``General Parameters > Logs > REMOTE_USER`` with ``_whatToTrace``
2020-05-14 23:29:41 +02:00
2020-05-21 15:13:24 +02:00
.. attention::
2020-05-14 23:29:41 +02:00
Both spoofed and real session attributes can be used to
set access rules, groups or macros.
2020-05-18 09:56:39 +02:00
2021-06-09 14:42:59 +02:00
By example : ``$real_uid && $real_uid eq 'dwho'`` or ``$real_groups && $real_groups =~ /\bsu\b/``
2020-05-18 09:56:39 +02:00
2020-05-14 23:29:41 +02:00
Keep in mind that real session is computed first. Afterward, if access
is granted, impersonated session is computed with real and spoofed
2020-05-18 09:56:39 +02:00
session attributes if Impersonation is allowed.
2021-06-14 15:09:26 +02:00
So, ``real_`` attributes are computed by second authentication process.
2021-06-09 14:42:59 +02:00
To avoid Perl warnings, you have to prefix regex with ``$real_var &&``.
2020-05-14 23:29:41 +02:00
2020-05-21 15:13:24 +02:00
.. attention::
2020-05-14 23:29:41 +02:00
By example, to prevent impersonation as 'dwho' set
**Identities use rule** like :
2020-05-18 09:56:39 +02:00
2020-05-21 15:13:24 +02:00
``$uid ne 'dwho'``
2020-05-18 09:56:39 +02:00
2020-05-14 23:29:41 +02:00
impersonationPrefix is used to rename user's real profile attributes.
You can set real attributes prefix ('real\_' by default) by editing
``lemonldap-ng.ini`` in section [portal]:
2020-05-21 15:13:24 +02:00
.. code-block:: ini
2020-05-14 23:29:41 +02:00
[portal]
impersonationPrefix = real_