| 1 |
Second Factors |
| 2 |
============== |
| 3 |
|
| 4 |
Two-Factor Authentication *(as known as 2FA)* is a kind (subset) of |
| 5 |
`multi-factor |
| 6 |
authentication <https://en.wikipedia.org/wiki/Multi-factor_authentication>`__. |
| 7 |
It is a method to confirm a user's claimed identity by using a |
| 8 |
combination of two different factors between: |
| 9 |
|
| 10 |
#. something they know *(login / password, …)* |
| 11 |
#. something they have *(Webauthn Key, smartphone, …)* |
| 12 |
#. something they are *(biometrics like fingerprints, ...)* |
| 13 |
|
| 14 |
Since 2.0, LL::NG provides some second factor plugins that can be used for |
| 15 |
completing authentication module with 2FA: |
| 16 |
|
| 17 |
Second factors that can be registered by the user: |
| 18 |
|
| 19 |
- :doc:`Password<password2f>` *(Self-register password stored in persistent sessions)* |
| 20 |
- :doc:`TOTP<totp2f>` *(To use with* `FreeOTP <https://freeotp.github.io/>`__\ *,*\ `Google-Authenticator <https://en.wikipedia.org/wiki/Google_Authenticator>`__\ *,…)* |
| 21 |
- :doc:`WebAuthn<webauthn2f>` *(Web Authentication API)* |
| 22 |
- :doc:`Yubico OTP<yubikey2f>` *(Legacy OTP method from Yubico)* |
| 23 |
|
| 24 |
Second factors that rely on external systems: |
| 25 |
|
| 26 |
- :doc:`E-Mail 2F<mail2f>` *(Send a code to an email address)* |
| 27 |
- :doc:`External 2F<external2f>` *(To call an external command)* |
| 28 |
- :doc:`Okta<okta2f>` *(To use Okta API)* |
| 29 |
- :doc:`RADIUS<radius2f>` *(Remote RADIUS server)* |
| 30 |
- :doc:`REST<rest2f>` *(Remote REST app)* |
| 31 |
|
| 32 |
.. |deprecated| image:: /documentation/deprecated.png |
| 33 |
:alt: deprecated |
| 34 |
|
| 35 |
The E-Mail, External and REST 2F modules |
| 36 |
:doc:`may be declared multiple times<sfextra>` with different sets of |
| 37 |
parameters. |
| 38 |
|
| 39 |
|
| 40 |
Self-care on Portal |
| 41 |
------------------- |
| 42 |
|
| 43 |
User may register second factors themselves on the Portal by using the 2FA Manager. |
| 44 |
|
| 45 |
The link will be displayed if at least one SFA module is enabled. You can set a |
| 46 |
rule to display or not the link. |
| 47 |
|
| 48 |
Registration on first use |
| 49 |
------------------------- |
| 50 |
|
| 51 |
If you want to force a 2F registration on first login, you can use the *Force |
| 52 |
2FA registration at login* option. |
| 53 |
|
| 54 |
You can use a :doc:`rule <writingrulesand_headers>` to enable this behavior only for |
| 55 |
some users. |
| 56 |
|
| 57 |
.. versionadded:: 2.23.0 |
| 58 |
|
| 59 |
Using an expression such as ``$targetAuthnLevel <= 10`` forces a user to |
| 60 |
register a second factor if the application targetAuthnLevel is equal to the |
| 61 |
required authentication level. |
| 62 |
|
| 63 |
Session upgrade through 2FA |
| 64 |
--------------------------- |
| 65 |
|
| 66 |
|beta| |
| 67 |
|
| 68 |
If you enable the *Use 2FA for session upgrade* option, second factor will only |
| 69 |
be asked on login if the target application requires an authentication level |
| 70 |
that is strictly higher than the one obtained by the Authentication backend |
| 71 |
(first factor). |
| 72 |
|
| 73 |
The session upgrade mechanism will only require the second factor step, instead |
| 74 |
of doing a complete reauthentication. |
| 75 |
|
| 76 |
.. tip:: |
| 77 |
|
| 78 |
You can disable the upgrade confirmation by setting on the *Skip upgrade confirmation* |
| 79 |
option. |
| 80 |
|
| 81 |
Go in Manager, ``General Parameters`` » ``Advanced parameters`` » ``Portal redirections``. |
| 82 |
|
| 83 |
.. |beta| image:: /documentation/beta.png |
| 84 |
|
| 85 |
Special Rule Activation |
| 86 |
----------------------- |
| 87 |
|
| 88 |
When activating second factor an additional option is available called "Special |
| 89 |
Rule". This option allows the second factor to be enabled only when the |
| 90 |
conditions of the expression are met. |
| 91 |
|
| 92 |
Using an expression such as ``$targetAuthnLevel <= 10`` enables the second |
| 93 |
factor when the application targetAuthnLevel is equal to the required |
| 94 |
authentication level. |
| 95 |
|
| 96 |
Login timeout |
| 97 |
------------- |
| 98 |
|
| 99 |
Allowed time for the user to authenticate using their second factor. By default |
| 100 |
it is set to 2 minutes, but some complex second factor types (TOTP, email...) |
| 101 |
may require more time to be used. |
| 102 |
|
| 103 |
Registration timeout |
| 104 |
-------------------- |
| 105 |
|
| 106 |
Allowed time for the user to register their new second factor. By default it is |
| 107 |
set to 2 minutes, but some complex second factor types (TOTP...) may require |
| 108 |
more time to be registered. |
| 109 |
|
| 110 |
Allowed retries |
| 111 |
--------------- |
| 112 |
|
| 113 |
You can allow users to retry entering their second factor multiple times. By |
| 114 |
default, users get only one chance, and must reauthenticate if they fail to |
| 115 |
input their second factor correctly on the first try. |
| 116 |
|
| 117 |
Second factor expiration |
| 118 |
------------------------ |
| 119 |
|
| 120 |
You can display a message if an expired second factor has been removed by |
| 121 |
enabling *Display a message if an expired SF is removed* option or setting a |
| 122 |
rule. |
| 123 |
SF name(s) or number of removed SF can be displayed in message BODY by using |
| 124 |
`_nameSF_` or `_removedSF_` respectively. |
| 125 |
|
| 126 |
Providing tokens from an external source |
| 127 |
---------------------------------------- |
| 128 |
|
| 129 |
If you do not want to use self-registration features for Webauthn, TOTP and so |
| 130 |
on, you can set devices by yourself *(in your LDAP server for example)* |
| 131 |
and map it to ``_2fDevices`` attribute. ``_2fDevices`` is a JSON array |
| 132 |
that contains device descriptions : |
| 133 |
|
| 134 |
.. code:: |
| 135 |
|
| 136 |
[ {"type" : "TOTP", "name" : "MyTOTP", …}, {<other_device>}, …] |
| 137 |
|
| 138 |
TOTP Device |
| 139 |
~~~~~~~~~~~ |
| 140 |
|
| 141 |
.. code-block:: json |
| 142 |
|
| 143 |
{"name" : "MyTOTP" , "type" : "TOTP" , "_secret" : "########" , "epoch" : "1523817955"} |
| 144 |
|
| 145 |
Yubico OTP Device |
| 146 |
~~~~~~~~~~~~~~~~~ |
| 147 |
|
| 148 |
.. code-block:: json |
| 149 |
|
| 150 |
{"name" : "MyYubikey" , "type" : "UBK" , "_yubikey" : "########" , "epoch" : "1523817715"} |
| 151 |
|
| 152 |
Developer corner |
| 153 |
---------------- |
| 154 |
|
| 155 |
To develop a new 2FA plugin, read |
| 156 |
``Lemonldap::NG::Portal::Main::SecondFactor (3pm)`` manpage. Your 2F |
| 157 |
module must be a Perl class named |
| 158 |
``Lemonldap::NG::Portal::2F:://<custom_name>//``. To enable it, set |
| 159 |
``available2F`` key in your ``lemonldap-ng.ini`` file : |
| 160 |
|
| 161 |
.. code-block:: ini |
| 162 |
|
| 163 |
[portal] |
| 164 |
available2F = TOTP,<custom_name> |
| 165 |
|
| 166 |
To enable manager Second Factor Administration Module, set |
| 167 |
``enabledModules`` key in your ``lemonldap-ng.ini`` file : |
| 168 |
|
| 169 |
.. code-block:: ini |
| 170 |
|
| 171 |
[portal] |
| 172 |
enabledModules = conf, sessions, notifications, 2ndFA |